| Crates.io | matrix-lite-rs |
| lib.rs | matrix-lite-rs |
| version | 0.1.0 |
| created_at | 2025-10-02 06:09:44.988071+00 |
| updated_at | 2025-10-02 06:09:44.988071+00 |
| description | Production-ready Matrix protocol implementation with Redis backend, E2EE (Olm/Megolm), and WASM support for scalable real-time messaging |
| homepage | https://github.com/milesfuller/urban-nest/tree/main/matrix-lite |
| repository | https://github.com/milesfuller/urban-nest |
| max_upload_size | |
| id | 1863918 |
| size | 125,438 |
A lightweight Matrix protocol implementation with Redis backend and WASM support, designed for scalable real-time messaging with end-to-end encryption.
vodozemacmatrix-lite-rs/
├── src/
│ ├── lib.rs # Library entry point
│ ├── error.rs # Error types
│ ├── types.rs # Core Matrix types (UserId, RoomId, Event, etc.)
│ ├── storage/
│ │ ├── mod.rs # Storage trait definition
│ │ └── redis_storage.rs # Redis implementation
│ ├── crypto/
│ │ └── mod.rs # E2EE implementation (Olm/Megolm)
│ ├── server/ # Matrix server implementation (TODO)
│ └── wasm/ # WASM bindings (TODO)
└── Cargo.toml
use matrix_lite_rs::{RedisStorage, 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();
import init, { MatrixClient } from 'matrix-lite-rs';
await init();
const client = new MatrixClient('redis://localhost:6379');
The Redis storage adapter implements the following data structures:
matrix:event:{event_id} - Event data (JSON)matrix:room:{room_id}:events - Sorted set of event IDs by timestampmatrix:room:{room_id} - Room metadata (JSON)matrix:user:{user_id}:rooms - Set of room IDs for usermatrix:session:{access_token} - Session data (JSON)matrix:device:{user_id}:{device_id} - Device info (JSON)matrix:user:{user_id}:devices - Set of device IDsmatrix:encryption:{user_id}:{device_id} - Encryption keysmatrix:read:{user_id}:{room_id} - Read markersmatrix:unread:{user_id}:{room_id} - Unread countsImplements Matrix E2EE spec with production-grade security:
zeroize✅ Implemented (v0.1.0)
🔄 Planned for v0.2.0
🔮 Future Enhancements
25 comprehensive tests covering:
Run crypto tests:
cargo test crypto::tests
To integrate into your Deno/TypeScript backend:
wasm-pack build --target nodejsnpm install ./pkgimport { MatrixClient } from 'matrix-lite-rs';
const client = new MatrixClient(redisUrl);
await client.sendMessage(roomId, "Hello, encrypted world!");
rustup install stable)cargo install wasm-pack# Check compilation
cargo check
# Run tests
cargo test
# Build release
cargo build --release
# Build WASM
wasm-pack build --target bundler
# Build for Node.js/Deno
wasm-pack build --target nodejs
Comprehensive test coverage includes:
Run tests:
# All tests
cargo test
# Crypto tests only (25 tests)
cargo test crypto::tests
# Quiet mode (just pass/fail)
cargo test --quiet
# Server feature tests
cargo test --features server
TODO: Add benchmarks comparing with JavaScript implementations
MIT OR Apache-2.0
Contributions welcome! This is designed to be a reusable package for any project needing Matrix-compatible messaging.
Built on top of: