Files
waste-rs/FUTURE.md

124 lines
4.5 KiB
Markdown
Raw Permalink Normal View History

# waste-rs — Project Roadmap
A modern reimplementation of [WASTE](https://en.wikipedia.org/wiki/WASTE):
decentralized, friend-to-friend encrypted mesh networking with chat and file sharing.
---
## Design Philosophy
WASTE's core idea is still sound: small trusted groups, no central server, encrypted
everything, equal nodes. This project preserves that philosophy while replacing the
aging crypto and adding proper NAT traversal.
---
## Architecture
### Core Daemon — Rust
The networking core (mesh routing, encryption, peer management, file transfer) is
implemented in Rust because:
- **Memory safety without GC** — critical for a long-running daemon handling untrusted peer data
- **tokio** — excellent async I/O for managing many concurrent peer connections
- **ring** — modern, audited cryptography (ChaCha20-Poly1305, Ed25519, X25519)
- **Native cross-compilation** — Windows, Linux, macOS, and eventually Android/iOS
### UI Layer — TUI first, Tauri later
**Step 1: Terminal UI (`ratatui` + `crossterm`)**
The daemon exposes everything over the IPC socket, so a TUI is purely a client —
it connects to port 17337, renders `IpcEvent` lines, and sends `IpcCommand` lines
back. No mesh or crypto knowledge required.
- ~400600 lines of Rust, two crate dependencies
- Works on Windows, Linux, macOS, and over SSH
- Validates the IPC API design before it gets frozen
- Fast to iterate: restart the TUI, daemon keeps running
This is the right first UI milestone. It gives you a real working chat interface
without any build toolchain beyond `cargo`.
**Step 2: Tauri GUI**
Once the IPC contract is stable, wrap it in a proper desktop app:
- Rust backend shares code directly with the daemon
- Web frontend (React/TypeScript) for a modern chat UI
- Ships as a native binary using the OS webview — not Electron
- Works on Windows, Linux, macOS; Tauri 2.x adds Android/iOS
This avoids the wxWidgets ugliness of the original WASTE and the Qt licensing
headaches of the VIA fork.
---
## Crypto Modernization
Replaces WASTE's original Blowfish/PCBC (broken cipher mode) + RSA with:
| Purpose | Algorithm | Replaces |
|---|---|---|
| Identity | Ed25519 | Unregistered nicknames |
| Key exchange | X25519 ECDH | RSA |
| Symmetric encryption | ChaCha20-Poly1305 | Blowfish/PCBC |
| File integrity | SHA-256 | CRC |
---
## Protocol Modernization
### NAT Traversal
WASTE's longstanding problem: one party needs an open port. The fix:
1. **ICE-style UDP hole punching** (STUN) — try direct connection first
2. **Relay fallback** — a lightweight relay server (already implemented) forwards
encrypted blobs when hole punching fails; the relay never sees plaintext
### Transport (future consideration)
Consider migrating from raw TCP to **QUIC** (via `quinn`) for:
- Connection multiplexing — multiple streams per peer without head-of-line blocking
- Better NAT behavior out of the box
- Built-in TLS 1.3
### Identity & Bootstrapping
- Each peer generates an Ed25519 keypair on first run — the public key *is* their identity
- Invite via a signed `.waste-invite` file shared out-of-band (email, Signal, etc.)
- The invite carries: current IP:port hint + public key + short-lived signature
- Once two peers connect, they gossip each other's addresses to mutual friends
- At small group sizes (1050 nodes) a local known-peers list is sufficient — no DHT needed
---
## Roadmap
### Near-term
- [ ] Invite file format (`.waste-invite`) for easy peer onboarding
- [ ] Relay-assisted message delivery (daemon → relay → peer when no direct path)
- [ ] Gossip-driven auto-connect (friends-of-friends)
- [ ] Ping/pong keepalive with peer timeout and reconnect
### Medium-term
- [ ] **TUI client** (`ratatui` + `crossterm`) — chat pane, peer list, text input
- [ ] UDP hole-punching (STUN) in `nat.rs`
- [ ] File transfer implementation (FileOffer/FileChunk protocol already defined in proto)
- [ ] Message persistence (SQLite via `rusqlite`)
- [ ] Tauri GUI wrapping the daemon (sidebar: peers, rooms, chat history)
### Long-term
- [ ] QUIC transport via `quinn`
- [ ] Mobile daemon (Android/iOS via Rust cross-compilation)
- [ ] Kademlia DHT for larger-scale peer discovery (if the group outgrows static bootstrap)
---
## What We Keep from WASTE
- Small, trusted friend groups — not a public network
- No central authority — the relay is dumb and optional
- Encrypted everything — the relay forwards opaque blobs
- Equal nodes — no privileged "servers" among peers
- Simple onboarding — one file or one URL to join a group