Crate matrix_lite_rs

Crate matrix_lite_rs 

Source
Expand description

§matrix-lite-rs

A production-ready, lightweight Matrix protocol implementation with Redis backend and WASM support.

§Features

  • End-to-End Encryption (E2EE) - Full Olm/Megolm support via vodozemac
  • Redis Storage - Scalable persistence with horizontal scaling support
  • Multi-Device Sync - Automatic synchronization across devices
  • WASM Ready - Browser compatibility via WebAssembly
  • Production Security - PBKDF2 key derivation, rate limiting, input validation
  • Matrix Compatible - Follows Matrix protocol specifications

§Quick Start

use matrix_lite_rs::{RedisStorage, crypto::CryptoManager};

// Create Redis storage
let storage = RedisStorage::new("redis://localhost:6379").await?;

// Create crypto manager for E2EE
let mut crypto = CryptoManager::new();
let keys = crypto.identity_keys();
println!("Identity keys: curve25519={}, ed25519={}", keys.curve25519, keys.ed25519);

§End-to-End Encryption

This library implements the Matrix E2EE specification with enterprise-grade security:

  • Olm - Double Ratchet protocol for 1:1 messaging
  • Megolm - Group messaging with forward secrecy
  • PBKDF2 - 600,000 iterations (OWASP 2023 standard)
  • Memory Security - Automatic zeroing with zeroize
  • Rate Limiting - Protection against resource exhaustion

§Storage

Redis is used for all persistence with the following schema:

  • matrix:event:{event_id} - Event data
  • matrix:room:{room_id}:events - Sorted set of events
  • matrix:user:{user_id}:rooms - User’s room memberships
  • matrix:encryption:{user_id}:{device_id} - E2EE keys

§Examples

See the examples directory for more usage patterns.

Re-exports§

pub use error::Error;
pub use error::Result;
pub use storage::RedisStorage;
pub use crypto::CryptoManager;

Modules§

crypto
error
storage
types