pub struct MemoryCryptoProvider { /* private fields */ }Expand description
Encrypts/decrypts individual memory text fields according to the active crypto mode. Cheap to clone.
Implementations§
Source§impl MemoryCryptoProvider
impl MemoryCryptoProvider
Sourcepub fn local_key(key: [u8; 32]) -> Self
pub fn local_key(key: [u8; 32]) -> Self
A local AES-256-GCM provider backed by the given 256-bit key.
Sourcepub fn from_mode(mode: MemoryCryptoMode) -> Self
pub fn from_mode(mode: MemoryCryptoMode) -> Self
Build a provider for an explicit crypto mode.
Sourcepub fn is_plaintext(&self) -> bool
pub fn is_plaintext(&self) -> bool
True when fields are stored as plaintext (no encryption applied).
Sourcepub fn encrypt_field(&self, plaintext: &str) -> MemoryResult<String>
pub fn encrypt_field(&self, plaintext: &str) -> MemoryResult<String>
Encrypt a memory text field for storage. Plaintext mode returns the input unchanged; hosted-pending mode fails closed.
Sourcepub fn decrypt_field(&self, stored: &str) -> MemoryResult<String>
pub fn decrypt_field(&self, stored: &str) -> MemoryResult<String>
Decrypt a stored memory text field.
- In plaintext and local-encrypted modes, values without the encryption prefix are treated as legacy plaintext for compatibility.
- In hosted mode, plaintext rows are rejected to avoid leaving memory readable at rest under encryption-required semantics.
Sourcepub fn encrypt_optional(
&self,
value: Option<&str>,
) -> MemoryResult<Option<String>>
pub fn encrypt_optional( &self, value: Option<&str>, ) -> MemoryResult<Option<String>>
Encrypt an optional JSON-ish metadata string if present.
Sourcepub fn decrypt_optional(
&self,
value: Option<&str>,
) -> MemoryResult<Option<String>>
pub fn decrypt_optional( &self, value: Option<&str>, ) -> MemoryResult<Option<String>>
Decrypt an optional stored field if present.
Trait Implementations§
Source§impl Clone for MemoryCryptoProvider
impl Clone for MemoryCryptoProvider
Source§fn clone(&self) -> MemoryCryptoProvider
fn clone(&self) -> MemoryCryptoProvider
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 MemoryCryptoProvider
impl Debug for MemoryCryptoProvider
Auto Trait Implementations§
impl Freeze for MemoryCryptoProvider
impl RefUnwindSafe for MemoryCryptoProvider
impl Send for MemoryCryptoProvider
impl Sync for MemoryCryptoProvider
impl Unpin for MemoryCryptoProvider
impl UnsafeUnpin for MemoryCryptoProvider
impl UnwindSafe for MemoryCryptoProvider
Blanket Implementations§
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