import { Header } from './header'; import { Value, type Label } from './map'; import { Key, type KeyWrapper } from './key'; /** * Recipient represents a COSE_recipient structure used by {@link EncryptMessage} * and {@link MacMessage} to carry the content encryption/MAC key for a recipient. * * Build recipients with the static factories rather than the constructor: * - {@link Recipient.direct} — the caller-provided key is the content key; no * key bytes are transported in the recipient. * - {@link Recipient.keyWrap} — the content key is wrapped by a recipient * key-encryption key (KEK), e.g. an {@link AesKwKey}. * * Unsupported recipient algorithms can be parsed and kept in the object graph, * but `recoverCEK()` only works for the supported helper modes. * * @see https://datatracker.ietf.org/doc/html/rfc9052#name-enveloped-cose-structure */ export declare class Recipient { protected: Header | null; unprotected: Header | null; ciphertext: Uint8Array | null; recipients: Recipient[]; key: (Key & KeyWrapper) | null; /** * Creates a recipient for the direct content-key distribution method * (RFC 9052 §8.5.1): the content encryption key is the preshared secret and * no key is transported. A direct recipient must be the only recipient. * * @param kid - Optional key-selection hint placed in the unprotected header. */ static direct(kid?: Uint8Array): Recipient; /** * Creates a recipient for the AES Key Wrap content-key distribution method * (RFC 9052 §8.5.2). The `alg` header parameter is taken from the KEK. If the * KEK has a `kid` and no `kid` is passed, it is copied as an unprotected * key-selection hint. * * @param kek - The recipient's key-encryption key, e.g. an {@link AesKwKey}. * @param kid - Optional key-selection hint that overrides the KEK's kid. */ static keyWrap(kek: Key & KeyWrapper, kid?: Uint8Array): Recipient; static fromCBORValue(value: unknown, understoodCriticalLabels?: Iterable