@hpke/chacha20poly1305
Version:
A Hybrid Public Key Encryption (HPKE) module extension for ChaCha20/Poly1305
51 lines • 1.57 kB
TypeScript
import type { AeadEncryptionContext, AeadInterface } from "@hpke/common";
import { AeadId } from "@hpke/common";
export declare class Chacha20Poly1305Context implements AeadEncryptionContext {
private _key;
constructor(key: ArrayBuffer);
seal(iv: ArrayBuffer, data: ArrayBuffer, aad: ArrayBuffer): Promise<ArrayBuffer>;
open(iv: ArrayBuffer, data: ArrayBuffer, aad: ArrayBuffer): Promise<ArrayBuffer>;
private _seal;
private _open;
}
/**
* The ChaCha20Poly1305 for HPKE AEAD implementing {@link AeadInterface}.
*
* When using `@hpke/core`, the instance of this class can be specified
* to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.Chacha20Poly1305`
* as follows:
*
* @example
*
* ```ts
* import {
* CipherSuite,
* DhkemP256HkdfSha256,
* HkdfSha256,
* } from "@hpke/core";
* import {
* Chacha20Poly1305,
* } from "@hpke/chacha20poly1305";
*
* const suite = new CipherSuite({
* kem: new DhkemP256HkdfSha256(),
* kdf: new HkdfSha256(),
* aead: new Chacha20Poly1305(),
* });
* ```
*
* This class is implemented using
* {@link https://github.com/paulmillr/noble-ciphers | @noble/ciphers}.
*/
export declare class Chacha20Poly1305 implements AeadInterface {
/** AeadId.Chacha20Poly1305 (0x0003) */
readonly id: AeadId;
/** 32 */
readonly keySize: number;
/** 12 */
readonly nonceSize: number;
/** 16 */
readonly tagSize: number;
createEncryptionContext(key: ArrayBuffer): AeadEncryptionContext;
}
//# sourceMappingURL=chacha20Poly1305.d.ts.map