Scaffold Rust workspace: warzone-protocol, server, client, mule

4 crates, all compile. 16/17 tests pass.

warzone-protocol (core crypto):
- Seed-based identity (Ed25519 + X25519 from 32-byte seed via HKDF)
- BIP39 mnemonic encode/decode (24 words)
- Fingerprint type (SHA-256 truncated, displayed as xxxx:xxxx:xxxx:xxxx)
- ChaCha20-Poly1305 AEAD encrypt/decrypt with random nonce
- HKDF-SHA256 key derivation
- Pre-key bundle generation with Ed25519 signatures
- X3DH key exchange (simplified, needs X25519 identity key in bundle)
- Double Ratchet: full implementation with DH ratchet, chain ratchet,
  out-of-order message handling via skipped keys cache
- Message format (WarzoneMessage envelope + RatchetHeader)
- Session type with ratchet state
- Storage trait definitions (PreKeyStore, SessionStore, MessageQueue)

warzone-server (axum):
- sled database (keys, messages, one-time pre-keys)
- Routes: /v1/health, /v1/keys/register, /v1/keys/{fp},
  /v1/messages/send, /v1/messages/poll/{fp}, /v1/messages/{id}/ack

warzone-client (CLI):
- `warzone init` — generate seed, show mnemonic, save to ~/.warzone/
- `warzone recover <words>` — restore from mnemonic
- `warzone info` — show fingerprint and keys
- Seed storage at ~/.warzone/identity.seed (600 perms)
- Stubs for send, recv, chat commands

warzone-mule: Phase 4 placeholder

Known issue: X3DH test fails (initiate/respond use different DH ops
due to missing X25519 identity key in bundle). Fix in next step.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-03-26 21:27:48 +04:00
parent 1e2a83402d
commit 651396fa13
5075 changed files with 36186 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
{"$message_type":"diagnostic","message":"struct `ServerConfig` is never constructed","code":{"code":"dead_code","explanation":null},"level":"warning","spans":[{"file_name":"crates/warzone-server/src/config.rs","byte_start":11,"byte_end":23,"line_start":1,"line_end":1,"column_start":12,"column_end":24,"is_primary":true,"text":[{"text":"pub struct ServerConfig {","highlight_start":12,"highlight_end":24}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: struct `ServerConfig` is never constructed\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0mcrates/warzone-server/src/config.rs:1:12\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m1\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct ServerConfig {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default\n\n"}
{"$message_type":"diagnostic","message":"field `otpks` is never read","code":{"code":"dead_code","explanation":null},"level":"warning","spans":[{"file_name":"crates/warzone-server/src/db.rs","byte_start":32,"byte_end":40,"line_start":3,"line_end":3,"column_start":12,"column_end":20,"is_primary":false,"text":[{"text":"pub struct Database {","highlight_start":12,"highlight_end":20}],"label":"field in this struct","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"crates/warzone-server/src/db.rs","byte_start":107,"byte_end":112,"line_start":6,"line_end":6,"column_start":9,"column_end":14,"is_primary":true,"text":[{"text":" pub otpks: sled::Tree,","highlight_start":9,"highlight_end":14}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `otpks` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0mcrates/warzone-server/src/db.rs:6:9\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m3\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct Database {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m--------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m6\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub otpks: sled::Tree,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^\u001b[0m\n\n"}
{"$message_type":"diagnostic","message":"struct `AppError` is never constructed","code":{"code":"dead_code","explanation":null},"level":"warning","spans":[{"file_name":"crates/warzone-server/src/errors.rs","byte_start":86,"byte_end":94,"line_start":4,"line_end":4,"column_start":12,"column_end":20,"is_primary":true,"text":[{"text":"pub struct AppError(pub anyhow::Error);","highlight_start":12,"highlight_end":20}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: struct `AppError` is never constructed\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0mcrates/warzone-server/src/errors.rs:4:12\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m4\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct AppError(pub anyhow::Error);\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^\u001b[0m\n\n"}
{"$message_type":"diagnostic","message":"3 warnings emitted","code":null,"level":"warning","spans":[],"children":[],"rendered":"\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: 3 warnings emitted\u001b[0m\n\n"}