Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

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

  1. Data (Buffer). Data to encrypt. Must be a Node.js Buffer object.

  2. 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);
  • No labels