IF Commons GitHub

logical/hash

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-bridge-plans FR-005

The hash of a plan: the SHA-256 of its canonical text, in which every object has its keys in order and nothing depends on how the plan was made. Two plans with the same actions, the same losses and the same ends have the same hash, and a plan changed in any way has another, so that an apply can hold a plan to the hash a person approved.

import { canonical } from "./hash.ts";
canonical({ b: 1, a: [2, { d: 1, c: 0 }] }); // '{"a":[2,{"c":0,"d":1}],"b":1}'

Source: commons/anyfs-bridge/src/logical/hash.ts

2 of 2 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

canonicalfunction
function canonical(value: unknown): string

A value as text with the keys of every object in order and no space: one text for one value.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

hashPlanfunction
function hashPlan(plan: Omit<Plan, "hash">): Promise<PlanHash>

The hash of a plan without its hash.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.