@blockchaincommons/crypto - v1.0.0-beta.3
    Preparing search index...

    Interface Chacha20Poly1305

    The chacha20Poly1305 family.

    interface Chacha20Poly1305 {
        KEY_SIZE: 32;
        NONCE_SIZE: 12;
        TAG_SIZE: 16;
        encrypt(
            key: Uint8Array,
            nonce: Uint8Array,
            plaintext: Uint8Array,
            options?: AeadOptions,
        ): Uint8Array<ArrayBuffer>;
        decrypt(
            key: Uint8Array,
            nonce: Uint8Array,
            sealed: Uint8Array,
            options?: AeadOptions,
        ): Uint8Array<ArrayBuffer>;
    }
    Index
    KEY_SIZE: 32

    Key length in bytes.

    NONCE_SIZE: 12

    Nonce length in bytes (IETF, 96-bit).

    TAG_SIZE: 16

    Poly1305 tag length in bytes; the trailing bytes of a sealed buffer.

    • Returns ciphertext || tag; the tag is the trailing 16 bytes.

      Parameters

      • key: Uint8Array
      • nonce: Uint8Array
      • plaintext: Uint8Array
      • Optionaloptions: AeadOptions

      Returns Uint8Array<ArrayBuffer>

      InvalidParameter on a non-Uint8Array argument; InvalidSize on a wrong-length key or nonce.

    • Takes ciphertext || tag.

      Parameters

      • key: Uint8Array
      • nonce: Uint8Array
      • sealed: Uint8Array
      • Optionaloptions: AeadOptions

      Returns Uint8Array<ArrayBuffer>

      InvalidParameter on a non-Uint8Array argument; InvalidSize on a wrong-length key or nonce, or sealed data shorter than the tag; AuthenticationFailed on tag mismatch.