Wire-format encoding pin for freenet-git.
This crate is the single source of truth for two byte formats that both the contract WASM and the on-host helpers must agree on exactly:
-
Signed-payload encoding ([
signed]) — the byte string fed into ed25519 signatures. Hand-rolled length-prefixed concatenation. Every element (including the domain prefix) is wrapped in a 4-byte little-endian length followed by raw bytes. -
Canonical encoding for content-addressed hashes ([
canonical]) — a minimal deterministic CBOR encoder for the structured types we hash to derive bundle ids. RFC 8949 §4.2.1 deterministic rules: definite-length items, smallest-encoding-of-integers, sorted map keys.
Why "v1" appears in domain prefixes
Every signed payload starts with a domain string like
b"freenet-git/v1/ref-update". The v1 is the wire-format version. When
either of the two encodings here changes in a way that produces different
bytes for the same input, the domain version must bump to v2 in lockstep
with a contract WASM change. Without the version bump, signatures from the
two implementations would silently disagree and fork the network.