Athena.utility.hash ​
Variables ​
default ​
• default: Object
Type declaration ​
Name | Type |
---|---|
hashPassword | (plainTextPassword : string ) => string |
sha256 | (data : string ) => string |
sha256Random | (data : string ) => string |
testPassword | (plainTextPassword : string , pbkdf2Hash : string ) => boolean |
Defined in ​
Functions ​
hashPassword ​
Usage
Athena.utility.hash.hashPassword(plainTextPassword
): string
Hash a plain text password with pbkdf2 hash and salt.
Returns a pbkdf2 key, and salt. Which can be seperated by the $
sign.
Example ​
ts
const result = Athena.utility.hash.hashPassword('somePassword');
Parameters ​
Name | Type |
---|---|
plainTextPassword | string |
Returns ​
string
Defined in ​
sha256 ​
Usage
Athena.utility.hash.sha256(data
): string
Hash a string of data into a persistent SHA256 hash.
Parameters ​
Name | Type |
---|---|
data | string |
Returns ​
string
Defined in ​
sha256Random ​
Usage
Athena.utility.hash.sha256Random(data
): string
Hash a string of data into a random SHA256 hash.
Parameters ​
Name | Type |
---|---|
data | string |
Returns ​
string
Defined in ​
testPassword ​
Usage
Athena.utility.hash.testPassword(plainTextPassword
, pbkdf2Hash
): boolean
Test a plain text password against a stored pbkdf2 string.
Example ​
ts
// Actual pbkdf2Hash is just mock string
const doesMatch = Athena.utility.hash.testPassword('test', 'kjfdskljfsdkl$90jj0f10f21f1')
Parameters ​
Name | Type |
---|---|
plainTextPassword | string |
pbkdf2Hash | string |
Returns ​
boolean