HMAC Signing
HMAC signing adds a provenance layer on top of the hash chain. While the hash chain proves events weren’t modified, HMAC signatures prove events were created by the holder of a specific secret key.When to Use HMAC
- Multi-service architectures — prove which service produced an event
- Regulatory compliance — demonstrate provenance of audit records
- Zero-trust environments — verify events weren’t injected by unauthorized parties
HMAC signing is optional. The hash chain alone provides tamper detection. HMAC adds proof of origin.
Setup
Pass asigning_key when creating the Trailproof instance:
signature field.
Signature Format
Signatures follow the format:HMAC-SHA256(signing_key, canonical_json(event)). The canonical JSON excludes the hash and signature fields.
Example
Verification
Signature verification uses timing-safe comparison to prevent timing attacks.Hash Chain Independence
The hash chain and HMAC signing are independent layers:- Hash chain — proves events weren’t modified (integrity)
- HMAC signing — proves events were created by a key holder (provenance)
prev_hash + canonical_json(event). The signature is computed from canonical_json(event) alone. Modifying either the hash or the signature will be detected, but through different verification paths.
Key Management
Trailproof does not manage keys — you provide the key, and Trailproof signs events with it.Next Steps
Hash Chain
How the hash chain provides tamper detection.
Verification
Verify both chain integrity and signatures.