Crypto Edge
    Preparing search index...

    Function encrypt

    • Encrypt data using AES-GCM via the Web Crypto API.

      Output format: iv (12 bytes) || ciphertext || tag

      Parameters

      Returns Promise<EdgeEncryptResult>

      The IV-prefixed ciphertext and IV length.

      const key = await generateKey({ algorithm: "AES-GCM" });
      const { ciphertext } = await encrypt({
      key,
      plaintext: new TextEncoder().encode("secret"),
      });