pub struct SecurityManager { /* private fields */ }Expand description
Security manager for handling encryption and compression
Implementations§
Source§impl SecurityManager
impl SecurityManager
pub fn new(config: SecurityConfig) -> Result<Self, SecurityError>
Sourcepub async fn secure_data(
&self,
data: &[u8],
key: &EncryptionKey,
) -> Result<Vec<u8>, SecurityError>
pub async fn secure_data( &self, data: &[u8], key: &EncryptionKey, ) -> Result<Vec<u8>, SecurityError>
Secure data (encrypt and compress)
Sourcepub async fn unsecure_data(
&self,
data: &[u8],
key: &EncryptionKey,
) -> Result<Vec<u8>, SecurityError>
pub async fn unsecure_data( &self, data: &[u8], key: &EncryptionKey, ) -> Result<Vec<u8>, SecurityError>
Unsecure data (decrypt and decompress)
Sourcepub async fn derive_key(
&self,
password: &str,
salt: Option<&[u8]>,
) -> Result<Vec<u8>, SecurityError>
pub async fn derive_key( &self, password: &str, salt: Option<&[u8]>, ) -> Result<Vec<u8>, SecurityError>
Generate a secure key from a password
Sourcepub fn generate_nonce(&self) -> Result<Vec<u8>, SecurityError>
pub fn generate_nonce(&self) -> Result<Vec<u8>, SecurityError>
Generate a random nonce (for compatibility)
Sourcepub fn config(&self) -> &SecurityConfig
pub fn config(&self) -> &SecurityConfig
Get security configuration
Sourcepub fn update_config(
&mut self,
config: SecurityConfig,
) -> Result<(), SecurityError>
pub fn update_config( &mut self, config: SecurityConfig, ) -> Result<(), SecurityError>
Update security configuration
Auto Trait Implementations§
impl Freeze for SecurityManager
impl RefUnwindSafe for SecurityManager
impl Send for SecurityManager
impl Sync for SecurityManager
impl Unpin for SecurityManager
impl UnwindSafe for SecurityManager
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.