/** * Deterministically serialize a JSON-compatible value: * - object keys sorted lexicographically * - no insignificant whitespace * - `undefined` fields dropped (objects only) * Throws on non-finite numbers and on values that cannot round-trip. */ /** * The interop-safe subset of what `canonicalize` will accept. * * `canonicalize` produces canonical JSON and the oid is its sha256. Three parts of that are * ECMAScript-specific, and a non-JS implementation can differ on each: * * numbers `JSON.stringify(n)` is Number::toString. `1.0` prints "1", `1e21` prints * "1e+21". Python's repr and Go's strconv do not agree with it everywhere, so a * non-integer or out-of-range value is an interop hazard. * key order `Array.prototype.sort` compares UTF-16 CODE UNITS. For a key containing an * astral character the high surrogate (U+D800..U+DBFF) sorts BELOW U+E000, while * a code-point sort puts the astral character above it. Same object, two orders. * strings the escape set, and what happens to a lone surrogate. * * Divergence here does not raise an error anywhere. It produces a DIFFERENT OID for the same * content, and then two honest implementations never converge: the server truthfully reports * what it has, the client truthfully asks for what it lacks, and they never meet. * * So the subset is deliberately narrow, and it is a DESCRIPTION rather than a restriction: * measured over the objects that exist today (15,680 in local stores plus 14,073 on a hub's * object plane — over 2M scalar fields) there are zero violations. It stays that way only if * something checks, which is what this function is for. `custom:` evidence keys reach * `Checkpoint.evidence` as OBJECT KEYS, so a user-chosen string is hashed material. * * Values are not restricted the same way: a string VALUE never participates in key ordering, * so `"배포 완료 🚀"` is fine. Only lone surrogates are refused in values, and those cannot * come from valid text. */ export declare function assertInteropSafe(value: unknown, path?: string): void; export declare function canonicalize(value: unknown): string; /** sha256 hex of arbitrary bytes/strings. */ export declare function sha256hex(data: string | Uint8Array): string; /** * Compute the object id of a typed payload. The `oid` field (if present) is never * part of its own hash — content addressing must be a fixed point. */ export declare function computeOid(type: string, payload: Record): string; //# sourceMappingURL=canonical.d.ts.map