auths_core/lib.rs
1// crate-level allow during curve-agnostic refactor.
2#![allow(clippy::disallowed_methods)]
3#![warn(clippy::too_many_lines, clippy::cognitive_complexity)]
4#![warn(missing_docs)]
5//! # auths-core
6//!
7//! Core cryptographic primitives and secure key storage for Auths.
8//!
9//! This crate provides:
10//! - **Secure key storage** via platform keychains (macOS, Windows, Linux)
11//! - **Signing operations** through the [`signing::SecureSigner`] trait
12//! - **Passphrase handling** with [`signing::PassphraseProvider`] abstraction
13//! - **Error types** for all failure modes
14//!
15//! ## Quick Start
16//!
17//! ```rust,ignore
18//! use auths_core::storage::keychain::get_platform_keychain;
19//! use auths_core::signing::{StorageSigner, SecureSigner};
20//!
21//! // Get the platform-appropriate keychain
22//! let keychain = get_platform_keychain()?;
23//! let signer = StorageSigner::new(keychain);
24//!
25//! // Sign with a stored key
26//! let signature = signer.sign_with_alias("my-key", &provider, b"message")?;
27//! ```
28//!
29//! ## Feature Flags
30//!
31//! - `keychain-linux-secretservice` — Enable Linux Secret Service backend
32//! - `keychain-windows` — Enable Windows Credential Manager backend
33//! - `keychain-file-fallback` — Enable encrypted file storage fallback
34//! - `crypto-secp256k1` — Enable secp256k1/BIP340 for Nostr
35//! - `test-utils` — Export test utilities (e.g., in-memory keychain for testing)
36//!
37//! ## Platform Support
38//!
39//! | Platform | Keychain | Feature Required |
40//! |----------|----------|-----------------|
41//! | macOS/iOS | Keychain Services | (default) |
42//! | Linux | Secret Service | `keychain-linux-secretservice` |
43//! | Windows | Credential Manager | `keychain-windows` |
44//! | Any | Encrypted file | `keychain-file-fallback` |
45
46pub mod agent;
47pub mod api;
48pub mod config;
49pub mod crypto;
50pub mod error;
51pub mod pairing;
52pub mod paths;
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};