Skip to main content

SensitiveValue

Trait SensitiveValue 

Source
pub trait SensitiveValue: Sized {
    type Encrypted: Clone + Serialize + DeserializeOwned + SurrealValue;

    // Required methods
    fn encrypt_value(
        &self,
        context: &CryptoContext,
    ) -> Result<Self::Encrypted, CryptoError>;
    fn decrypt_value(
        encrypted: &Self::Encrypted,
        context: &CryptoContext,
    ) -> Result<Self, CryptoError>;
}
Expand description

Runtime/storage seam for enum-bearing leaves inside an approved secure container.

This preserves the direct #[secure] Enum boundary while allowing containing sensitive shapes to store enum-bearing values through an encrypted byte payload.

Required Associated Types§

Source

type Encrypted: Clone + Serialize + DeserializeOwned + SurrealValue

Stored representation for this secure value seam.

Required Methods§

Source

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

Encrypt one value under an already-resolved secure-field context.

Source

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

Decrypt one stored value back into the caller-facing type.

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§