verifyPassword()function

verifyPassword(password: string, hash: string): Promise<boolean>
ParamType
passwordstring
The password to verify. required
hashstring
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