pub struct SessionEncryptor { /* private fields */ }Expand description
Session encryptor for secure storage
Implementations§
Source§impl SessionEncryptor
impl SessionEncryptor
Sourcepub fn from_password(
password: &str,
salt: Option<&[u8]>,
) -> Result<(Self, Vec<u8>)>
pub fn from_password( password: &str, salt: Option<&[u8]>, ) -> Result<(Self, Vec<u8>)>
Create a new session encryptor with password-derived key
Sourcepub fn encrypt_session(&self, session_data: &SessionData) -> Result<SessionData>
pub fn encrypt_session(&self, session_data: &SessionData) -> Result<SessionData>
Encrypt a session
Sourcepub fn decrypt_session(
&self,
encrypted_session: &SessionData,
) -> Result<SessionData>
pub fn decrypt_session( &self, encrypted_session: &SessionData, ) -> Result<SessionData>
Decrypt a session
Sourcepub fn generate_key() -> [u8; 32]
pub fn generate_key() -> [u8; 32]
Generate a secure random encryption key
Auto Trait Implementations§
impl Freeze for SessionEncryptor
impl RefUnwindSafe for SessionEncryptor
impl Send for SessionEncryptor
impl Sync for SessionEncryptor
impl Unpin for SessionEncryptor
impl UnwindSafe for SessionEncryptor
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 more