pub trait Sensitive: Sized {
type Encrypted;
// Required methods
fn encrypt(
&self,
context: &CryptoContext,
) -> Result<Self::Encrypted, CryptoError>;
fn decrypt(
encrypted: &Self::Encrypted,
context: &CryptoContext,
) -> Result<Self, CryptoError>;
fn encrypt_with_runtime_resolver(
&self,
) -> Result<Self::Encrypted, CryptoError>;
fn decrypt_with_runtime_resolver(
encrypted: &Self::Encrypted,
) -> Result<Self, CryptoError>;
}Expand description
Trait implemented by encrypted domain types generated by #[derive(Sensitive)].
Required Associated Types§
Required Methods§
Sourcefn encrypt(
&self,
context: &CryptoContext,
) -> Result<Self::Encrypted, CryptoError>
fn encrypt( &self, context: &CryptoContext, ) -> Result<Self::Encrypted, CryptoError>
Encrypts the value into its generated encrypted representation.
Sourcefn decrypt(
encrypted: &Self::Encrypted,
context: &CryptoContext,
) -> Result<Self, CryptoError>
fn decrypt( encrypted: &Self::Encrypted, context: &CryptoContext, ) -> Result<Self, CryptoError>
Decrypts a generated encrypted value back into the plaintext type.
Sourcefn encrypt_with_runtime_resolver(&self) -> Result<Self::Encrypted, CryptoError>
fn encrypt_with_runtime_resolver(&self) -> Result<Self::Encrypted, CryptoError>
Encrypts using generated runtime tag resolution rather than a caller-supplied context.
Sourcefn decrypt_with_runtime_resolver(
encrypted: &Self::Encrypted,
) -> Result<Self, CryptoError>
fn decrypt_with_runtime_resolver( encrypted: &Self::Encrypted, ) -> Result<Self, CryptoError>
Decrypts using generated runtime tag resolution rather than a caller-supplied context.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.