//! hack-house — encrypted collaborative sessions with a summoned sandbox. //! //! This binary exposes the crypto-parity spike used to prove the Rust client //! speaks the same SRP / Fernet dialect as the Python Sanic server, plus the //! ratatui UI built on top of that proven foundation. mod app; mod crypto; mod ft; mod layout; mod net; mod registry; mod sbx; mod snapshot; mod theme; mod ui; use anyhow::{Context, Result}; use base64::Engine; use clap::{Parser, Subcommand}; use serde_json::json; const STD: base64::engine::general_purpose::GeneralPurpose = base64::engine::general_purpose::STANDARD; #[derive(Parser)] #[command(name = "hack-house", about = "encrypted collaborative sessions")] struct Cli { #[command(subcommand)] cmd: Cmd, } #[derive(Subcommand)] enum Cmd { /// Join a house: SRP auth then launch the ratatui UI. Connect { ip: String, port: u16, /// Display name (handle) to join as. Omit to be prompted on join. user: Option, #[arg(long)] password: String, #[arg(long, default_value_t = false)] no_tls: bool, #[arg(long, default_value_t = false)] insecure: bool, /// Path to a theme (vestments) TOML file. #[arg(long)] theme: Option, }, /// Debug: print the derived room Fernet key for a password + room_salt(hex). Roomkey { password: String, room_salt_hex: String, }, /// Run the offline SRP golden-vector self-test. Selftest, /// Debug: compute A and M from explicit a/salt/B hex (parity check vs python). Srpm { a_hex: String, salt_hex: String, b_hex: String, #[arg(long, default_value = "labtest")] password: String, #[arg(long, default_value = "chat")] user: String, }, /// Perform a live SRP handshake + send one encrypted message (interop proof). Handshake { ip: String, port: u16, user: String, #[arg(long)] password: String, #[arg(long, default_value_t = false)] no_tls: bool, #[arg(long, default_value_t = false)] insecure: bool, }, /// Headless snapshot ops on the VM library — the save/publish surface the /// interactive `/sbx` grammar exposes, usable by an autonomous `/loop` runner /// without a TUI. Writes byte-identical registry entries to the in-room path. Sbx { #[command(subcommand)] action: SbxCmd, }, } #[derive(Subcommand)] enum SbxCmd { /// Commit the running sandbox to a snapshot and index it in the VM registry, /// caching the container's `.hh-agent` manifest summary. Mirrors `/sbx save`. Save { /// Snapshot label (image tag / registry key). label: String, /// Also export a portable `hh-snapshots/hh-snap-