sign function

Uint8List sign({
  1. required Object? msgToEmbed,
  2. required Object? msgToAuth,
  3. required SecretKey signer,
  4. required Uint8List domain,
})

Creates a COSE_Sign1 digital signature with an embedded payload.

Uses the current system time as the signature timestamp.

  • msgToEmbed: The message to sign (embedded in COSE_Sign1)
  • msgToAuth: Additional authenticated data (not embedded, but signed)
  • signer: The xDSA secret key to sign with
  • domain: Application domain for replay protection

Returns the serialized COSE_Sign1 structure.

Implementation

Uint8List sign({
  required Object? msgToEmbed,
  required Object? msgToAuth,
  required xdsa.SecretKey signer,
  required Uint8List domain,
}) => ffi.coseSign(
  msgToEmbed: _encode(msgToEmbed),
  msgToAuth: _encode(msgToAuth),
  signer: signer.inner,
  domain: domain,
);