fix: migrate PIN hashing from SHA-256 to Argon2id (#54) #55
1 changed files with 4 additions and 3 deletions
|
|
@ -191,9 +191,10 @@ pub fn verify_pin(pin: String, stored_hash: String) -> Result<VerifyPinResult, S
|
|||
let valid: bool = result.as_slice().ct_eq(&expected_hash).into();
|
||||
|
||||
if valid {
|
||||
// Re-hash with Argon2id so this legacy PIN is upgraded
|
||||
let new_hash = hash_pin(pin)?;
|
||||
Ok(VerifyPinResult { valid: true, rehashed: Some(new_hash) })
|
||||
// Re-hash with Argon2id so this legacy PIN is upgraded.
|
||||
// If rehash fails, still allow login — don't block the user.
|
||||
let rehashed = hash_pin(pin).ok();
|
||||
Ok(VerifyPinResult { valid: true, rehashed })
|
||||
} else {
|
||||
Ok(VerifyPinResult { valid: false, rehashed: None })
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue