Expand description
§Integrity Chain
HIPAA-5 §164.312(c)(1) Integrity Controls. Each event is signed with an
HMAC over (previous_signature || canonical_event_bytes), forming a
tamper-evident chain: a single byte mutation invalidates every signature
downstream.
This module defines the trait + a default HMAC-SHA256 implementation +
a small set of test vectors. Wiring into EventStore
lands in Step 2; the trait is stable now so projection-side verifiers can
be written ahead of the storage migration.
§Why HMAC, not a public-key signature
Per-event ECDSA/Ed25519 is overkill for a single-tenant audit chain — the threat is “someone with DB write access tampers with old rows”, not “an external party impersonates the framework”. A symmetric HMAC keyed by a secret only the application owns is sufficient evidence of tampering and ~50× faster on the write path.
Future: Step 5 may add a public-verifiable mode for cross-organization audit hand-off.
Structs§
- Event
Signature - 32-byte HMAC-SHA256 output, hex-encoded for storage.
- Hmac
Sha256 Chain - HMAC-SHA256-keyed
IntegrityChain.
Enums§
- Integrity
Error - Integrity
Result - Result reported by
IntegrityChain::verify_chain.
Traits§
- Integrity
Chain - Tamper-evident chaining sink for events.