pub struct EncryptionManager { /* private fields */ }Expand description
AES-256-GCM encryption manager
Implementations§
Source§impl EncryptionManager
impl EncryptionManager
Sourcepub fn generate_master_key() -> [u8; 32]
pub fn generate_master_key() -> [u8; 32]
Generate a random master key
Sourcepub fn encrypt(&self, data: &[u8]) -> SecurityResult<EncryptedData>
pub fn encrypt(&self, data: &[u8]) -> SecurityResult<EncryptedData>
Encrypt data and return an EncryptedData container
Sourcepub fn encrypt_json(&self, json_data: &Value) -> SecurityResult<EncryptedData>
pub fn encrypt_json(&self, json_data: &Value) -> SecurityResult<EncryptedData>
Encrypt JSON data
Sourcepub fn encrypt_string(&self, text: &str) -> SecurityResult<EncryptedData>
pub fn encrypt_string(&self, text: &str) -> SecurityResult<EncryptedData>
Encrypt a string
Sourcepub fn decrypt(&self, encrypted_data: &EncryptedData) -> SecurityResult<Vec<u8>>
pub fn decrypt(&self, encrypted_data: &EncryptedData) -> SecurityResult<Vec<u8>>
Decrypt data from an EncryptedData container
Sourcepub fn decrypt_json(
&self,
encrypted_data: &EncryptedData,
) -> SecurityResult<Value>
pub fn decrypt_json( &self, encrypted_data: &EncryptedData, ) -> SecurityResult<Value>
Decrypt to JSON data
Sourcepub fn decrypt_string(
&self,
encrypted_data: &EncryptedData,
) -> SecurityResult<String>
pub fn decrypt_string( &self, encrypted_data: &EncryptedData, ) -> SecurityResult<String>
Decrypt to string
Auto Trait Implementations§
impl Freeze for EncryptionManager
impl RefUnwindSafe for EncryptionManager
impl Send for EncryptionManager
impl Sync for EncryptionManager
impl Unpin for EncryptionManager
impl UnwindSafe for EncryptionManager
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.