astrid-audit
Chain-linked cryptographic audit logging for the Astrid secure agent runtime.
Features
- Cryptographically signed entries - Every audit entry is signed by the runtime's ed25519 key
- Chain-linked integrity - Each entry contains the hash of the previous entry, providing tamper evidence
- Persistent storage - Uses SurrealDB (surrealkv) for durable audit trail storage
- Chain verification - Detect any modifications to historical entries
- Session-indexed - Entries are organized and queryable by session
Security Model
Every audit entry is:
- Signed by the runtime's ed25519 key
- Linked to the previous entry via content hash
- Timestamped
- Indexed by session
The chain linking provides tamper evidence - any modification to historical entries breaks the chain and is detectable.
Usage
use ;
use SessionId;
use KeyPair;
// Create an in-memory audit log
let runtime_key = generate;
let user_id = runtime_key.key_id;
let log = in_memory.unwrap;
// Start a session
let session_id = new;
// Record an action
let entry_id = log.append.unwrap;
// Verify chain integrity
let result = log.verify_chain.unwrap;
assert!;
Key Types
AuditLog- Main interface for recording and querying audit entriesAuditEntry- A single signed, chain-linked audit recordAuditAction- The action being audited (tool calls, approvals, etc.)AuditOutcome- Success or failure result of the actionAuthorizationProof- How the action was authorizedAuditBuilder- Fluent builder for constructing entriesChainVerificationResult- Result of chain integrity verification
License
This crate is licensed under the MIT license.