Expand description
Canonical CBOR (RFC 8949 §4.2 deterministic encoding).
This is the shared, load-bearing encoder for every byte string a signature or content hash commits to: the sidecar, the encrypted metadata blob plaintext, and the signed manifests. Two correct implementations MUST produce byte-identical output for the same logical document, or signatures fail to verify across peers — so this module is a blocking cross-language conformance gate, not advisory. Conformance is pinned by the golden hex vectors in the tests below.
SSoT for the ruleset: Metadata — Canonical CBOR Encoding.
Structs§
- OpenMap
- A decoded text-keyed CBOR map, drained field by field into a signed record.
Enums§
- Canonical
Error - Errors from (de)serializing through the canonical codec.
Functions§
- canonicalize
- Re-encode arbitrary CBOR bytes into their canonical form. Used on the receive path: decode what arrived, then verify a signature against the canonical re-encoding.
- from_
slice - Decode CBOR bytes into a
T. Decoding is tolerant of non-canonical input; callers that require canonical bytes re-encode viacanonicalizeorto_canonical_vec. - to_
canonical_ vec - Serialize a
Tand return its canonical CBOR bytes. - value_
to_ canonical_ vec - Canonically encode an already-built CBOR [
Value]. Infallible.