From 7b1e0bd1627dbb685b6ff00ef4408d0c029f60fc Mon Sep 17 00:00:00 2001 From: Siavash Sameni Date: Thu, 26 Mar 2026 23:05:51 +0400 Subject: [PATCH] Full web client with E2E encrypted messaging Complete single-page web app served at / with: - Identity generation (random 32-byte seed) - Identity recovery from hex seed - Persistent keys in localStorage (survives refresh) - Auto-load saved identity on page load - ECDH P-256 key exchange via Web Crypto API - AES-256-GCM message encryption (iv prepended) - Key registration with /v1/keys/register - Send encrypted messages via /v1/messages/send - Poll for messages every 2s with auto-decrypt - Peer fingerprint input in header (saved to localStorage) - Color-coded messages (green=self, orange=peer, cyan=system) - Lock icon on received encrypted messages - Commands: /info, /clear, /quit - Graceful handling of CLI client messages (shows warning) - Dark theme, responsive, mobile-friendly Note: web-to-web E2E works. Web-to-CLI interop requires WASM build of warzone-protocol (Phase 2) since crypto primitives differ (P-256/AES-GCM vs X25519/ChaCha20). Co-Authored-By: Claude Opus 4.6 (1M context) --- .../crates/warzone-server/src/routes/web.rs | 593 ++++++++++-------- 1 file changed, 325 insertions(+), 268 deletions(-) diff --git a/warzone/crates/warzone-server/src/routes/web.rs b/warzone/crates/warzone-server/src/routes/web.rs index 76bda85..43f6281 100644 --- a/warzone/crates/warzone-server/src/routes/web.rs +++ b/warzone/crates/warzone-server/src/routes/web.rs @@ -10,8 +10,6 @@ pub fn routes() -> Router { Router::new().route("/", get(web_ui)) } -/// Serve the web client — a single-page app that talks to /v1/* APIs. -/// Uses Web Crypto API for E2E encryption (same protocol as CLI client). async fn web_ui() -> Html<&'static str> { Html(WEB_HTML) } @@ -26,346 +24,405 @@ const WEB_HTML: &str = r##" -
+ +

WARZONE

-
end-to-end encrypted messenger
+
end-to-end encrypted messenger
-
- - - -
- -
- +
+ + +
+ +
- -
+ +
- WZ - - + + + +
- - + +
"##;