import { Header } from './header'; import { type Label } from './map'; import { Key, type MACer } from './key'; import { Recipient } from './recipient'; /** * MacMessage represents a COSE_Mac object. * * The payload is MACed with a caller-provided content MAC key. Each * {@link Recipient} then carries or derives that MAC key for a recipient. Use * {@link Mac0Message} when the MAC key is known implicitly and no recipient * structure is needed. * * Note the constructor arg order: `(payload, protected?, unprotected?, tag?, * recipients?)`. Recipients are the FIFTH argument; the fourth is the tag. * * @example * ```ts * const macKey = HMACKey.generate(iana.AlgorithmHMAC_256_256) * const kek = AesKwKey.generate(iana.AlgorithmA256KW, 'recipient-1') * const cose = new MacMessage(payload, undefined, undefined, undefined, [ * Recipient.keyWrap(kek) * ]).toBytes(macKey) * MacMessage.fromBytes([kek], cose) * ``` * * @see https://datatracker.ietf.org/doc/html/rfc9052#name-maced-message-with-recipien */ export declare class MacMessage { payload: Uint8Array; protected: Header | null; unprotected: Header | null; tag: Uint8Array; recipients: Recipient[]; private static macBytes; static withTag(coseData: Uint8Array): Uint8Array; static fromBytes(keks: Key[], coseData: Uint8Array, externalData?: Uint8Array, understoodCriticalLabels?: Iterable