verifyPassword()function
verifyPassword(password: string, hash: string): Promise<boolean>
| Param | Type | |
|---|---|---|
password | string | The password to verify. required |
hash | string | String in the format salt$iterations$hash, where salt and hash are base64-encoded. required |
| Return | |
|---|---|
Promise<boolean> | True if the password matches the hash, false otherwise. - Returns false (never throws) for malformed hash strings or invalid iteration counts. |
Verify a password against a stored salt$iterations$hash string using PBKDF2.
Examples
await verifyPassword("correct-horse", storedHash) // true