PasswordUtils

localauth. PasswordUtils

Various utilities related to password functionality

Constructor

new PasswordUtils()

Source:

Methods

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

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

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

Description:
  • Creates a password reset token
Source:
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}

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

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

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

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

Description:
  • Retrieves a localauth config item
Source:
Returns:
Type
Promise

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

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

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

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

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

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