encrypt function
Encrypts an already-signed COSE_Sign1 to a recipient.
For most use cases, prefer seal which signs and encrypts in one step. Use this only when re-encrypting a message (from decrypt) to a different recipient without access to the original signer's key.
sign1: The COSE_Sign1 structure (e.g., from decrypt)msgToAuth: The same additional authenticated data used during sealingrecipient: The xHPKE public key to encrypt todomain: Application domain for HPKE key derivation
Returns the serialized COSE_Encrypt0 structure.
Implementation
Uint8List encrypt({
required Uint8List sign1,
required Object? msgToAuth,
required xhpke.PublicKey recipient,
required Uint8List domain,
}) => ffi.coseEncrypt(
sign1: sign1,
msgToAuth: _encode(msgToAuth),
recipient: recipient.inner,
domain: domain,
);