pub struct ConditionalEncryption { /* private fields */ }Expand description
Wrapper for conditional encryption based on configuration
Implementations§
Source§impl ConditionalEncryption
impl ConditionalEncryption
Sourcepub fn new(
encrypt_at_rest: bool,
master_key: Option<[u8; 32]>,
) -> SecurityResult<Self>
pub fn new( encrypt_at_rest: bool, master_key: Option<[u8; 32]>, ) -> SecurityResult<Self>
Create a new conditional encryption wrapper
Sourcepub fn maybe_encrypt(
&self,
data: &[u8],
) -> SecurityResult<Option<EncryptedData>>
pub fn maybe_encrypt( &self, data: &[u8], ) -> SecurityResult<Option<EncryptedData>>
Conditionally encrypt data based on configuration
Sourcepub fn maybe_encrypt_json(
&self,
json_data: &Value,
) -> SecurityResult<Option<EncryptedData>>
pub fn maybe_encrypt_json( &self, json_data: &Value, ) -> SecurityResult<Option<EncryptedData>>
Conditionally encrypt JSON data
Sourcepub fn maybe_decrypt(
&self,
encrypted_data: &EncryptedData,
) -> SecurityResult<Vec<u8>>
pub fn maybe_decrypt( &self, encrypted_data: &EncryptedData, ) -> SecurityResult<Vec<u8>>
Conditionally decrypt data
Sourcepub fn maybe_decrypt_json(
&self,
encrypted_data: &EncryptedData,
) -> SecurityResult<Value>
pub fn maybe_decrypt_json( &self, encrypted_data: &EncryptedData, ) -> SecurityResult<Value>
Conditionally decrypt JSON data
Sourcepub fn is_encryption_enabled(&self) -> bool
pub fn is_encryption_enabled(&self) -> bool
Check if encryption is enabled
Auto Trait Implementations§
impl Freeze for ConditionalEncryption
impl RefUnwindSafe for ConditionalEncryption
impl Send for ConditionalEncryption
impl Sync for ConditionalEncryption
impl Unpin for ConditionalEncryption
impl UnwindSafe for ConditionalEncryption
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.