Function
verify_password
(
hash: &str,
password: &[u8],
)
Source from the content-addressed store, hash-verified
| 57 | } |
| 58 | |
| 59 | fn verify_password( |
| 60 | hash: &str, |
| 61 | password: &[u8], |
| 62 | ) -> Result<bool, argon2::password_hash::Error> { |
| 63 | let parsed_hash = PasswordHash::new(hash)?; |
| 64 | match Argon2::default().verify_password(password, &parsed_hash) { |
| 65 | Ok(()) => Ok(true), |
| 66 | Err(argon2::password_hash::Error::Password) => Ok(false), |
| 67 | Err(e) => Err(e), |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | fn make_key() -> PasetoSymmetricKey<V4, PasetoLocal> { |
| 72 | let key_str = env::var("PASETO_KEY").unwrap(); |
Tested by
no test coverage detected