Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/receipt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
// a verdict: a changed, unsigned or foreign answer, or one for another
// request, is reported as untrusted instead of used.
//
// Canonical JSON: keys sorted at every level, no whitespace, non-ASCII as
// \uXXXX (the same bytes as Python's json.dumps(sort_keys=True,
// separators=(",", ":"), ensure_ascii=True)).
// Canonical JSON (profile js-json-stringify-sorted-utf16-ascii-v1): keys
// sorted by UTF-16 code units at every level, no whitespace, every code unit
// from U+007F up as lowercase \uXXXX, numbers as JSON.stringify writes them,
// UTF-8 bytes. Python's json.dumps matches only for ASCII keys and integers; a
// Python equivalent: github.com/Fizzl13/presign-guard/blob/main/examples/canonical.py

import { createHash } from "node:crypto";
import { recoverMessageAddress, type Hex } from "viem";
Expand Down
Loading