Function encryptWithKey

  • Symmetric encryption using XChaCha20-Poly1305-IETF. The key is expected to be 256 bits in size. The nonce is randomly generated. The resulting cipher text will be have the following format: nonce || mac || cipherText This is an authenticated form of encryption. The mac provides integrity and authenticity. The returned buffers are guaranteed to unpooled. This means the underlying ArrayBuffer is safely transferrable.

    Parameters

    • key: Key
    • plainText: Buffer
    • additionalData: null | Buffer = null

    Returns Buffer

Generated using TypeDoc