Audit Chain
Every action in Trust Hub is logged to a SHA3-256 hash-chained audit log. Each entry contains the hash of the previous entry, creating a tamper-evident chain.
Audit Entry Fields
| Field | Description |
|---|---|
| entry_id | Unique identifier |
| timestamp | ISO 8601 timestamp |
| agent_did | DID of the acting agent |
| peer_did | DID of the peer (if applicable) |
| action | Action performed |
| result | success, failure, error, started, decided |
| entry_hash | SHA3-256 hash of this entry |
| previous_hash | Hash of the previous entry |
Verification
from trusthub.audit.integrity import verify_audit_chain
logger = AuditLogger("audit.db")
is_valid, errors = verify_audit_chain(logger)
print(f"Chain integrity: {is_valid}")