Class: SalmonTextEncryptor

SalmonTextEncryptor()

Utility class that encrypts and decrypts text strings.

Constructor

new SalmonTextEncryptor()

Source:

Methods

(async, static) encryptString(text, key, nonce, header, integrity, hashKey, chunkSize) → {Promise.<string>}

Encrypts a text String using AES256 with the key and nonce provided.
Parameters:
Name Type Default Description
text string Text to be encrypted.
key Uint8Array The encryption key to be used.
nonce Uint8Array The nonce to be used.
header boolean Set to true to store a header with information like nonce and/or chunk size, otherwise you will have to store that information externally.
integrity boolean false True if you want to calculate and store hash signatures for each chunkSize
hashKey Uint8Array | null null Hash key to be used for all chunks.
chunkSize Promise.<string> null The chunk size.
Source:
Throws:
  • IOException Thrown if there is an IO error.
  • SalmonSecurityException Thrown when error with security
  • IntegrityException Thrown if the data are corrupt or tampered with.
Returns:
The encrypted string.
Type
Promise.<string>