PasswordUtils

localauth. PasswordUtils

Various utilities related to password functionality

Constructor

new PasswordUtils()

Source:

Methods

(async, static) compare(plainPassword, hash) → {Promise}

Source:
Compares a plain password to a hash
Parameters:
Name Type Description
plainPassword String
hash String
Returns:
Type
Promise

(async, static) createReset(email, lifespan) → {Promise}

Source:
Creates a password reset token
Parameters:
Name Type Description
email String The user's email address
lifespan Number The intended token lifespan in milliseconds
Returns:
Resolves with the token value
Type
Promise

(async, static) deleteReset(token) → {Promise}

Source:
Deletes a stored password reset token
Parameters:
Name Type Description
token String The token value
Returns:
Type
Promise

(async, static) generate(plainPassword) → {Promise}

Source:
Generates a secure hash from a plain-text password
Parameters:
Name Type Description
plainPassword String
Returns:
Resolves with the hash
Type
Promise

(async, static) getConfig() → {Promise}

Source:
Retrieves a localauth config item
Returns:
Type
Promise

(async, static) getRandomHex(size) → {Promise}

Source:
Creates a random hex string
Parameters:
Name Type Default Description
size Number 32 Size of string
Returns:
Resolves with the string value
Type
Promise

(async, static) validate(password) → {Promise}

Source:
Validates a password against the stored config settings
Parameters:
Name Type Description
password String Password to validate
Returns:
Resolves if the password passes the validation
Type
Promise

(async, static) validateReset(token) → {Promise}

Source:
Validates a password reset token
Parameters:
Name Type Description
token String The password reset token
Returns:
Rejects on invalid token
Type
Promise