Expand description
Canonical wire-byte form for events + cards.
Rules (v0.1):
- Object keys serialize in lexicographic byte order.
- No whitespace anywhere (
,and:separators only). - UTF-8 throughout — non-ASCII is NOT \uXXXX-escaped.
- The top-level fields
signatureandpublic_key_idare stripped before serialization (they are computed over the canonical bytes, so they cannot be inside them). - The top-level field
event_idis stripped iffstrict = true—compute_event_iduses strict-mode bytes;verify_message_v31uses non-strict because the wire copy carriesevent_idalready.
Implementation note — serde_json::Map uses BTreeMap internally when
the preserve_order cargo feature is OFF (which is the default). This
gives us free lexicographic key ordering at every nesting level. If a
downstream crate ever enables preserve_order we’ll need to walk and
re-sort manually; for now the default is sufficient.
Functions§
- canonical
- Canonical bytes for a JSON value.