seal function

Uint8List seal({
  1. required Object? msgToSeal,
  2. required Object? msgToAuth,
  3. required SecretKey signer,
  4. required PublicKey recipient,
  5. required Uint8List domain,
})

Signs a message then encrypts it to a recipient.

Uses the current system time as the signature timestamp.

  • msgToSeal: The message to sign and encrypt
  • msgToAuth: Additional authenticated data (signed and bound to encryption, but not embedded)
  • signer: The xDSA secret key to sign with
  • recipient: The xHPKE public key to encrypt to
  • domain: Application domain for HPKE key derivation

Returns the serialized COSE_Encrypt0 structure containing the encrypted COSE_Sign1.

Implementation

Uint8List seal({
  required Object? msgToSeal,
  required Object? msgToAuth,
  required xdsa.SecretKey signer,
  required xhpke.PublicKey recipient,
  required Uint8List domain,
}) => ffi.coseSeal(
  msgToSeal: _encode(msgToSeal),
  msgToAuth: _encode(msgToAuth),
  signer: signer.inner,
  recipient: recipient.inner,
  domain: domain,
);