hashPassword
function hashPassword(password): Promise<string>;Defined in: src/auth/basic.ts:62
Hash a password with scrypt and a fresh random salt.
The returned string is self-describing and safe to store in config or a
database: scrypt$<saltHex>$<hashHex>. Pass it back to
verifyPassword (or supply it as a user’s passwordHash) to check a
candidate password.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
password |
string |
Returns
Section titled “Returns”Promise<string>
Example
Section titled “Example”const stored = await hashPassword("correct horse battery staple");// → "scrypt$<32 hex chars>$<128 hex chars>"