diff --git a/Cargo.lock b/Cargo.lock index 734b007..5d99f9d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -485,7 +485,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "baybridge" version = "0.1.0" -source = "git+https://github.com/nicolaschan/baybridge.git#ce0d9fff2075e547ad4db4148f3f3d90bde7c62a" +source = "git+https://github.com/nicolaschan/baybridge.git#1b144f3045fd4ed5fe9975fc08e5b23cfbd623c1" dependencies = [ "anyhow", "axum", @@ -500,6 +500,7 @@ dependencies = [ "rusqlite", "serde", "serde_json", + "serde_with", "tokio", "tracing", "tracing-subscriber", @@ -723,6 +724,7 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", + "serde", "wasm-bindgen", "windows-targets 0.52.6", ] @@ -1208,6 +1210,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", + "serde", +] + [[package]] name = "digest" version = "0.10.7" @@ -1598,13 +1610,19 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap", + "indexmap 2.5.0", "slab", "tokio", "tokio-util", "tracing", ] +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hashbrown" version = "0.14.5" @@ -1621,7 +1639,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" dependencies = [ - "hashbrown", + "hashbrown 0.14.5", ] [[package]] @@ -1651,6 +1669,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + [[package]] name = "hmac" version = "0.12.1" @@ -1825,6 +1849,17 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg 1.3.0", + "hashbrown 0.12.3", + "serde", +] + [[package]] name = "indexmap" version = "2.5.0" @@ -1832,7 +1867,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.14.5", + "serde", ] [[package]] @@ -1878,7 +1914,6 @@ dependencies = [ "clap 4.5.16", "cpal", "dirs", - "ecoji", "ed25519-dalek", "fern", "insanity-core", @@ -2364,6 +2399,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-derive" version = "0.3.3" @@ -2756,6 +2797,12 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.20" @@ -3352,6 +3399,36 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_with" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" +dependencies = [ + "base64", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.5.0", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" +dependencies = [ + "darling 0.20.10", + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "sha1" version = "0.10.6" @@ -3708,6 +3785,37 @@ dependencies = [ "once_cell", ] +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -3784,7 +3892,7 @@ dependencies = [ "futures-io", "futures-sink", "futures-util", - "hashbrown", + "hashbrown 0.14.5", "pin-project-lite", "slab", "tokio", @@ -3802,7 +3910,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap", + "indexmap 2.5.0", "toml_datetime", "winnow", ] diff --git a/insanity-native-tui-app/Cargo.toml b/insanity-native-tui-app/Cargo.toml index 1363514..1506435 100644 --- a/insanity-native-tui-app/Cargo.toml +++ b/insanity-native-tui-app/Cargo.toml @@ -43,4 +43,3 @@ argon2 = "0.5.3" chacha20poly1305 = "0.10.1" blake3 = "1.5.4" ed25519-dalek = { version = "2.1.1", features = ["serde"] } -ecoji = "1.0.0" diff --git a/insanity-native-tui-app/src/room_handler.rs b/insanity-native-tui-app/src/room_handler.rs index 55cbd27..cbc8d54 100644 --- a/insanity-native-tui-app/src/room_handler.rs +++ b/insanity-native-tui-app/src/room_handler.rs @@ -6,6 +6,7 @@ use tokio_util::sync::CancellationToken; use crate::connection_manager::AugmentedInfo; use baybridge::client::Actions; +use baybridge::models::Value; use chacha20poly1305::{ aead::{Aead, AeadCore, KeyInit, OsRng}, @@ -61,9 +62,8 @@ async fn action_set( }; // Set to key - let mut serialized_signed_value: &[u8] = &bincode::serialize(&signed_value)?; - let encoded_signed_value = ecoji::encode_to_string(&mut serialized_signed_value)?; - if let Err(e) = action.set(key, encoded_signed_value).await { + let serialized_signed_value: Vec = bincode::serialize(&signed_value)?; + if let Err(e) = action.set(key, serialized_signed_value.into()).await { anyhow::bail!("Failed to set value to baybridge with error: {e}"); } @@ -97,11 +97,10 @@ async fn set_own_info( fn verify_and_decrypt( cipher: &ChaCha20Poly1305, verifying_key: &VerifyingKey, - info: String, + info: Value, ) -> anyhow::Result { // Deserialize to SignedValue - let serialized_signed_value = ecoji::decode_to_vec(&mut info.as_bytes())?; - let signed_value: SignedValue = bincode::deserialize(&serialized_signed_value)?; + let signed_value: SignedValue = bincode::deserialize(info.as_bytes())?; // Verify signature verifying_key.verify_strict(&signed_value.msg, &signed_value.signature)?;