import { Key, type Encryptor } from './key'; import { RawMap } from './map'; /** * AesGcmKey implements the AES-GCM 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(alg, kid?)` — the first argument is the * algorithm (`A128GCM`/`A192GCM`/`A256GCM`), which selects the key size. * * @example * ```ts * const key = AesGcmKey.generate(iana.AlgorithmA128GCM) * const cose = await new Encrypt0Message(payload).toBytes(key) * const out = await Encrypt0Message.fromBytes(key, cose) * ``` * * @see https://datatracker.ietf.org/doc/html/rfc9053#name-aes-gcm */ export declare class AesGcmKey extends Key implements Encryptor { /** Decodes a COSE_Key from CBOR bytes into an AesGcmKey. */ static fromBytes(data: Uint8Array): AesGcmKey; /** * Generates a new random AES-GCM key for the given algorithm. * * @param alg - The AES-GCM algorithm: `iana.AlgorithmA128GCM`, * `iana.AlgorithmA192GCM`, or `iana.AlgorithmA256GCM`. * @param kid - Optional key id. */ static generate(alg: number, kid?: T): AesGcmKey; /** * Imports an AES-GCM key from raw bytes. The algorithm is inferred from the * key length (16 → A128GCM, 24 → A192GCM, 32 → A256GCM). * * @param secret - The raw key bytes (16, 24, or 32 bytes). * @param kid - Optional key id. */ static fromSecret(secret: Uint8Array, kid?: T): AesGcmKey; constructor(kv?: RawMap); nonceSize(): number; getSecretKey(): Uint8Array; encrypt(plaintext: Uint8Array, nonce: Uint8Array, aad?: Uint8Array): Promise; decrypt(ciphertext: Uint8Array, nonce: Uint8Array, aad?: Uint8Array): Promise; }