Expand description
RFC-MACP-0013 canonical commitment hash.
commitment_hash maps a CommitmentPayload to a stable
sha256:<64 lowercase hex> string by:
- Projecting the payload to a frozen JSON object (RFC-MACP-0013 §3).
- Canonicalizing that object with a hand-written RFC 8785 (JCS)
serializer (§4) – deliberately not
serde_json, whose object serialization does not implement JCS’s key ordering or escaping rules. - Hashing the domain-separated preimage with SHA-256 and hex-encoding the digest.
This module has exactly one job and does it unconditionally: it never
validates the payload and never fails (see commitment_hash’s doc for
the D3 guarantee). Semantic validation of CommitmentPayload (matching
session-bound versions, well-formed supersedes, etc.) is a separate
concern handled elsewhere (see macp-modes::mode::util).
Functions§
- commitment_
hash - Compute the RFC-MACP-0013 commitment hash for
payload.