matrix_lite_rs/lib.rs
1//! # matrix-lite-rs
2//!
3//! A production-ready, lightweight Matrix protocol implementation with Redis backend and WASM support.
4//!
5//! ## Features
6//!
7//! - **End-to-End Encryption (E2EE)** - Full Olm/Megolm support via [vodozemac](https://github.com/matrix-org/vodozemac)
8//! - **Redis Storage** - Scalable persistence with horizontal scaling support
9//! - **Multi-Device Sync** - Automatic synchronization across devices
10//! - **WASM Ready** - Browser compatibility via WebAssembly
11//! - **Production Security** - PBKDF2 key derivation, rate limiting, input validation
12//! - **Matrix Compatible** - Follows Matrix protocol specifications
13//!
14//! ## Quick Start
15//!
16//! ```rust,no_run
17//! use matrix_lite_rs::{RedisStorage, crypto::CryptoManager};
18//!
19//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
20//! // Create Redis storage
21//! let storage = RedisStorage::new("redis://localhost:6379").await?;
22//!
23//! // Create crypto manager for E2EE
24//! let mut crypto = CryptoManager::new();
25//! let keys = crypto.identity_keys();
26//! println!("Identity keys: curve25519={}, ed25519={}", keys.curve25519, keys.ed25519);
27//! # Ok(())
28//! # }
29//! ```
30//!
31//! ## End-to-End Encryption
32//!
33//! This library implements the Matrix E2EE specification with enterprise-grade security:
34//!
35//! - **Olm** - Double Ratchet protocol for 1:1 messaging
36//! - **Megolm** - Group messaging with forward secrecy
37//! - **PBKDF2** - 600,000 iterations (OWASP 2023 standard)
38//! - **Memory Security** - Automatic zeroing with `zeroize`
39//! - **Rate Limiting** - Protection against resource exhaustion
40//!
41//! ## Storage
42//!
43//! Redis is used for all persistence with the following schema:
44//!
45//! - `matrix:event:{event_id}` - Event data
46//! - `matrix:room:{room_id}:events` - Sorted set of events
47//! - `matrix:user:{user_id}:rooms` - User's room memberships
48//! - `matrix:encryption:{user_id}:{device_id}` - E2EE keys
49//!
50//! ## Examples
51//!
52//! See the [examples](https://github.com/milesfuller/urban-nest/tree/main/matrix-lite/examples) directory for more usage patterns.
53
54pub mod storage;
55pub mod crypto;
56
57// Server module coming soon
58// #[cfg(feature = "server")]
59// pub mod server;
60
61// WASM module coming soon
62// #[cfg(feature = "wasm")]
63// pub mod wasm;
64
65pub mod error;
66pub mod types;
67
68// Re-exports
69pub use error::{Error, Result};
70pub use storage::RedisStorage;
71pub use crypto::CryptoManager;
72
73#[cfg(test)]
74mod tests {
75 use super::*;
76
77 #[test]
78 fn test_library_loads() {
79 // Basic sanity test
80 assert!(true);
81 }
82}