agentid_core/lib.rs
1//! # agentid-core
2//!
3//! Cryptographic identity for AI agents.
4//!
5//! Provides:
6//! * Deterministic Ed25519 keypair generation from `(name, project, seed?)`.
7//! * A compact binary token format (~180 bytes) embedding scopes, TTL, and
8//! a per-token call quota — verifiable offline in <0.1 ms.
9//! * An encrypted local key vault (AES-256-GCM, PBKDF2-HMAC-SHA256).
10//! * An optional gRPC server (feature `server`).
11//! * Optional N-API bindings for Node/Bun (feature `napi-bindings`).
12//!
13//! ## Why a custom binary format?
14//!
15//! JWTs were designed for human-mediated web sessions. They carry JSON
16//! headers, base64 payloads, RSA/ECDSA signatures, and JWK discovery overhead
17//! — none of which benefit machine-to-machine agent traffic. AgentID tokens
18//! are binary, Ed25519, and self-contained, with rate limits embedded in the
19//! signed payload itself.
20
21pub mod identity;
22pub mod scopes;
23pub mod token;
24pub mod vault;
25
26#[cfg(feature = "server")]
27pub mod server;
28
29#[cfg(feature = "napi-bindings")]
30mod napi_bindings;
31
32pub use identity::{verify_signature, AgentIdentity, IdentityError};
33pub use scopes::{Scope, ScopeError};
34pub use token::{
35 parse as parse_token, verify as verify_token, AgentClaims, TokenBuilder, TokenError,
36};
37pub use vault::{Vault, VaultEntry, VaultError, VaultIndex};
38
39/// Library version, from Cargo.
40pub const VERSION: &str = env!("CARGO_PKG_VERSION");