astrid_crypto/lib.rs
1//! Astrid Crypto - Cryptographic primitives for the secure agent runtime.
2//!
3//! This crate provides:
4//! - Ed25519 key pairs with secure memory handling
5//! - Signatures for capability tokens and audit entries
6//! - BLAKE3 content hashing for audit chains and verification
7//!
8//! # Security Philosophy
9//!
10//! **Cryptography over prompts.** Authorization comes from ed25519 signatures
11//! and capability tokens, not from hoping the LLM follows instructions.
12//!
13//! # Example
14//!
15//! ```
16//! use astrid_crypto::{KeyPair, ContentHash};
17//!
18//! // Generate a new key pair
19//! let keypair = KeyPair::generate();
20//!
21//! // Sign a message
22//! let message = b"important data";
23//! let signature = keypair.sign(message);
24//!
25//! // Verify the signature
26//! assert!(keypair.verify(message, &signature).is_ok());
27//!
28//! // Hash content
29//! let hash = ContentHash::hash(message);
30//! println!("Hash: {}", hash.to_hex());
31//! ```
32
33#![deny(unsafe_code)]
34#![deny(missing_docs)]
35#![deny(clippy::all)]
36#![deny(unreachable_pub)]
37#![deny(clippy::unwrap_used)]
38#![cfg_attr(test, allow(clippy::unwrap_used))]
39
40pub mod prelude;
41
42mod error;
43mod hash;
44mod keypair;
45mod signature;
46
47pub use error::{CryptoError, CryptoResult};
48pub use hash::ContentHash;
49pub use keypair::{KeyPair, PublicKey};
50pub use signature::Signature;