saorsa_node/client/
mod.rs

1//! Chunk client module for saorsa-node.
2//!
3//! This module provides a client interface for content-addressed chunk storage
4//! on the saorsa network using post-quantum cryptography.
5//!
6//! # Architecture
7//!
8//! The chunk client provides:
9//!
10//! 1. **Content-addressed storage**: Chunk address = SHA256(content)
11//! 2. **PQC security**: All data uses ML-KEM-768 and ML-DSA-65
12//! 3. **EVM payment**: Chunks are paid for on Arbitrum network
13//!
14//! # Data Types
15//!
16//! Currently supports a single data type:
17//!
18//! - **Chunk**: Immutable content-addressed data (hash(value) == key)
19//!
20//! Future extensions may include non-content-addressed key-value storage.
21//!
22//! # Example
23//!
24//! ```rust,ignore
25//! use saorsa_node::client::{ChunkClient, ChunkConfig};
26//!
27//! #[tokio::main]
28//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
29//!     // Create client with default config
30//!     let client = ChunkClient::with_defaults();
31//!
32//!     // Store new data (content-addressed)
33//!     let address = client.put_chunk(bytes::Bytes::from("hello world")).await?;
34//!
35//!     // Retrieve data by address
36//!     let data = client.get_chunk(&address).await?;
37//!
38//!     // Check statistics
39//!     let stats = client.stats();
40//!     println!("Chunks stored: {}", stats.chunks_stored);
41//!     println!("Chunks retrieved: {}", stats.chunks_retrieved);
42//!
43//!     Ok(())
44//! }
45//! ```
46//!
47//! # Security Model
48//!
49//! ## Quantum-Resistant Cryptography
50//!
51//! All data stored through this client uses:
52//! - **ML-KEM-768** (NIST FIPS 203): Key encapsulation for encryption
53//! - **ML-DSA-65** (NIST FIPS 204): Digital signatures for authentication
54//! - **ChaCha20-Poly1305**: Symmetric encryption for data at rest
55
56mod data_types;
57mod quantum;
58
59pub use data_types::{ChunkStats, DataChunk, XorName};
60pub use quantum::{QuantumClient, QuantumConfig};