pub struct PasswordManager { /* private fields */ }Expand description
Password manager for hashing and verifying passwords
Implementations§
Source§impl PasswordManager
impl PasswordManager
Sourcepub fn with_policy(policy: PasswordPolicy) -> Self
pub fn with_policy(policy: PasswordPolicy) -> Self
Create a password manager with custom policy
Sourcepub fn policy(&self) -> &PasswordPolicy
pub fn policy(&self) -> &PasswordPolicy
Get the current policy
Sourcepub fn hash_password(&self, password: &str) -> Result<String>
pub fn hash_password(&self, password: &str) -> Result<String>
Hash a password using Argon2
Sourcepub fn verify_password(&self, password: &str, hash: &str) -> Result<bool>
pub fn verify_password(&self, password: &str, hash: &str) -> Result<bool>
Verify a password against a hash
Sourcepub fn validate_password(
&self,
password: &str,
username: Option<&str>,
) -> PolicyValidationResult
pub fn validate_password( &self, password: &str, username: Option<&str>, ) -> PolicyValidationResult
Validate password against policy
Sourcepub fn check_password_strength(&self, password: &str) -> PasswordStrength
pub fn check_password_strength(&self, password: &str) -> PasswordStrength
Check password strength
Sourcepub fn generate_password(&self) -> String
pub fn generate_password(&self) -> String
Generate a random password meeting policy requirements
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PasswordManager
impl RefUnwindSafe for PasswordManager
impl Send for PasswordManager
impl Sync for PasswordManager
impl Unpin for PasswordManager
impl UnwindSafe for PasswordManager
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