pub trait PasswordHasher: Send + Sync {
// Required methods
fn hash<'life0, 'life1, 'async_trait>(
&'life0 self,
password: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn verify<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
hash: &'life1 str,
password: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<bool, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
}Expand description
Custom password hasher trait for pluggable password hashing strategies.
When provided in plugin configs, this overrides the default Argon2-based password hashing.
Required Methods§
Sourcefn hash<'life0, 'life1, 'async_trait>(
&'life0 self,
password: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn hash<'life0, 'life1, 'async_trait>(
&'life0 self,
password: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Hash a plaintext password and return the hash string.
Sourcefn verify<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
hash: &'life1 str,
password: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<bool, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn verify<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
hash: &'life1 str,
password: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<bool, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Verify a password against a hash string. Returns true if the password matches.