canonicalfunctionno test imports itfunction canonical(value: unknown): stringA value as canonical JSON: object keys in order, no space, undefined left out.
| Parameter | What it is |
|---|---|
value | a JSON value |
Returns: its canonical text
Hashes (commons data 0011-sql-lifecycle FR-002, FR-010): a plan is a pure function, so the SHA-256 it needs is made here, in plain code, and is the same one the kernel makes (a test says so), and a value is hashed as canonical JSON, with its keys in order, so that the same structure has the same hash wherever it was built.
canonicalfunctionno test imports itfunction canonical(value: unknown): stringA value as canonical JSON: object keys in order, no space, undefined left out.
| Parameter | What it is |
|---|---|
value | a JSON value |
Returns: its canonical text
hashOfconstconst hashOf: (value: unknown) => stringThe hash of a value's canonical JSON.
| Parameter | What it is |
|---|---|
value | a JSON value |
Returns: 64 hexadecimal digits
sha256Hexfunctionfunction sha256Hex(text: string): stringThe SHA-256 of a text, as 64 lower-case hexadecimal digits.
| Parameter | What it is |
|---|---|
text | the text, hashed as UTF-8 |
Returns: the digest