Skip to main content

Module hashchain

Module hashchain 

Source
Expand description

Hash chain helpers: canonicalization, chain construction, chain verification.

Enums§

ChainError
Errors raised by chain verification.

Constants§

HASH_PREFIX
Hash prefix for SHA-256 digests in this protocol.

Functions§

append_event
Compute and assign this_event_hash for an event, given the previous chain tip.
append_event_value
Value-based chain production: seal a raw event JSON value onto the chain.
append_event_value_signed
Value-based chain production with an event SIGNATURE (v0.7 §3.5).
canonicalize
Canonicalize a JSON value to RFC 8785 (JCS) bytes for hashing.
compute_event_hash
Compute this_event_hash for an event represented as a JSON value with this_event_hash absent.
event_value_for_hashing
Produce the hashing view of an event JSON value (normative; see the Python SDK’s _event_to_canonical_dict, the single point of truth):
verify_chain
Verify a sequence of events forms a valid hash chain.
verify_chain_values
Verify a chain of events supplied as raw JSON values. Returns the tip hash.
verify_event
Verify a single event’s this_event_hash matches its recomputed hash.
verify_event_value
Verify a single event supplied as a raw JSON value.