hash
Password hashing utility function using bcrypt for secure password storage.
Source
Type Definition
function hash(password: string): string
hash.compare = function (password: string, hashed: string): boolean
Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
password | string | ✅ | - | Plain text password to hash |
Methods
hash
Hashes a password using bcrypt with automatic salt generation.
Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
password | string | ✅ | - | Plain text password to hash |
Returns
string
hash.compare
Compares a plain text password with a hashed password.
Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
password | string | ✅ | - | Plain text password |
hashed | string | ✅ | - | Previously hashed password |
Returns
boolean
Last modified: 2025-06-10