1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! Signed, verifiable audit log (`signed-audit` feature).
//!
//! | Layer | Mechanism |
//! |-------|-----------|
//! | Record | [`AuditRecord`](adk_core::audit_log::AuditRecord), canonicalized with RFC 8785 ([`canonicalize`]) |
//! | Chain | Each record's `prev_hash` is the previous record's leaf hash |
//! | Tree | RFC 9162 Merkle tree over leaf hashes `SHA-256(0x00 ‖ record)`, with inclusion and consistency proofs ([`merkle`]) |
//! | Checkpoint | C2SP tlog checkpoint in a signed note, Ed25519 by default ([`AuditSigner`], [`Ed25519Signer`]) |
//! | Anchor | Optional publication of checkpoints outside the log ([`CheckpointAnchor`], [`FileCheckpointAnchor`]) |
//! | Store | [`AuditLogStore`](adk_core::audit_log::AuditLogStore): in-memory in `adk-core`, SQLite and PostgreSQL in `adk-session` |
//! | Verify | [`verify`] over an export, also `adk-rust audit verify` |
//!
//! Checkpoint notes use the same format and key encoding as Go's
//! `golang.org/x/mod/sumdb/note`, so standard signed-note and witness tooling can
//! verify them.
//!
//! # Example
//!
//! ```rust
//! use std::sync::Arc;
//! use adk_auth::signed_audit::{AuditExport, AuditLog, Ed25519Signer, NoteVerifier, AuditSigner};
//! use adk_core::audit_log::{AuditRecordDraft, AuditRecordKind, InMemoryAuditLogStore};
//!
//! # async fn demo() -> adk_core::Result<()> {
//! let store = Arc::new(InMemoryAuditLogStore::new());
//! let signer = Arc::new(Ed25519Signer::generate("audit.example.com").unwrap());
//! let trusted: NoteVerifier = signer.verifier_key().parse().unwrap();
//! let log = AuditLog::builder(store.clone(), "replica-1", signer).open().await?;
//! log.append(AuditRecordDraft::new(AuditRecordKind::ToolCall, "search")).await?;
//! log.checkpoint().await?;
//!
//! let export = AuditExport::from_store(store.as_ref(), "replica-1").await?;
//! assert!(export.verify(&[trusted]).is_valid());
//! # Ok(())
//! # }
//! ```
pub use ;
pub use ;
pub use ;
pub use ;