Function: sign1()
sign1(
payload,key,options?):Uint8Array
Defined in: cose.ts:284
Creates a COSE_Sign1 over payload with a standards-mode ML-DSA key pair (see Sign.generateStandardKeyPair).
The protected header is the map {1: alg} (plus 4: kid when a key identifier is given) and the unprotected header is empty.
Parameters
payload
Uint8Array
The bytes to sign and, unless options.detached, carry in the message.
key
The signing key pair; its algorithm sets the COSE alg.
options?
Sign1Options = {}
Key identifier, external AAD, tagging (default tagged) and detached-payload mode.
Returns
Uint8Array
The CBOR encoding of the message.
Throws
if key is not a StandardKeyPair, or payload, kid or externalAad is not bytes.
Throws
if the underlying signing operation fails.
Example
ts
const message = cose.sign1(payload, pair, { detached: true });
const same = cose.verify1(message, pair.publicKey, { detachedPayload: payload });