From 21835d400c6db91efa44feb2a05aee88fcfb26d3 Mon Sep 17 00:00:00 2001 From: nikoPLP Date: Mon, 6 Mar 2023 05:57:19 +0200 Subject: [PATCH] remove dependency to openssl, prepare for wasm target --- Cargo.lock | 161 ++++-------------------------------------- ng-app-js/Cargo.toml | 6 ++ ng-app-js/src/lib.rs | 2 + ngcli/Cargo.toml | 2 +- p2p-broker/Cargo.toml | 6 +- p2p-client/Cargo.toml | 2 +- p2p-repo/Cargo.toml | 2 +- 7 files changed, 29 insertions(+), 152 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e38a92a..6aa0a8f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -125,18 +125,6 @@ dependencies = [ "futures-lite", ] -[[package]] -name = "async-native-tls" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d57d4cec3c647232e1094dc013546c0b33ce785d8aeb251e1f20dfaf8a9a13fe" -dependencies = [ - "futures-util", - "native-tls", - "thiserror", - "url", -] - [[package]] name = "async-oneshot" version = "0.5.0" @@ -196,7 +184,6 @@ version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1b71b31561643aa8e7df3effe284fa83ab1a840e52294c5f4bd7bfd8b2becbb" dependencies = [ - "async-native-tls", "async-std", "futures-io", "futures-util", @@ -362,22 +349,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3ad85c1f65dc7b37604eb0e89748faf0b9653065f2a8ef69f96a687ec1e9279" -[[package]] -name = "core-foundation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" - [[package]] name = "cpufeatures" version = "0.2.5" @@ -536,13 +507,14 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "fastbloom-rs" -version = "0.3.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b67402145d0427ea3637c28fcdba7291aba2cdf88d51a316b685dcf41b8ab8" +checksum = "f04c5562065adb6d23e97f342cb73a73ed94ebfdb8d96a92a85d6fb93f1cdfed" dependencies = [ "cuckoofilter", "fastmurmur3", "xorfilter-rs", + "xxhash-rust", ] [[package]] @@ -566,21 +538,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.1.0" @@ -731,8 +688,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -928,28 +887,12 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "ng-app-js-sdk" version = "0.1.0" dependencies = [ + "getrandom 0.2.8", + "p2p-client", "wasm-bindgen", ] @@ -1023,51 +966,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "openssl" -version = "0.10.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" -dependencies = [ - "autocfg", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "ordered-float" version = "3.4.0" @@ -1453,44 +1351,12 @@ dependencies = [ "windows-sys 0.45.0", ] -[[package]] -name = "schannel" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" -dependencies = [ - "windows-sys 0.42.0", -] - [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "security-framework" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a2ac85147a3a11d77ecf1bc7166ec0b92febfa4461c37944e180f319ece467" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "serde" version = "1.0.142" @@ -1696,7 +1562,6 @@ dependencies = [ "http", "httparse", "log", - "native-tls", "rand 0.8.5", "sha-1", "thiserror", @@ -1770,12 +1635,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.4" @@ -2039,6 +1898,12 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47f9da296a88b6bc150b896d17770a62d4dc6f63ecf0ed10a9c08a1cb3d12f24" +[[package]] +name = "xxhash-rust" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735a71d46c4d68d71d4b24d03fdc2b98e38cea81730595801db779c04fe80d70" + [[package]] name = "zeroize" version = "1.3.0" diff --git a/ng-app-js/Cargo.toml b/ng-app-js/Cargo.toml index deee699..2aa555e 100644 --- a/ng-app-js/Cargo.toml +++ b/ng-app-js/Cargo.toml @@ -15,3 +15,9 @@ crate-type = ["cdylib"] [dependencies] wasm-bindgen = "0.2" +getrandom = "0.2.7" +p2p-client = { path = "../p2p-client" } + +[target.'cfg(target_arch = "wasm32")'.dependencies.getrandom] +version = "0.2.7" +features = ["js"] \ No newline at end of file diff --git a/ng-app-js/src/lib.rs b/ng-app-js/src/lib.rs index 4570879..86632c0 100644 --- a/ng-app-js/src/lib.rs +++ b/ng-app-js/src/lib.rs @@ -12,5 +12,7 @@ pub fn greet(name: &str) { #[wasm_bindgen] pub fn change(name: &str) -> JsValue { + let mut random_buf = [0u8; 32]; + getrandom::getrandom(&mut random_buf).unwrap(); JsValue::from_str(&format!("Hellooo, {}!", name)) } diff --git a/ngcli/Cargo.toml b/ngcli/Cargo.toml index 279d061..2ceca7f 100644 --- a/ngcli/Cargo.toml +++ b/ngcli/Cargo.toml @@ -18,7 +18,7 @@ async-std = { version = "1.7.0", features = ["attributes"] } futures = "0.3.24" xactor = "0.7.11" tempfile = "3" -fastbloom-rs = "0.3.1" +fastbloom-rs = "0.5.3" rand = "0.7" ed25519-dalek = "1.0.1" assert_cmd = "2.0.5" diff --git a/p2p-broker/Cargo.toml b/p2p-broker/Cargo.toml index e9ba3c5..ccf5bc6 100644 --- a/p2p-broker/Cargo.toml +++ b/p2p-broker/Cargo.toml @@ -24,4 +24,8 @@ async-channel = "1.7.1" tempfile = "3" hex = "0.4.3" async-trait = "0.1.57" -async-tungstenite = { version = "0.17.2", features = ["async-std-runtime","async-native-tls"] } \ No newline at end of file +async-tungstenite = { version = "0.17.2", features = ["async-std-runtime"] } + +[target.'cfg(target_arch = "wasm32")'.dependencies.getrandom] +version = "0.2.7" +features = ["js"] \ No newline at end of file diff --git a/p2p-client/Cargo.toml b/p2p-client/Cargo.toml index bea53cd..a201cbd 100644 --- a/p2p-client/Cargo.toml +++ b/p2p-client/Cargo.toml @@ -21,4 +21,4 @@ async-std = { version = "1.7.0", features = ["attributes"] } futures = "0.3.24" async-channel = "1.7.1" async-oneshot = "0.5.0" -async-tungstenite = { version = "0.17.2", features = ["async-std-runtime","async-native-tls"] } \ No newline at end of file +async-tungstenite = { version = "0.17.2", features = ["async-std-runtime"] } \ No newline at end of file diff --git a/p2p-repo/Cargo.toml b/p2p-repo/Cargo.toml index eaa6552..4d9625c 100644 --- a/p2p-repo/Cargo.toml +++ b/p2p-repo/Cargo.toml @@ -15,6 +15,6 @@ rand = "0.7" serde = { version = "1.0.142", features = ["derive"] } serde_bare = "0.5.0" serde_bytes = "0.11.7" -fastbloom-rs = "0.3.1" +fastbloom-rs = "0.5.3" debug_print = "1.0.0" hex = "0.4.3"