Change hash
ProThe sha256 of a change, in the same canonical form in the browser and on the server, so an approval made against a hash can be checked where the change runs. Keys are sorted at every depth, so { a, b } and { b, a } hash the same. Uses Web Crypto: browsers on https or localhost, and Node 20 or later.
Preview
It's types and helpers, listed below.
Install
First time? Get started sets up the registry and theme. Or with shadcn directly: npx shadcn@latest add @candor/change-hash
Functions
changeHash(change: unknown)The sha256 of a change, in the same canonical form in the browser and on the server, so an approval made against a hash can be checked where the change runs. Keys are sorted at every depth, so { a, b } and { b, a } hash the same. Uses Web Crypto: browsers on https or localhost, and Node 20 or later.
canonicalJson(value: unknown)JSON with every object's keys sorted, and undefined values left out, as JSON.stringify leaves them out.