Function
verify_password
(
hash: &str,
password: &[u8],
)
Source from the content-addressed store, hash-verified
| 71 | } |
| 72 | |
| 73 | fn verify_password( |
| 74 | hash: &str, |
| 75 | password: &[u8], |
| 76 | ) -> Result<bool, argon2::password_hash::Error> { |
| 77 | let parsed_hash = PasswordHash::new(hash)?; |
| 78 | match Argon2::default().verify_password(password, &parsed_hash) { |
| 79 | Ok(()) => Ok(true), |
| 80 | Err(argon2::password_hash::Error::Password) => Ok(false), |
| 81 | Err(e) => Err(e), |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | fn make_key() -> PasetoSymmetricKey<V4, PasetoLocal> { |
| 86 | let key_str = env::var("PASETO_KEY").unwrap(); |
Tested by
no test coverage detected