Class: SignedMessage
Defined in: signatures.ts:35
A message together with its signature and metadata, self-contained and serialized as CBOR identical to quantum-safe-py's SignedMessage.
Properties
algorithm
readonlyalgorithm:string
Defined in: signatures.ts:41
Algorithm, e.g. Ed25519+ML-DSA-65.
context
readonlycontext:Uint8Array
Defined in: signatures.ts:43
Domain-separation context (at most 255 bytes). Part of what is signed.
isHybrid
readonlyisHybrid:boolean
Defined in: signatures.ts:49
True for classical+PQC hybrid signatures.
message
readonlymessage:Uint8Array
Defined in: signatures.ts:37
The signed message bytes.
signature
readonlysignature:Uint8Array
Defined in: signatures.ts:39
Signature blob: len(prefix) ‖ prefix ‖ payload (hybrid payload is CBOR with both signatures).
signedAt
readonlysignedAt:number
Defined in: signatures.ts:47
Unix time in seconds when signed. Metadata only: not covered by the signature.
signerFingerprint
readonlysignerFingerprint:string
Defined in: signatures.ts:45
Hex fingerprint of the signer's public key, or ''. Metadata, not authenticated.
Methods
inspect()
inspect():
SignedInfo
Defined in: signatures.ts:155
Non-secret metadata without echoing the message.
Returns
Algorithm, lengths, signer fingerprint and signing time.
Throws
if the WASM module is not initialised.
toBytes()
toBytes():
Uint8Array
Defined in: signatures.ts:133
Alias of SignedMessage.toCbor, matching SealedMessage.toBytes.
Returns
Uint8Array
A fresh copy of the CBOR bytes.
toCbor()
toCbor():
Uint8Array
Defined in: signatures.ts:140
CBOR serialization (copy).
Returns
Uint8Array
A fresh copy of the CBOR bytes.
toHex()
toHex():
string
Defined in: signatures.ts:147
Lowercase hex of SignedMessage.toCbor.
Returns
string
The hex string.
toString()
toString():
string
Defined in: signatures.ts:159
Short description with the algorithm and message length; contains no message data.
Returns
string
fromBytes()
staticfromBytes(data):SignedMessage
Defined in: signatures.ts:86
Alias of SignedMessage.fromCbor, matching SealedMessage.fromBytes.
Parameters
data
Uint8Array
CBOR-encoded signed message.
Returns
SignedMessage
The parsed message.
Throws
if data is not a valid signed message.
fromCbor()
staticfromCbor(data):SignedMessage
Defined in: signatures.ts:77
Parses CBOR from SignedMessage.toCbor or quantum-safe-py SignedMessage.to_cbor(). The input is copied.
Parameters
data
Uint8Array
CBOR-encoded signed message.
Returns
SignedMessage
The parsed message.
Throws
if data is not bytes, or the encoded message is empty.
Throws
if data is not a valid signed message.
fromHex()
staticfromHex(hex):SignedMessage
Defined in: signatures.ts:96
Parses a hex string produced by SignedMessage.toHex.
Parameters
hex
string
Hex of the CBOR encoding, either case.
Returns
SignedMessage
The parsed message.
Throws
if hex is not valid hex.
Throws
if the decoded bytes are not a valid signed message.
fromParts()
staticfromParts(parts):SignedMessage
Defined in: signatures.ts:106
Assembles a signed message from stored fields (for example separate database columns).
Parameters
parts
The fields. context defaults to empty, signerFingerprint to '', signedAt to the current time in seconds, and isHybrid to whether algorithm contains +.
algorithm
string
context?
Uint8Array<ArrayBufferLike>
isHybrid?
boolean
message
Uint8Array
signature
Uint8Array
signedAt?
number
signerFingerprint?
string
Returns
SignedMessage
The message re-parsed from its CBOR encoding. The signature is not verified.
Throws
if message or signature is empty, context is over 255 bytes, or a byte field is not bytes.