pjs.encrypt()
This API was added in Profound.js / Profound API version 7
This API can be used to encrypt data. It’s suitable for small amounts of data, as encryption is done all at once from data loaded into memory. Data encrypted with this API can be decrypted with pjs.decrypt().
The encryption algorithm used is AES-256-GCM.
Parameters
Data (Buffer). Data to encrypt. Must be a Node.js Buffer object.
Encryption key (Buffer/optional). If passed, must be a Buffer of 32 bytes. If not passed, the key specified by the encryptionKey configuration setting is used.
Return Value
A Buffer object containing the encrypted data.
Examples
const data = Buffer.from("Top Secret");
const encrypted = pjs.encrypt(data);