Polkadot Apps
    Preparing search index...

    Function xchachaEncryptPacked

    • Encrypt binary data with XChaCha20-Poly1305, returning a single packed buffer.

      Output format: nonce(24) || ciphertext. Convenient for storage or transmission where a single blob is preferred.

      Parameters

      • data: Uint8Array

        Binary data to encrypt.

      • key: Uint8Array

        32-byte encryption key.

      Returns Uint8Array

      Single Uint8Array with nonce prepended to ciphertext.

      If key is not exactly 32 bytes.

      const packed = xchachaEncryptPacked(data, key);
      const plaintext = xchachaDecryptPacked(packed, key);