TypeScript API / laikacms/crypto / verifyPassword
Function: verifyPassword()
ts
function verifyPassword(password, hash): Promise<boolean>;Verify a password against a hash with timing attack protection.
Security considerations:
- Always performs a comparison operation to maintain constant time
- Validates inputs before processing
- Uses dummy hash comparison when inputs are invalid to prevent timing leaks
Parameters
| Parameter | Type | Description |
|---|---|---|
password | string | Plain text password to verify |
hash | string | Hashed password to compare against |
Returns
Promise<boolean>
Promise resolving to true if password matches, false otherwise