pub struct Ed25519SelfEncryptedContent {
pub ciphertext: Vec<u8>,
pub nonce: [u8; 12],
}Expand description
Ed25519-derived ChaCha20-Poly1305 encrypted content Simple self-encryption using only the sender’s ed25519 keypair derived from mnemonic Only the sender can decrypt this content (encrypt-to-self pattern) Public key is available from message sender field - no need to duplicate
Fields§
§ciphertext: Vec<u8>Encrypted data + authentication tag
nonce: [u8; 12]ChaCha20-Poly1305 nonce (12 bytes)
Implementations§
Source§impl Ed25519SelfEncryptedContent
impl Ed25519SelfEncryptedContent
Sourcepub fn encrypt(
plaintext: &[u8],
signing_key: &SigningKey,
) -> Result<Self, CryptoError>
pub fn encrypt( plaintext: &[u8], signing_key: &SigningKey, ) -> Result<Self, CryptoError>
Encrypt data using ed25519 private key (self-encryption) Derives a ChaCha20 key from the ed25519 private key deterministically Only the same private key can decrypt this content
Sourcepub fn decrypt(&self, signing_key: &SigningKey) -> Result<Vec<u8>, CryptoError>
pub fn decrypt(&self, signing_key: &SigningKey) -> Result<Vec<u8>, CryptoError>
Decrypt data using ed25519 private key (self-decryption) Must be the same private key that was used for encryption
Trait Implementations§
Source§impl Clone for Ed25519SelfEncryptedContent
impl Clone for Ed25519SelfEncryptedContent
Source§fn clone(&self) -> Ed25519SelfEncryptedContent
fn clone(&self) -> Ed25519SelfEncryptedContent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Ed25519SelfEncryptedContent
impl Debug for Ed25519SelfEncryptedContent
Source§impl<'de> Deserialize<'de> for Ed25519SelfEncryptedContent
impl<'de> Deserialize<'de> for Ed25519SelfEncryptedContent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Ed25519SelfEncryptedContent
impl StructuralPartialEq for Ed25519SelfEncryptedContent
Auto Trait Implementations§
impl Freeze for Ed25519SelfEncryptedContent
impl RefUnwindSafe for Ed25519SelfEncryptedContent
impl Send for Ed25519SelfEncryptedContent
impl Sync for Ed25519SelfEncryptedContent
impl Unpin for Ed25519SelfEncryptedContent
impl UnwindSafe for Ed25519SelfEncryptedContent
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more