pub struct CryptoValidator { /* private fields */ }Expand description
Crypto validator
Implementations§
Source§impl CryptoValidator
impl CryptoValidator
Sourcepub fn validate_key(&self, key: &[u8]) -> SecurityResult<()>
pub fn validate_key(&self, key: &[u8]) -> SecurityResult<()>
Validate encryption key
Sourcepub fn validate_password(
&self,
password: &str,
min_length: usize,
) -> SecurityResult<()>
pub fn validate_password( &self, password: &str, min_length: usize, ) -> SecurityResult<()>
Validate password strength
Sourcepub fn hash_password(&self, password: &str) -> SecurityResult<String>
pub fn hash_password(&self, password: &str) -> SecurityResult<String>
Hash password using Argon2
Sourcepub fn verify_password(
&self,
password: &str,
hash: &str,
) -> SecurityResult<bool>
pub fn verify_password( &self, password: &str, hash: &str, ) -> SecurityResult<bool>
Verify password against hash
Sourcepub fn constant_time_compare(&self, a: &[u8], b: &[u8]) -> bool
pub fn constant_time_compare(&self, a: &[u8], b: &[u8]) -> bool
Constant-time comparison of secrets
Auto Trait Implementations§
impl Freeze for CryptoValidator
impl RefUnwindSafe for CryptoValidator
impl Send for CryptoValidator
impl Sync for CryptoValidator
impl Unpin for CryptoValidator
impl UnwindSafe for CryptoValidator
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