Expand description
Sanctuary audit DAG (vault v2, slice A) — the append-only, per-session-branch log a coercer’s actions get recorded into.
This module sits on top of the crypto primitives in super::sanctuary_audit — it does not
re-implement any of them. Each record carries an opaque sealed blob (produced by
super::sanctuary_audit::seal_to in the real design) that only the real lane can
super::sanctuary_audit::open_sealed; the DAG stores it verbatim and never inspects it.
§What the DAG guarantees
Records are content-addressed and hash-chained with
chain_hash: a record’s id is
chain_hash(&parent, &canonical_bytes(record)), and each record’s parent is the previous
record’s id. Because canonical_bytes is a deterministic, unambiguous (length-prefixed)
encoding of the content fields, any of the following becomes detectable by
verify_chain:
- Rewrite — changing any content field changes the recomputed
id⇒Tampered. - Reorder / broken link — a record whose
parentno longer matches its predecessor’sid⇒BrokenLink. - Drop — removing a middle record breaks the successor’s parent link ⇒
BrokenLink.
§What the DAG does not guarantee — a deliberate honesty note
derive_sessions groups records by branch_ref (one branch per duress-unlock entry point).
The number of sessions is the number of distinct entry-point unlocks. This is a proxy, not
a verified head-count of attackers: shared credentials (many people, one branch) and one
persistent actor opening many sessions (one person, many branches) both fool it. Treat the count
as a loose lower/upper-bound signal, never as evidence of “how many people”.
Structs§
- Audit
Record - One append-only node in the audit DAG.
- Routing
- The outcome of retention routing: records destined for the archive vs. the human-triage inbox.
- Session
- A derived view of one branch as a session.
recordsare ordered by chain linkage where the branch is well-formed, falling back tounixorder otherwise.
Enums§
- Audit
Action - The kind of action a session recorded.
Othercarries a free-form label for anything not in the fixed set. Serialized insnake_case(e.g.open_session,add_note,{"other":"..."}). - Chain
Status - Result of verifying one branch’s chain integrity.
- Retention
Mode - How records are routed once they arrive from a duress session. Serialized in
snake_case.
Functions§
- canonical_
bytes - The deterministic content encoding hashed into a record’s
id. Encodes, in a fixed order and with unambiguous framing, every content field exceptid:branch_ref, actor_did, role, stated_purpose, action, unix, sealed. - derive_
sessions - Group records into sessions, one per distinct
branch_ref. - route
- Route records according to the retention policy.
- verify_
chain - Verify the integrity of a single branch’s records, assumed in chain order.