Class: TextEncryptor

TextEncryptor()

Utility class that encrypts and decrypts text strings.

Constructor

new TextEncryptor()

Source:

Methods

(async, static) encryptString(text, key, nonce, format, 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.
format EncryptionFormat The format to use, see EncryptionFormat
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> 0 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>