Skip to main content

Sensitive

Trait Sensitive 

Source
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§

Source

type Encrypted

The encrypted representation paired with this plaintext type.

Required Methods§

Source

fn encrypt( &self, context: &CryptoContext, ) -> Result<Self::Encrypted, CryptoError>

Encrypts the value into its generated encrypted representation.

Source

fn decrypt( encrypted: &Self::Encrypted, context: &CryptoContext, ) -> Result<Self, CryptoError>

Decrypts a generated encrypted value back into the plaintext type.

Source

fn encrypt_with_runtime_resolver(&self) -> Result<Self::Encrypted, CryptoError>

Encrypts using generated runtime tag resolution rather than a caller-supplied context.

Source

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.

Implementors§