Skip to main content

auths_core/
lib.rs

1#![warn(clippy::too_many_lines, clippy::cognitive_complexity)]
2#![warn(missing_docs)]
3//! # auths-core
4//!
5//! Core cryptographic primitives and secure key storage for Auths.
6//!
7//! This crate provides:
8//! - **Secure key storage** via platform keychains (macOS, Windows, Linux)
9//! - **Signing operations** through the [`signing::SecureSigner`] trait
10//! - **Passphrase handling** with [`signing::PassphraseProvider`] abstraction
11//! - **Error types** for all failure modes
12//!
13//! ## Quick Start
14//!
15//! ```rust,ignore
16//! use auths_core::storage::keychain::get_platform_keychain;
17//! use auths_core::signing::{StorageSigner, SecureSigner};
18//!
19//! // Get the platform-appropriate keychain
20//! let keychain = get_platform_keychain()?;
21//! let signer = StorageSigner::new(keychain);
22//!
23//! // Sign with a stored key
24//! let signature = signer.sign_with_alias("my-key", &provider, b"message")?;
25//! ```
26//!
27//! ## Feature Flags
28//!
29//! - `keychain-linux-secretservice` — Enable Linux Secret Service backend
30//! - `keychain-windows` — Enable Windows Credential Manager backend
31//! - `keychain-file-fallback` — Enable encrypted file storage fallback
32//! - `crypto-secp256k1` — Enable secp256k1/BIP340 for Nostr
33//! - `test-utils` — Export test utilities (e.g., in-memory keychain for testing)
34//!
35//! ## Platform Support
36//!
37//! | Platform | Keychain | Feature Required |
38//! |----------|----------|-----------------|
39//! | macOS/iOS | Keychain Services | (default) |
40//! | Linux | Secret Service | `keychain-linux-secretservice` |
41//! | Windows | Credential Manager | `keychain-windows` |
42//! | Any | Encrypted file | `keychain-file-fallback` |
43
44pub mod agent;
45pub mod api;
46pub mod config;
47pub mod crypto;
48pub mod error;
49pub mod keri_did;
50pub mod pairing;
51pub mod paths;
52pub mod policy;
53pub mod ports;
54pub mod proto;
55pub mod server;
56pub mod signing;
57pub mod storage;
58#[cfg(any(test, feature = "test-utils"))]
59#[allow(clippy::unwrap_used, clippy::expect_used)]
60pub mod testing;
61pub mod trust;
62pub mod utils;
63pub mod witness;
64
65pub use agent::{AgentCore, AgentHandle, AgentSession};
66// IMPORTANT: These agent client functions use Unix domain sockets and are only
67// available on Unix. Do NOT remove this #[cfg(unix)] — it will break Windows CI.
68#[cfg(unix)]
69pub use agent::{
70    AgentStatus, add_identity, agent_sign, check_agent_status, list_identities,
71    remove_all_identities,
72};
73pub use crypto::{EncryptionAlgorithm, SignerKey};
74pub use error::{AgentError, AuthsErrorInfo};
75pub use signing::{KeychainPassphraseProvider, PrefilledPassphraseProvider};