diff --git a/cli-renderer/Cargo.toml b/cli-renderer/Cargo.toml index 198b9b2..6834930 100644 --- a/cli-renderer/Cargo.toml +++ b/cli-renderer/Cargo.toml @@ -6,7 +6,6 @@ edition = "2024" [dependencies] crossterm = "0.29.0" ratatui = "0.29.0" -ws = "0.9.2" -vlogger = { path = "../lib/logger-rs" } +vlogger = { path = "../vlogger" } clap = { version = "4.5.47", features = ["derive"] } textwrap = "0.16.2" diff --git a/native_client/Cargo.lock b/native_client/Cargo.lock index 33734fd..e640b55 100644 --- a/native_client/Cargo.lock +++ b/native_client/Cargo.lock @@ -64,7 +64,7 @@ dependencies = [ "nom", "pin-project", "pinentry", - "rand", + "rand 0.8.5", "rpassword", "rust-embed", "scrypt", @@ -86,7 +86,7 @@ dependencies = [ "hkdf", "io_tee", "nom", - "rand", + "rand 0.8.5", "secrecy", "sha2", ] @@ -691,7 +691,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", - "rand_core", + "rand_core 0.6.4", "subtle", "zeroize", ] @@ -738,6 +738,12 @@ dependencies = [ "syn", ] +[[package]] +name = "data-encoding" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" + [[package]] name = "der" version = "0.7.10" @@ -978,7 +984,7 @@ dependencies = [ "generic-array", "group", "pkcs8", - "rand_core", + "rand_core 0.6.4", "sec1", "subtle", "zeroize", @@ -1093,7 +1099,7 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" dependencies = [ - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -1172,6 +1178,12 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "foldhash" version = "0.1.5" @@ -1445,7 +1457,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ "ff", - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -1520,6 +1532,23 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "http" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + [[package]] name = "i18n-config" version = "0.4.8" @@ -2002,10 +2031,13 @@ dependencies = [ name = "native_client" version = "0.1.0" dependencies = [ + "bincode", "eframe", "egui", "hex", "serde", + "shared", + "tungstenite", "vlogger", "watchlet", ] @@ -2650,8 +2682,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", ] [[package]] @@ -2661,7 +2703,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", ] [[package]] @@ -2673,6 +2725,15 @@ dependencies = [ "getrandom 0.2.16", ] +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] + [[package]] name = "raw-window-handle" version = "0.6.2" @@ -2713,6 +2774,20 @@ dependencies = [ "subtle", ] +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.16", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "ron" version = "0.10.1" @@ -2828,6 +2903,36 @@ dependencies = [ "windows-sys 0.61.0", ] +[[package]] +name = "rustls" +version = "0.23.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df51b5869f3a441595eac5e8ff14d486ff285f7b8c0df8770e49c3b56351f0f0" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" + +[[package]] +name = "rustls-webpki" +version = "0.103.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fef8b8769aaccf73098557a87cd1816b4f9c7c16811c9c77142aa695c16f2c03" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.22" @@ -2957,6 +3062,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2" version = "0.10.9" @@ -3006,7 +3122,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest", - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -3280,6 +3396,26 @@ version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" +[[package]] +name = "tungstenite" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadc29d668c91fcc564941132e17b28a7ceb2f3ebf0b9dae3e03fd7a6748eb0d" +dependencies = [ + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand 0.9.2", + "rustls", + "rustls-pki-types", + "sha1", + "thiserror 2.0.16", + "utf-8", + "webpki-roots", +] + [[package]] name = "type-map" version = "0.5.1" @@ -3342,6 +3478,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "unty" version = "0.0.4" @@ -3360,6 +3502,12 @@ dependencies = [ "serde", ] +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + [[package]] name = "utf8_iter" version = "1.0.4" @@ -3662,6 +3810,15 @@ dependencies = [ "web-sys", ] +[[package]] +name = "webpki-roots" +version = "0.26.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "weezl" version = "0.1.10" @@ -4162,7 +4319,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" dependencies = [ "curve25519-dalek", - "rand_core", + "rand_core 0.6.4", "serde", "zeroize", ] diff --git a/native_client/Cargo.toml b/native_client/Cargo.toml index 3d0c5a1..65be67b 100644 --- a/native_client/Cargo.toml +++ b/native_client/Cargo.toml @@ -17,3 +17,6 @@ serde = { version = "1.0.219", features = ["derive"] } watchlet = { path = "../watchlet" } hex = "0.4.3" vlogger = { path = "../vlogger" } +tungstenite = { version = "0.27.0", features = ["rustls-tls-webpki-roots"] } +bincode = { version = "2.0.1", features = ["serde"] } +shared = { path = "../shared" } diff --git a/native_client/src/backend/wallet.rs b/native_client/src/backend/wallet.rs index 85a92ba..b66b19a 100644 --- a/native_client/src/backend/wallet.rs +++ b/native_client/src/backend/wallet.rs @@ -9,6 +9,8 @@ use crate::messages::frontend::FrontendMessage; use crate::messages::backend::BackendMessage; use crate::constants::DATA_DIR_PATH; +use std::path; + #[derive(Debug)] pub struct WalletState { pub address: String, @@ -27,7 +29,7 @@ impl WalletService { receiver: Receiver, sender: Sender, ) -> Self { - let wallet_path = format!("{}/wallet/wallet.age", DATA_DIR_PATH); + let wallet_path = path::PathBuf::from(format!("{}/wallet/wallet.age", DATA_DIR_PATH)); let storage = FileStorage::new(wallet_path.into()); let mut wallet_manager = WalletManager::new(storage); wallet_manager.load_wallet("password".into()).unwrap(); diff --git a/native_client/src/backend/ws_client.rs b/native_client/src/backend/ws_client.rs new file mode 100644 index 0000000..2317386 --- /dev/null +++ b/native_client/src/backend/ws_client.rs @@ -0,0 +1,12 @@ +use shared::WsClientRequest; + +pub fn run_client() { + let (mut stream, _response) = tungstenite::connect("ws://localhost:9001").unwrap(); + + let msg = bincode::encode_to_vec(WsClientRequest::Ping, bincode::config::standard()).unwrap(); + stream.send(msg.into()).unwrap(); + + loop { + println!("{:#?}", stream.read()) + } +} diff --git a/native_client/src/lib.rs b/native_client/src/lib.rs index ee06174..c091f7c 100644 --- a/native_client/src/lib.rs +++ b/native_client/src/lib.rs @@ -28,4 +28,5 @@ pub mod messages { pub mod backend { pub mod wallet; + pub mod ws_client; } diff --git a/native_client/src/main.rs b/native_client/src/main.rs index 5336d37..02ecd04 100644 --- a/native_client/src/main.rs +++ b/native_client/src/main.rs @@ -1,7 +1,7 @@ #![warn(clippy::all, rust_2018_idioms)] #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] -use native_client::{backend::wallet::WalletService, frontend, messages::{backend::BackendMessage, frontend::FrontendMessage}}; +use native_client::{backend::{wallet::WalletService, ws_client::run_client}, frontend, messages::{backend::BackendMessage, frontend::FrontendMessage}}; use std::sync::mpsc::{self, Receiver, Sender}; fn dispatch_frontend( @@ -25,6 +25,9 @@ fn main() -> Result<(), std::io::Error> { let (front_tx, front_rx) = mpsc::channel::(); let (back_tx, back_rx) = mpsc::channel::(); + run_client(); + return Ok(()); + let backend_handle = std::thread::spawn( || { let mut wallet_service = WalletService::new(back_rx, front_tx); wallet_service.run(); diff --git a/node/Cargo.lock b/node/Cargo.lock index 76d44ad..ed45ebd 100644 --- a/node/Cargo.lock +++ b/node/Cargo.lock @@ -24,7 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" dependencies = [ "crypto-common", - "generic-array 0.14.7", + "generic-array", ] [[package]] @@ -193,7 +193,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" dependencies = [ "addr2line", - "cfg-if 1.0.3", + "cfg-if", "libc", "miniz_oxide", "object", @@ -282,34 +282,13 @@ version = "2.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34efbcccd345379ca2868b2b2c9d3782e9cc58ba87bc7d79d5b53d9c9ae6f25d" -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - [[package]] name = "block-buffer" version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "generic-array 0.14.7", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", + "generic-array", ] [[package]] @@ -342,7 +321,7 @@ dependencies = [ "tokio-tungstenite", "uuid", "vlogger", - "wallet", + "watchlet", ] [[package]] @@ -351,28 +330,12 @@ version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - [[package]] name = "byteorder" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "bytes" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "iovec", -] - [[package]] name = "bytes" version = "1.10.1" @@ -403,12 +366,6 @@ dependencies = [ "shlex", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.3" @@ -421,7 +378,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" dependencies = [ - "cfg-if 1.0.3", + "cfg-if", "cipher", "cpufeatures", ] @@ -519,7 +476,6 @@ dependencies = [ "ratatui", "textwrap", "vlogger", - "ws", ] [[package]] @@ -544,7 +500,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b79c4069c6cad78e2e0cdfcbd26275770669fb39fd308a752dc110e83b9af32" dependencies = [ "castaway", - "cfg-if 1.0.3", + "cfg-if", "itoa", "rustversion", "ryu", @@ -608,7 +564,7 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" dependencies = [ - "cfg-if 1.0.3", + "cfg-if", ] [[package]] @@ -634,12 +590,12 @@ checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ "bitflags 2.9.3", "crossterm_winapi", - "mio 1.0.4", + "mio", "parking_lot 0.12.4", "rustix 0.38.44", "signal-hook", "signal-hook-mio", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -653,12 +609,12 @@ dependencies = [ "derive_more", "document-features", "futures-core", - "mio 1.0.4", + "mio", "parking_lot 0.12.4", "rustix 1.0.8", "signal-hook", "signal-hook-mio", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -667,7 +623,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -676,7 +632,7 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "generic-array 0.14.7", + "generic-array", "rand_core 0.6.4", "subtle", "zeroize", @@ -688,7 +644,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array 0.14.7", + "generic-array", "typenum", ] @@ -698,7 +654,7 @@ version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ - "cfg-if 1.0.3", + "cfg-if", "cpufeatures", "curve25519-dalek-derive", "fiat-crypto", @@ -790,22 +746,13 @@ dependencies = [ "syn", ] -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - [[package]] name = "digest" version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.4", + "block-buffer", "const-oid", "crypto-common", "subtle", @@ -838,7 +785,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", - "digest 0.10.7", + "digest", "elliptic-curve", "rfc6979", "signature", @@ -859,9 +806,9 @@ checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", - "digest 0.10.7", + "digest", "ff", - "generic-array 0.14.7", + "generic-array", "group", "pkcs8", "rand_core 0.6.4", @@ -892,12 +839,6 @@ dependencies = [ "windows-sys 0.60.2", ] -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - [[package]] name = "ff" version = "0.13.1" @@ -979,15 +920,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" -[[package]] -name = "form_urlencoded" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" -dependencies = [ - "percent-encoding", -] - [[package]] name = "fs2" version = "0.4.3" @@ -995,25 +927,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags 1.3.2", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "futures" version = "0.3.31" @@ -1112,15 +1028,6 @@ dependencies = [ "byteorder", ] -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -1132,24 +1039,13 @@ dependencies = [ "zeroize", ] -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if 1.0.3", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - [[package]] name = "getrandom" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ - "cfg-if 1.0.3", + "cfg-if", "js-sys", "libc", "wasi 0.11.1+wasi-snapshot-preview1", @@ -1162,7 +1058,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ - "cfg-if 1.0.3", + "cfg-if", "libc", "r-efi", "wasi 0.14.2+wasi-0.2.4", @@ -1238,7 +1134,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.7", + "digest", ] [[package]] @@ -1256,7 +1152,7 @@ version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" dependencies = [ - "bytes 1.10.1", + "bytes", "fnv", "itoa", ] @@ -1363,119 +1259,12 @@ dependencies = [ "cc", ] -[[package]] -name = "icu_collections" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" -dependencies = [ - "displaydoc", - "potential_utf", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" - -[[package]] -name = "icu_properties" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "potential_utf", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" - -[[package]] -name = "icu_provider" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" -dependencies = [ - "displaydoc", - "icu_locale_core", - "stable_deref_trait", - "tinystr", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - [[package]] name = "ident_case" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - [[package]] name = "indoc" version = "2.0.6" @@ -1488,7 +1277,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" dependencies = [ - "generic-array 0.14.7", + "generic-array", ] [[package]] @@ -1510,7 +1299,7 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ - "cfg-if 1.0.3", + "cfg-if", ] [[package]] @@ -1539,7 +1328,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b" dependencies = [ "bitflags 2.9.3", - "cfg-if 1.0.3", + "cfg-if", "libc", ] @@ -1549,15 +1338,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b3f7cef34251886990511df1c61443aa928499d598a9473929ab5a90a527304" -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - [[package]] name = "is-terminal" version = "0.4.16" @@ -1606,7 +1386,7 @@ version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" dependencies = [ - "cfg-if 1.0.3", + "cfg-if", "ecdsa", "elliptic-curve", "once_cell", @@ -1623,28 +1403,12 @@ dependencies = [ "cpufeatures", ] -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "lazy_static" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" version = "0.2.175" @@ -1663,12 +1427,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" -[[package]] -name = "litemap" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" - [[package]] name = "litrs" version = "0.4.2" @@ -1731,25 +1489,6 @@ dependencies = [ "adler2", ] -[[package]] -name = "mio" -version = "0.6.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" -dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - [[package]] name = "mio" version = "1.0.4" @@ -1762,41 +1501,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "mio-extras" -version = "2.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" -dependencies = [ - "lazycell", - "log", - "mio 0.6.23", - "slab", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - -[[package]] -name = "net2" -version = "0.2.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - [[package]] name = "nom" version = "7.1.3" @@ -1837,12 +1541,6 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - [[package]] name = "opaque-debug" version = "0.3.1" @@ -1876,12 +1574,12 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ - "cfg-if 1.0.3", + "cfg-if", "instant", "libc", "redox_syscall 0.2.16", "smallvec", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1890,7 +1588,7 @@ version = "0.9.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" dependencies = [ - "cfg-if 1.0.3", + "cfg-if", "libc", "redox_syscall 0.5.17", "smallvec", @@ -1909,7 +1607,7 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ - "digest 0.10.7", + "digest", "hmac", ] @@ -1982,19 +1680,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" dependencies = [ "cpufeatures", - "opaque-debug 0.3.1", + "opaque-debug", "universal-hash", ] -[[package]] -name = "potential_utf" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a" -dependencies = [ - "zerovec", -] - [[package]] name = "ppv-lite86" version = "0.2.21" @@ -2050,19 +1739,6 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", -] - [[package]] name = "rand" version = "0.8.5" @@ -2084,16 +1760,6 @@ dependencies = [ "rand_core 0.9.3", ] -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", -] - [[package]] name = "rand_chacha" version = "0.3.1" @@ -2114,15 +1780,6 @@ dependencies = [ "rand_core 0.9.3", ] -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - [[package]] name = "rand_core" version = "0.6.4" @@ -2141,15 +1798,6 @@ dependencies = [ "getrandom 0.3.3", ] -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - [[package]] name = "ratatui" version = "0.29.0" @@ -2206,7 +1854,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", - "cfg-if 1.0.3", + "cfg-if", "getrandom 0.2.16", "libc", "untrusted", @@ -2321,6 +1969,36 @@ dependencies = [ "windows-sys 0.60.2", ] +[[package]] +name = "rustls" +version = "0.23.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df51b5869f3a441595eac5e8ff14d486ff285f7b8c0df8770e49c3b56351f0f0" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" + +[[package]] +name = "rustls-webpki" +version = "0.103.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fef8b8769aaccf73098557a87cd1816b4f9c7c16811c9c77142aa695c16f2c03" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.22" @@ -2376,7 +2054,7 @@ checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct", "der", - "generic-array 0.14.7", + "generic-array", "pkcs8", "subtle", "zeroize", @@ -2465,27 +2143,15 @@ dependencies = [ "serde", ] -[[package]] -name = "sha-1" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - [[package]] name = "sha1" version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ - "cfg-if 1.0.3", + "cfg-if", "cpufeatures", - "digest 0.10.7", + "digest", ] [[package]] @@ -2494,9 +2160,9 @@ version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ - "cfg-if 1.0.3", + "cfg-if", "cpufeatures", - "digest 0.10.7", + "digest", ] [[package]] @@ -2505,7 +2171,7 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "digest 0.10.7", + "digest", "keccak", ] @@ -2547,7 +2213,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" dependencies = [ "libc", - "mio 1.0.4", + "mio", "signal-hook", ] @@ -2566,7 +2232,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ - "digest 0.10.7", + "digest", "rand_core 0.6.4", ] @@ -2624,12 +2290,6 @@ dependencies = [ "der", ] -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - [[package]] name = "static_assertions" version = "1.1.0" @@ -2681,17 +2341,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "synstructure" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "textwrap" version = "0.16.2" @@ -2772,10 +2421,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" dependencies = [ "backtrace", - "bytes 1.10.1", + "bytes", "io-uring", "libc", - "mio 1.0.4", + "mio", "pin-project-lite", "slab", "socket2", @@ -2794,6 +2443,16 @@ dependencies = [ "syn", ] +[[package]] +name = "tokio-rustls" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" +dependencies = [ + "rustls", + "tokio", +] + [[package]] name = "tokio-tungstenite" version = "0.27.0" @@ -2802,8 +2461,12 @@ checksum = "489a59b6730eda1b0171fcfda8b121f4bee2b35cba8645ca35c5f7ba3eb736c1" dependencies = [ "futures-util", "log", + "rustls", + "rustls-pki-types", "tokio", + "tokio-rustls", "tungstenite", + "webpki-roots", ] [[package]] @@ -2821,12 +2484,14 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eadc29d668c91fcc564941132e17b28a7ceb2f3ebf0b9dae3e03fd7a6748eb0d" dependencies = [ - "bytes 1.10.1", + "bytes", "data-encoding", "http", "httparse", "log", "rand 0.9.2", + "rustls", + "rustls-pki-types", "sha1", "thiserror 2.0.16", "utf-8", @@ -2929,30 +2594,12 @@ version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae" -[[package]] -name = "url" -version = "2.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", -] - [[package]] name = "utf-8" version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - [[package]] name = "utf8parse" version = "0.2.2" @@ -3000,30 +2647,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "wallet" -version = "0.1.0" -dependencies = [ - "age", - "bincode", - "getrandom 0.2.16", - "hex", - "js-sys", - "k256", - "serde", - "sha3", - "shared", - "thiserror 2.0.16", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" @@ -3045,7 +2668,7 @@ version = "0.2.101" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e14915cadd45b529bb8d1f343c4ed0ac1de926144b746e2710f9cd05df6603b" dependencies = [ - "cfg-if 1.0.3", + "cfg-if", "once_cell", "rustversion", "serde", @@ -3100,6 +2723,24 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "watchlet" +version = "0.1.0" +dependencies = [ + "age", + "bincode", + "getrandom 0.2.16", + "hex", + "js-sys", + "k256", + "serde", + "sha3", + "shared", + "thiserror 2.0.16", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "web-sys" version = "0.3.78" @@ -3110,6 +2751,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki-roots" +version = "0.26.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "which" version = "4.4.2" @@ -3122,12 +2772,6 @@ dependencies = [ "rustix 0.38.44", ] -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - [[package]] name = "winapi" version = "0.3.9" @@ -3138,12 +2782,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -3389,40 +3027,6 @@ dependencies = [ "bitflags 2.9.3", ] -[[package]] -name = "writeable" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" - -[[package]] -name = "ws" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25fe90c75f236a0a00247d5900226aea4f2d7b05ccc34da9e7a8880ff59b5848" -dependencies = [ - "byteorder", - "bytes 0.4.12", - "httparse", - "log", - "mio 0.6.23", - "mio-extras", - "rand 0.7.3", - "sha-1", - "slab", - "url", -] - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "x25519-dalek" version = "2.0.1" @@ -3435,30 +3039,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "yoke" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" -dependencies = [ - "serde", - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - [[package]] name = "zerocopy" version = "0.8.26" @@ -3484,21 +3064,6 @@ name = "zerofrom" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] [[package]] name = "zeroize" @@ -3520,35 +3085,11 @@ dependencies = [ "syn", ] -[[package]] -name = "zerotrie" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - [[package]] name = "zerovec" version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" dependencies = [ - "yoke", "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" -dependencies = [ - "proc-macro2", - "quote", - "syn", ] diff --git a/node/Cargo.toml b/node/Cargo.toml index 69b8fa1..9b857fc 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -12,7 +12,7 @@ serde_json = "1.0.143" sha2 = "0.10.9" thiserror = "2.0.16" tokio = { version = "1.47.1", features = ["rt-multi-thread", "net", "sync", "time", "macros"] } -tokio-tungstenite = "0.27.0" +tokio-tungstenite = { version = "0.27.0", features = ["handshake", "rustls-tls-webpki-roots"] } uuid = { version = "1.18.0", features = ["v4", "serde"] } vlogger = { path = "../vlogger" } ratatui = "0.29.0" @@ -30,6 +30,6 @@ futures = "0.3.31" secp256k1 = { version = "0.31.1", features = ["hashes", "rand", "recovery", "serde"] } ring = "0.17.14" shared = { path = "../shared", features = ["node"] } -wallet = { path = "../wallet" } +watchlet = { path = "../watchlet" } cli-renderer = { path = "../cli-renderer" } tiny_http = "0.12.0" diff --git a/node/src/db/database.rs b/node/src/db/database.rs index 221e502..cde081b 100644 --- a/node/src/db/database.rs +++ b/node/src/db/database.rs @@ -12,7 +12,7 @@ use crate::{ use shared::print_error_chain; use crate::PROJECT_PATH; -static BINCODE_CONFIG: Configuration = bincode::config::standard(); +pub static BINCODE_CONFIG: Configuration = bincode::config::standard(); const DB_TREE: &str = "blocks"; diff --git a/node/src/lib.rs b/node/src/lib.rs index cf12fbd..e34c788 100644 --- a/node/src/lib.rs +++ b/node/src/lib.rs @@ -7,6 +7,8 @@ pub mod node { pub mod blockchain; pub use blockchain::*; + + pub mod ws_server; } pub mod constants; diff --git a/node/src/node/node.rs b/node/src/node/node.rs index 7d14e6b..2caff51 100644 --- a/node/src/node/node.rs +++ b/node/src/node/node.rs @@ -7,6 +7,7 @@ use crate::protocol::ProtocolMessage; use crate::protocol::{Connector, ConnectorCommand}; use crate::seeds_constants::SEED_NODES; use crate::watcher::{WatcherCommand, WatcherMode}; +use super::ws_server::{WsCommand, WsServer}; use super::{ Blockchain, BlockchainError, ValidationError }; use std::collections::HashMap; @@ -477,10 +478,18 @@ impl Node { .await; }; - let handle = tokio::spawn(async move { + let http_handle = tokio::spawn(async move { let _ = crate::api::server::start_server().await; }); + let (tx, rx) = mpsc::channel::(100); + + let mut ws_server = WsServer::new(rx, self.exec_tx()); + + let ws_handle = tokio::spawn(async move { + ws_server.run().await; + }); + let mut system_rx = subscribe_system_event(); publish_system_event(SystemEvent::NodeStarted); @@ -506,7 +515,7 @@ impl Node { } } } - handle.abort_handle().abort(); + http_handle.abort_handle().abort(); self.shutdown().await; } } diff --git a/node/src/node/ws_server.rs b/node/src/node/ws_server.rs new file mode 100644 index 0000000..d789e57 --- /dev/null +++ b/node/src/node/ws_server.rs @@ -0,0 +1,141 @@ +use std::collections::HashMap; +use std::net::SocketAddr; + +use tokio::net::TcpStream; +use futures::{SinkExt, StreamExt}; +use tokio::sync::mpsc::{self, Receiver, Sender}; +use thiserror::Error; +use vlogger::*; +use shared::ws_protocol::{ WsClientRequest, WsClientResponse }; + +use crate::db::BINCODE_CONFIG; +use crate::executor::ExecutorCommand; +use crate::log; +use crate::seeds_constants::WS_LISTEN_ADDRESS; + +#[derive(Debug, bincode::Encode, bincode::Decode)] +pub enum WsCommand { + Respond{ + msg: WsClientResponse, + addr: SocketAddr, + }, +} + +#[derive(Debug, Error)] +pub enum WsError { + #[error("Socker Error: {0}")] + Socket(#[from] std::io::Error), + + #[error("Tungstenite Error: {0}")] + Connection(#[from] tokio_tungstenite::tungstenite::Error), + + #[error("Encoding Error: {0}")] + Encode(#[from] bincode::error::EncodeError), + + #[error("Decoding Error: {0}")] + Decode(#[from] bincode::error::DecodeError), + + #[error("MPSC Send Error: {0}")] + MpscSend(#[from] mpsc::error::SendError) +} + +pub struct WsServer { + rx: Receiver, + tx: Sender, + clients: HashMap>, +} + +async fn ws_connection( + stream: TcpStream, + mut rx: Receiver, + _tx: Sender, +) -> Result<(), WsError> { + let ws_server = tokio_tungstenite::accept_async(stream).await.unwrap(); + let (mut write, mut read) = ws_server.split(); + + tokio::select! { + ws_res = read.next() => { + match ws_res { + Some(Ok(msg)) => { + log(msg!(DEBUG, "msg: {:#?}", msg)); + if msg.is_text() || msg.is_binary() { + let (message, _size): (WsClientRequest, usize) = bincode::decode_from_slice(msg.to_string().as_bytes(), BINCODE_CONFIG)?; + match message { + WsClientRequest::Ping => { + log(msg!(DEBUG, "Received Ping from client")); + let response = bincode::encode_to_vec(WsClientResponse::Pong, BINCODE_CONFIG)?; + write.send(response.into()).await?; + } + } + } + } + _ => {} + } + } + ws_cmd = rx.recv() => { + match ws_cmd { + Some(cmd) => { + let bin_cmd = bincode::encode_to_vec(&cmd, BINCODE_CONFIG)?; + write.send(bin_cmd.into()).await?; + } + None => {} + } + } + } + Ok(()) +} + +impl WsServer { + pub fn new(rx: Receiver, tx: Sender) -> Self { + Self { + rx, + tx, + clients: HashMap::new(), + } + } + + pub async fn run(&mut self) -> Result<(), WsError> { + let listener = tokio::net::TcpListener::bind(*WS_LISTEN_ADDRESS).await?; + let mut tasks = Vec::new(); + + log(msg!(DEBUG, "Starting WsServer at {}", *WS_LISTEN_ADDRESS)); + + loop { + tokio::select! { + ws_cmd = self.rx.recv() => { + match ws_cmd { + Some(cmd) => { + match cmd { + WsCommand::Respond { msg, addr } => { + if let Some(sender) = self.clients.get(&addr) { + sender.send(msg).await?; + } + } + } + } + None => {} + } + } + con_res = listener.accept() => { + match con_res { + Ok((stream, addr)) => { + log(msg!(DEBUG, "Received Connection Attempt from {}", addr)); + let (tx, rx) = mpsc::channel::(100); + self.clients.insert(addr, tx); + let tx = self.tx.clone(); + let task_handle = tokio::spawn(async move { + if let Err(e) = ws_connection(stream, rx, tx).await { + log(msg!(ERROR, "{e}")); + } + }); + tasks.push(task_handle); + } + Err(e) => { + log(msg!(ERROR, "{e}")); + } + } + } + } + } + } +} diff --git a/node/src/seeds_constants.rs b/node/src/seeds_constants.rs index c8ebe5b..bd9ed03 100644 --- a/node/src/seeds_constants.rs +++ b/node/src/seeds_constants.rs @@ -1,6 +1,10 @@ use once_cell::sync::Lazy; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; +pub static WS_LISTEN_ADDRESS: Lazy = Lazy::new(|| { + SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), 9001) +}); + pub static SEED_NODES: Lazy<[SocketAddr; 3]> = Lazy::new(|| { [ SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8333), diff --git a/node/src/watcher/watcher.rs b/node/src/watcher/watcher.rs index 4e8226a..c44608a 100644 --- a/node/src/watcher/watcher.rs +++ b/node/src/watcher/watcher.rs @@ -227,9 +227,9 @@ impl Watcher { pub async fn log_memory() { tokio::spawn(async move { let mut id = format!("{}_{}", current_timestamp(), std::process::id()); - id.replace(":", "_"); + let id = id.replace(":", "_"); let mut path = std::path::PathBuf::new(); - path.push("./proc/"); + path.push("proc"); path.push(id); let mut mem_map = std::fs::OpenOptions::new() .create(true) diff --git a/shared/src/lib.rs b/shared/src/lib.rs index ab9ffac..be7f054 100644 --- a/shared/src/lib.rs +++ b/shared/src/lib.rs @@ -13,8 +13,12 @@ pub mod core { pub mod address; pub use address::*; + } +pub mod ws_protocol; +pub use ws_protocol::*; + pub fn print_error_chain(err: &anyhow::Error) { let mut err_string = String::from(format!("Error: {}\n", err)); diff --git a/shared/src/ws_protocol.rs b/shared/src/ws_protocol.rs new file mode 100644 index 0000000..ec8d5ba --- /dev/null +++ b/shared/src/ws_protocol.rs @@ -0,0 +1,9 @@ +#[derive(Debug, bincode::Encode, bincode::Decode)] +pub enum WsClientRequest { + Ping +} + +#[derive(Debug, bincode::Encode, bincode::Decode)] +pub enum WsClientResponse { + Pong +}