Function aesGcmEncrypt

  • Encrypts plaintext using AES-GCM with supplied password, for decryption with aesGcmDecrypt(). (c) Chris Veness MIT Licence Modified to work with Uint8Array and string content.


    const ciphertext = await aesGcmEncrypt('my secret text', 'pw');
    aesGcmEncrypt('my secret text', 'pw').then(function(ciphertext) { console.log(ciphertext); });

    Type Parameters

    • T extends string | Uint8Array


    • content: T

      Plaintext or Uint8 Buffer to be encrypted.

    • password: string | Uint8Array

      Plaintext or Uint8 Buffer Password to use to encrypt content.

    • Optional prefix: string | Uint8Array

      Optional prefix to prepend to the ciphertext.

    Returns Promise<T>

    Encrypted ciphertext. If content is a string, the ciphertext is a string. If content is a Uint8Array, the ciphertext is a new Uint8Array.

Generated using TypeDoc