Function: canonicalJson()
canonicalJson(
value):string
Defined in: packages/audit-client/src/canonical.ts:25
RFC 8785 (JCS) canonical JSON, by the canonicalize package (Apache-2.0, no
dependencies; written by an author of the RFC). The audit service MUST use this
function for the header it chains, so both halves of the contract hash the same
bytes.
Narrower than JCS on purpose: audit records hold identifiers, enums, times, counts
and booleans, so a number that is not a safe integer, and anything JSON cannot
carry (undefined, a function, a bigint), is refused rather than canonicalized.
That keeps ECMAScript's number formatting, the one place implementations differ,
out of the chain.
Parameters
value
unknown
A JSON value.
Returns
string
The canonical text.
Throws
The value holds something an audit record may not.