Skip to content

basalt / audit/src / canonicalAuditEntry

Function: canonicalAuditEntry() ​

> canonicalAuditEntry(entry, scheme?): string

Defined in: audit/src/chain.ts:102

Canonical, stable serialization of every field the hash covers. Explicit field list (never "whatever keys the object has"), sorted keys, null for an absent optional, and a format version so the scheme can evolve.

Without scheme this is the v1 form. With it, the v2 form: the same fields plus alg and kid, so the digest authenticates which algorithm and which key produced it — relabelling an entry's key id breaks its hash.

Parameters ​

entry ​

AuditEntry

scheme? ​

alg ​

AuditHashAlgorithm

keyId? ​

string

Returns ​

string

Released under the MIT License.