import { Key, type Encryptor } from './key'; import { RawMap } from './map'; /** * ChaCha20Poly1305Key implements the ChaCha20/Poly1305 content encryption * algorithm for COSE, as defined in RFC 9053. Use it as the content key with * {@link Encrypt0Message} or {@link EncryptMessage}. * * Construction signature: `generate(kid?)` — the algorithm is fixed, so the * first argument is the optional key id, not the algorithm. The key is always * 32 bytes. * * @example * ```ts * const key = ChaCha20Poly1305Key.generate() * const cose = await new Encrypt0Message(payload).toBytes(key) * const out = await Encrypt0Message.fromBytes(key, cose) * ``` * * @see https://datatracker.ietf.org/doc/html/rfc9053#name-chacha20-and-poly1305 */ export declare class ChaCha20Poly1305Key extends Key implements Encryptor { /** Decodes a COSE_Key from CBOR bytes into a ChaCha20Poly1305Key. */ static fromBytes(data: Uint8Array): ChaCha20Poly1305Key; /** * Generates a new random ChaCha20/Poly1305 key (32 bytes). * * @param kid - Optional key id. */ static generate(kid?: T): ChaCha20Poly1305Key; /** * Imports a ChaCha20/Poly1305 key from raw bytes. * * @param secret - The 32-byte key. * @param kid - Optional key id. */ static fromSecret(secret: Uint8Array, kid?: T): ChaCha20Poly1305Key; constructor(kv?: RawMap); nonceSize(): number; getSecretKey(): Uint8Array; encrypt(plaintext: Uint8Array, nonce: Uint8Array, aad?: Uint8Array): Promise; decrypt(ciphertext: Uint8Array, nonce: Uint8Array, aad?: Uint8Array): Promise; }