(sigil seal)
(sigil seal) - Seal v1 canonical serialization for derivation keys
Canonical, INJECTIVE serialization for Sigil derivation records: no two distinct inputs encode to the same bytes, so a derivation key can never collide (which would serve wrong bytes from the store cache). Ported from the WS-0.2 reference encoder (ecosystem-spikes/seal, sabotage-proven 20/20 property tests incl. the WS-0.1 collision corpus). Frozen spec: folio topics/sigil-seal-spec.
"Wire moves values; seal binds them." Seal is distinct-BY-CONTRACT from (sigil wire): wire is the transport codec (full value model, round-trip, hostile-decode safety); Seal is the binding form — a tiny refused-down subset, ENCODE-ONLY, exactly one byte-form per value. A hash format is frozen per schema version; a transport codec evolves. The two must never share an implementation. Seal is pure (deps: core/list/string only) and has ZERO sigil-store coupling, so it is reusable by the registry (WS-1) and substitutes (WS-3) and cleanly extractable to a standalone package.
Encoding (bencode-derived, extended with symbols/sets/bools): int "i" <canonical-decimal> ";" no leading zeros, no -0, integers only str "s" <byte-len> ":" <utf8> sym "y" <byte-len> ":" <utf8> bool "t" | "f" list "l" <value> "e" order-preserving (order is semantic) set "S" <encoded-elem sorted, deduped> "e" sorted by ENCODED bytes map "m" (<enc-key><enc-val> sorted by enc-key)* "e" dup keys = error Floats, rationals, chars, vectors, and other types: REFUSED (error) in v1.
Injectivity argument: disjoint type tags; length-prefixed atoms are self-delimiting (no separator injection possible); canonical integer text is unique; unordered collections get a unique representative via sort-by-encoded-bytes; duplicate map keys refused (maps are functions). Type twins ('release vs "release") differ by tag.
Exports
seal-set-boxprocedureConstruct a seal-set-box struct.
seal-set-box?procedureTest if a value is a seal-set-box struct.
seal-set-box-elemsprocedureGet the elems field of a seal-set-box struct.
%seal-map-box--typevariableGet the elems field of a seal-set-box struct.
seal-map-boxprocedureConstruct a seal-map-box struct.
seal-map-box?procedureTest if a value is a seal-map-box struct.
seal-map-box-pairsprocedureGet the pairs field of a seal-map-box struct.
sealvariable(No description)
seal-setvariable(No description)
seal-mapvariable(No description)
derivation-preimagevariable(No description)