Skip to main content

auths_core/
lib.rs

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