TypeScript API / laikacms/crypto / needsRehash
Function: needsRehash()
ts
function needsRehash(hash, targetRounds?): boolean;Check if a password hash needs to be upgraded to more secure parameters.
This is useful for gradually upgrading password security as users log in.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
hash | string | undefined | The bcrypt hash to check |
targetRounds | number | PASSWORD_CONSTANTS.MIN_ROUNDS | Target number of rounds (default: MIN_ROUNDS) |
Returns
boolean
true if the hash should be upgraded