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

FieldDescription
entry_idUnique identifier
timestampISO 8601 timestamp
agent_didDID of the acting agent
peer_didDID of the peer (if applicable)
actionAction performed
resultsuccess, failure, error, started, decided
entry_hashSHA3-256 hash of this entry
previous_hashHash 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}")