auths_index/lib.rs
1// Index uses Utc::now() as fallback for unparseable timestamps in stored data.
2#![allow(clippy::disallowed_methods)]
3//! SQLite-backed index for O(1) attestation, identity, and org member lookups.
4//!
5//! This crate provides an index layer that enables fast queries on attestation metadata
6//! without iterating through all Git refs. The index is stored in a SQLite database
7//! (typically `.auths-index.db` in the repository root).
8//!
9//! # Usage
10//!
11//! ```rust,ignore
12//! use auths_index::{AttestationIndex, IndexedAttestation};
13//! use std::path::Path;
14//!
15//! // Open or create an index
16//! let index = AttestationIndex::open_or_create(Path::new(".auths-index.db"))?;
17//!
18//! // Query attestations by device
19//! let attestations = index.query_by_device("did:key:z6Mk...")?;
20//!
21//! // Get index statistics
22//! let stats = index.stats()?;
23//! println!("Total attestations: {}", stats.total_attestations);
24//! ```
25
26pub mod error;
27pub mod index;
28pub mod rebuild;
29mod schema;
30
31// Re-export main types at crate root
32pub use error::{IndexError, Result};
33pub use index::{
34 AttestationIndex, IndexStats, IndexedAttestation, IndexedIdentity, IndexedOrgMember,
35};
36pub use rebuild::{DEFAULT_ATTESTATION_PREFIX, RebuildStats, rebuild_attestations_from_git};