This class is used to encrypt an decrypt data with a password
The constructor
Name | Type | Description |
---|---|---|
salt | String | Salt to be used for encoding and decoding operations. If none, a default value is provided. |
This method decrypt data with a password
Name | Type | Description |
---|---|---|
data | Uint8Array | The data to decrypt. See TextDecoder ( ) to transform Uint8Array to string |
onOk | Function | A function to execute when the decryption succeeds |
onError | Function | A function to execute when the decryption fails |
pswdPromise | Promise | A Promise that fullfil with a password. Typically a dialog... |
This method encrypt data with a password
Name | Type | Description |
---|---|---|
data | Uint8Array | The data to encrypt. See TextEncoder ( ) to transform string to Uint8Array |
onOk | Function | A function to execute when the encryption succeeds |
onError | Function | A function to execute when the encryption fails |
pswdPromise | Promise | A Promise that fullfil with a password. Typically a dialog... |
Salt to be used for encoding and decoding operations.
Call the decrypt() method of the SubtleCrypto interface
Name | Type | Description |
---|---|---|
decryptKey | CryptoKey | The key to use for decryption |
data | Uint8Array | The data to decode |
Call the deriveKey() method of the SubtleCrypto interface
Name | Type | Description |
---|---|---|
masterKey | CryptoKey | The CryptoKey returned by the onOk handler of the Promise returned by #importKey |
salt | String | The salt to use |
Call the encrypt() method of the SubtleCrypto interface
Name | Type | Description |
---|---|---|
encryptKey | CryptoKey | The key to use for encryption |
ivBytes | Uint8Array | A Uint8Array with random values used for encoding |
data | Uint8Array | The data to encode transformed to a Uint8Array with TextEncoder.encode ( ) |
Call the importKey() method of the SubtleCrypto interface
Name | Type | Description |
---|---|---|
pswd | Uint8Array | The password to use, encode with TextEncoder.encode ( ) |