Methods
(async, static) getKeyFromPassword(password, salt, iterations, outputBytes) → {Promise.<Uint8Array>}
Function will derive a key from a text password
Parameters:
Name | Type | Description |
---|---|---|
password |
string | The password that will be used to derive the key |
salt |
Uint8Array | The salt byte array that will be used together with the password |
iterations |
number | The iterations to be used with Pbkdf2 |
outputBytes |
number | The number of bytes for the key |
Throws:
SalmonSecurityException Thrown when error with security
Returns:
The derived key.
- Type
- Promise.<Uint8Array>
(async, static) getMasterKey(pass, salt, iterations, length) → {Promise.<Uint8Array>}
Derives the key from a text password
Parameters:
Name | Type | Description |
---|---|---|
pass |
string | The text password to be used |
salt |
Uint8Array | The salt to be used for the key derivation |
iterations |
number | The number of iterations the key derivation algorithm will use |
length |
number | The length of master key to return |
Throws:
SalmonSecurityException Thrown when error with security
Returns:
The derived master key.
- Type
- Promise.<Uint8Array>
(static) getPbkdfAlgo() → {PbkdfAlgo}
Returns the current global PBKDF algorithm.
Returns:
The PBKDF algorithm to be used.
- Type
- PbkdfAlgo
(static) setPbkdfAlgo(pbkdfAlgo)
Set the global PDKDF algorithm to be used for key derivation.
Parameters:
Name | Type | Description |
---|---|---|
pbkdfAlgo |
PbkdfAlgo | The Pbkdf algorithm |
(static) setPbkdfProvider(pbkdfProvider)
Set the global PBKDF provider to be used for text key derivation.
Parameters:
Name | Type | Description |
---|---|---|
pbkdfProvider |
ISalmonPbkdfProvider | The PBKDF provider. |
(static) setPbkdfType(pbkdfType)
Set the global PBKDF implementation to be used for text key derivation.
Parameters:
Name | Type | Description |
---|---|---|
pbkdfType |
PbkdfType | The pbkdf implementation type. |