Skip to main content
Module

x/hpke/x/chacha20poly1305/mod.ts>Chacha20Poly1305

A Hybrid Public Key Encryption (HPKE) module built on top of Web Cryptography API.
Latest
class Chacha20Poly1305
implements AeadInterface
import { Chacha20Poly1305 } from "https://deno.land/x/hpke@1.2.7/x/chacha20poly1305/mod.ts";

The ChaCha20Poly1305 for HPKE AEAD implementing AeadInterface.

When using @hpke/core, the instance of this class can be specified to the aead parameter of CipherSuiteParams instead of AeadId.Chacha20Poly1305 as follows:

Examples

Example 1

import {
  CipherSuite,
  DhkemP256HkdfSha256,
  HkdfSha256,
} from "http://deno.land/x/hpke/core/mod.ts";
import {
  Chacha20Poly1305,
} from "https://deno.land/x/hpke/x/chach20poly1305/mod.ts";

const suite = new CipherSuite({
  kem: new DhkemP256HkdfSha256(),
  kdf: new HkdfSha256(),
  aead: new Chacha20Poly1305(),
});

This class is implemented using @noble/ciphers.

Properties

readonly
id: AeadId

AeadId.Chacha20Poly1305 (0x0003)

readonly
keySize: number

32

readonly
nonceSize: number

12

readonly
tagSize: number

16

Methods

createEncryptionContext(key: ArrayBuffer): AeadEncryptionContext