Constructor
new Decryptor(threads, bufferSize)
Instantiate a decryptor with parallel tasks and buffer size.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
threads |
number | 1 | The number of threads to use. |
bufferSize |
number | 0 | The buffer size to use. It is recommended for performance to use a multiple of the chunk size if you enabled integrity otherwise a multiple of the AES block size (16 bytes). |
- Source:
Classes
Methods
close()
Close the decryptor and release associated resources
- Source:
(async) decrypt(data, key, nonce, format, integrity, hashKey, chunkSize) → {Promise.<Uint8Array>}
Decrypt a byte array using AES256 based on the provided key and nonce.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
data |
Uint8Array | The input data to be decrypted. | |
key |
Uint8Array | The AES key to use for decryption. | |
nonce |
Uint8Array | null | null | The nonce to use for decryption. |
format |
EncryptionFormat | The format to use, see EncryptionFormat | |
integrity |
boolean | true | Verify hash integrity in the data. |
hashKey |
Uint8Array | null | null | The hash key to be used for integrity. |
chunkSize |
number | 0 | The chunk size. |
- Source:
Throws:
-
SalmonSecurityException Thrown if the key and nonce are not provided.
-
IOException Thrown if there is an IO error.
-
IntegrityException Thrown if the data are corrupt or tampered with.
Returns:
The byte array with the decrypted data.
@ Thrown if there is a problem with decoding the array.
- Type
- Promise.<Uint8Array>
getWorkerPath() → {string}
Get the current path for the worker javascript.
- Source:
Returns:
The path to the worker javascript.
- Type
- string
setWorkerPath(path)
Set the path where the decryptor worker. This needs to be a relative path starting from
the root of your main javascript app.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | The path to the worker javascript. |
- Source: