Expand description
Layer-0: canonical leaf encoding and content hashing.
A transparency-log leaf is opaque, app-defined record bytes. Layer 1
(the Merkle tree, crate::merkle) treats them as a byte string and never
inspects their structure, so an application’s canonical record drops in as a
leaf with zero reformatting.
This module provides:
-
ContextLabel— the versioned<namespace>/<record-type>/v<N>domain separator used by the intra-chain content hash. Each application chooses its own namespace and record types (e.g."acme/user-keys/v1","example-app/audit-event/v2"). The label lives inside the content hash (it never touches Layer 1’s tile mechanics), giving cross-protocol / cross-context separation while keeping the Merkle layer label-agnostic (#299 / #290). -
content_hash— the generic intra-chain leaf-content hash,sha3_512_with_context(label, content)frommetamorphic_crypto. This is the per-identity continuity linkage; it is independent from, and must not be confused with, the RFC 6962 Merkle leaf hash (crate::merkle::hash_leaf). The same leaf bytes feed both linkages without reformatting either. -
key_history_v1— a worked, byte-exact example/conformance instance of an application record type. It is not privileged by the engine; it is simply the first real-world consumer’s leaf shape (Mosslet’s signed key-history,assets/js/crypto/key_history.js, locked bytest/mosslet/crypto/key_history_test.exs) and the seed of the cross-language KAT suite (#315 / #299). Any other application defines its own record type the same way, against this same fixed byte discipline.
§Byte-layout discipline (fixed, audited — version-bump-or-nothing)
All canonical encodings in this crate use a single, fixed discipline so that independent witnesses and cross-language SDKs recompute byte-for-byte:
- integers are big-endian (
u32/u64), - variable-length fields are
u32-be length-prefixed (lp(x) = u32_be(len(x)) || x), - the layout is never reordered; a change is a new version label, never a silent reinterpretation.
Modules§
- key_
history_ v1 - Example record type: the
mosslet/key-history/v1conformance instance.
Structs§
- Context
Label - A validated, versioned context label of the form
<namespace>/<record-type>/v<N>.
Functions§
- content_
hash - Generic intra-chain leaf-content hash:
sha3_512_with_context(label, content)(64 bytes).