Crypto Lib
    Preparing search index...

    Function wasmAeadDecrypt

    • Decrypt data using XChaCha20-Poly1305 with the fastest available backend.

      Parameters

      • options: {
            key: string | Uint8Array<ArrayBufferLike>;
            ciphertext: string;
            aad?: Uint8Array<ArrayBufferLike>;
        }
        • key: string | Uint8Array<ArrayBufferLike>

          256-bit key (hex or Uint8Array).

        • ciphertext: string

          Base64-encoded ciphertext from wasmAeadEncrypt.

        • Optionalaad?: Uint8Array<ArrayBufferLike>

          Optional AAD (must match encryption).

      Returns WasmAeadDecryptResult

      const result = wasmAeadDecrypt({ key: keyHex, ciphertext: ct });
      console.log(Buffer.from(result.plaintext).toString("utf8"));