Skip to main content

Module cbor

Module cbor 

Source
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§

CanonicalError
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 via canonicalize or to_canonical_vec.
to_canonical_vec
Serialize a T and return its canonical CBOR bytes.
value_to_canonical_vec
Canonically encode an already-built CBOR [Value]. Infallible.