Skip to main content

clasp_crypto/
lib.rs

1//! # clasp-crypto
2//!
3//! E2E encryption add-on for the CLASP protocol.
4//!
5//! ## Layers
6//!
7//! - **Primitives** (`primitives`): Pure crypto operations — AES-256-GCM,
8//!   ECDH P-256, HKDF-SHA256, ECDSA P-256. No CLASP dependency.
9//! - **Protocol** (`protocol`): E2ESession state machine for key exchange
10//!   over CLASP paths.
11//! - **Storage** (`storage`): KeyStore trait with MemoryKeyStore.
12//! - **Client** (`client`, behind `client` feature): CryptoClient wrapper
13//!   for transparent encrypt/decrypt over a `clasp_client::Clasp` instance.
14
15pub mod error;
16pub mod primitives;
17pub mod protocol;
18pub mod storage;
19pub mod types;
20
21#[cfg(feature = "client")]
22pub mod client;
23
24pub use error::{CryptoError, Result};
25pub use primitives::{
26    constant_time_eq, decrypt, derive_shared_key, encrypt, export_group_key, export_public_key,
27    fingerprint, fingerprint_jwk, generate_ecdh_key_pair, generate_group_key,
28    generate_signing_key_pair, group_key_to_jwk, import_group_key, import_public_key,
29    jwk_to_group_key, jwk_to_public_key, public_key_to_jwk, sign, verify,
30};
31pub use protocol::{E2ESession, E2ESessionConfig};
32#[cfg(feature = "fs-store")]
33pub use storage::FileSystemKeyStore;
34pub use storage::{KeyStore, MemoryKeyStore};
35pub use types::{
36    E2EEnvelope, ECDHKeyPair, KeyData, KeyExchangeMessage, SigningKeyPair, TofuRecord,
37};