pub struct Credentials {
pub username: SecureString,
pub password: SecureString,
pub confirm_password: SecureString,
}Expand description
The credentials needed to encrypt and decrypt a file.
Credentials are erased from memory when they are dropped.
But they can also be erased manually by calling the Credentials::erase()
Fields§
§username: SecureString§password: SecureString§confirm_password: SecureStringImplementations§
Source§impl Credentials
impl Credentials
pub fn new( username: SecureString, password: SecureString, confirm_password: SecureString, ) -> Self
Sourcepub fn new_with_capacity(capacity: usize) -> Result<Self, CredentialsError>
pub fn new_with_capacity(capacity: usize) -> Result<Self, CredentialsError>
Creates a new Credentials instance with the specified capacity.
Sourcepub fn erase(&mut self)
pub fn erase(&mut self)
Erases the credentials from memory by zeroizing the username and password fields.
This method is automatically called when the Credentials instance is dropped.
Sourcepub fn copy_passwd_to_confirm(&mut self)
pub fn copy_passwd_to_confirm(&mut self)
Copy password to confirm password
pub fn is_valid(&self) -> Result<(), CredentialsError>
Trait Implementations§
Source§impl Clone for Credentials
impl Clone for Credentials
Source§fn clone(&self) -> Credentials
fn clone(&self) -> Credentials
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Credentials
impl RefUnwindSafe for Credentials
impl Send for Credentials
impl Sync for Credentials
impl Unpin for Credentials
impl UnwindSafe for Credentials
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