new HashStrategy()
Determines how the hashing is computed in the implementation You can implement this to provide a different hashing
strategy to the default.
Methods
-
computeHash(password, user) → {string}
-
Compute the hashed password given the unhashed password and the user
Parameters:
Name Type Description password
string the unhashed password user
User the user to get the salt for. This paramter is needed, if the is declared to be used Returns:
the hashed password- Type
- string
-
getSalt(user) → {string}
-
Retrieve the salt. The source of the salt can be the external salt or the propriate column of the given user, depending on the defined HashSaltStyle
Parameters:
Name Type Description user
User the user to get the salt for. This paramter is needed, if the is declared to be used Returns:
null in case of the salt of the user or a defined external salt- Type
- string
-
getSaltStyle() → {Object}
-
Get the defined HashSaltStyle of the current instance
Returns:
the saltStyle- Type
- Object
-
getStoredPwd(user) → {string}
-
Retrieve the password from the user, or as clear text or as hashed version, depending on the definition
Parameters:
Name Type Description user
User the user to get the stored password for Returns:
the password, either as hashed version or as cleartext, depending on the preferences- Type
- string
-
setExternalSalt(salt)
-
Set an external salt. This method should be used in case of
Parameters:
Name Type Description salt
string the salt, which shall be used -
setSaltStyle(saltStyle)
-
Set the saltstyle as defined by HashSaltStyle.
Parameters:
Name Type Description saltStyle
Object the HashSaltStyle to be used