Documentation
¶
Overview ¶
Package canon defines the language-neutral canonical serialization for the event log's tamper-evident hash-chain. content_hash is defined over RFC 8785 (JCS) applied to the proto3-JSON mapping of the event, so ANY implementation — not only this Go host — can recompute and independently verify the chain. That independent verifiability is the "provenance anyone can audit" property: an auditor does not have to trust the binary that wrote the journal. See the determinism contract §7.
content_hash = lc-hex( SHA-256( JCS({
"event": proto3-JSON(Event),
"prev_hash": <hex>,
"seq": <int64-as-string>,
}) ) )
proto3-JSON maps int64→string, bytes→base64, enum→name; JCS then sorts keys and canonicalizes numbers/strings/whitespace. Because the event is serialized via proto3-JSON, structured content maps must be JSON-shaped (no int64 > 2^53) — see package wire.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Event ¶
Event returns the canonical bytes of a single event: JCS applied to its proto3-JSON form. Useful anywhere a stable, cross-implementation event fingerprint is needed (e.g. a model input hash).
func HashRecord ¶
HashRecord is content_hash: lowercase-hex SHA-256 over the canonical record bytes. At a fork, a child's first record uses prev_hash = parent@R.content_hash, turning the chain into a tree.
func Proto ¶
Proto returns the canonical bytes of any message: JCS applied to its proto3-JSON form under the same pinned options the journal uses. A digest over these bytes can be recomputed by any implementation, which is why the harness registry's spec_digest is defined over them.
Types ¶
This section is empty.