sign function
Creates a COSE_Sign1 digital signature with an embedded payload.
Uses the current system time as the signature timestamp, and signAt takes it from the caller instead.
msgToEmbed: The message to sign (embedded in COSE_Sign1)msgToAuth: Additional authenticated data (not embedded, but signed)signer: The xDSA secret key to sign withdomain: Application domain for separating protocol purposes
Returns the serialized COSE_Sign1 structure. Throws if msgToEmbed or
msgToAuth does not encode into the supported CBOR subset.
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,
);