Crypto Lib
    Preparing search index...

    Function modernChaCha20Encrypt

    • Encrypt plaintext using ChaCha20-Poly1305, preferring WebCrypto when available.

      Output format: base64(nonce (12B) || ciphertext || tag (16B)). Falls back to @noble/ciphers when WebCrypto does not support ChaCha20-Poly1305.

      Parameters

      Returns Promise<ModernAeadResult>

      const result = await modernChaCha20Encrypt({
      key: "a".repeat(64),
      plaintext: "hello world",
      });
      console.log(result.ciphertext); // base64 string