Verify a password against stored hash and salt.
(password: str, stored_hash: str, stored_salt: str)
| 203 | |
| 204 | @staticmethod |
| 205 | def _verify_password(password: str, stored_hash: str, stored_salt: str) -> bool: |
| 206 | """Verify a password against stored hash and salt.""" |
| 207 | salt = bytes.fromhex(stored_salt) |
| 208 | pw_hash = hashlib.pbkdf2_hmac( |
| 209 | 'sha256', |
| 210 | password.encode('utf-8'), |
| 211 | salt, |
| 212 | AuthManager.PBKDF2_ITERATIONS |
| 213 | ) |
| 214 | return secrets.compare_digest(pw_hash.hex(), stored_hash) |
| 215 | |
| 216 | # ========================================================================= |
| 217 | # FERNET KEY WRAPPING |
no test coverage detected