Walk the entire hash chain to confirm no events have been tampered with.
verification = tp.verify()print(verification.intact) # Trueprint(verification.total) # number of eventsprint(verification.broken) # [] (empty = no tampering)
If a tampered event is detected, broken contains the indices of all affected events. Because each event depends on the previous hash, tampering event N causes events N through the end to appear broken.
Switch to the JSONL file store for events that survive restarts.
tp = Trailproof(store="jsonl", path="events.jsonl")# Events are appended to the file as JSON linesevent = tp.emit( event_type="myapp.user.login", actor_id="user-42", tenant_id="acme-corp", payload={"ip": "1.2.3.4"},)# Ensure all data is flushed to disktp.flush()
The JSONL file is human-readable. Inspect it with cat events.jsonl | jq . or grep "user-42" events.jsonl.