diff --git a/Cargo.lock b/Cargo.lock index 032cf8372b..410204697e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5720,6 +5720,7 @@ dependencies = [ "clap", "comfy-table", "futures", + "getrandom 0.3.3", "gloo-timers", "http-body-util", "humantime", @@ -6227,10 +6228,8 @@ dependencies = [ "libcrux-psq", "nym-pemstore", "nym-sphinx-types", - "nym-test-utils", "rand 0.8.5", "rand 0.9.2", - "rand_chacha 0.3.1", "serde", "serde_bytes", "serde_json", @@ -7499,12 +7498,7 @@ dependencies = [ "blake3", "chacha20", "chacha20poly1305", - "criterion", "fastrand", - "getrandom 0.2.16", - "log", - "rand 0.8.5", - "rayon", "sphinx-packet", "thiserror 2.0.12", "x25519-dalek", @@ -8313,7 +8307,6 @@ name = "nym-vpn-api-lib-wasm" version = "1.20.4" dependencies = [ "bs58", - "getrandom 0.2.16", "js-sys", "nym-bin-common", "nym-compact-ecash", @@ -8392,9 +8385,7 @@ name = "nym-wasm-storage" version = "1.20.4" dependencies = [ "async-trait", - "getrandom 0.2.16", "indexed_db_futures", - "js-sys", "nym-store-cipher", "nym-wasm-utils", "serde", @@ -14157,22 +14148,14 @@ dependencies = [ name = "zknym-lib" version = "1.20.4" dependencies = [ - "anyhow", "async-trait", - "bs58", - "getrandom 0.2.16", "js-sys", "nym-bin-common", "nym-compact-ecash", - "nym-credentials", - "nym-crypto", "nym-http-api-client", "nym-wasm-utils", - "rand 0.8.5", - "reqwest 0.13.1", "serde", "thiserror 2.0.12", - "tokio", "tsify", "uuid", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index 7b6cc5fa46..f3f06dd1c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -276,6 +276,7 @@ futures = "0.3.31" futures-util = "0.3" generic-array = "0.14.7" getrandom = "0.2.10" +getrandom03 = { package = "getrandom", version = "=0.3.3" } glob = "0.3" handlebars = "3.5.5" hex = "0.4.3" diff --git a/common/client-core/Cargo.toml b/common/client-core/Cargo.toml index 77cdf19c98..c6275532e6 100644 --- a/common/client-core/Cargo.toml +++ b/common/client-core/Cargo.toml @@ -121,6 +121,10 @@ features = ["wasm-bindgen"] workspace = true features = ["full"] +[target."cfg(target_arch = \"wasm32\")".dependencies.getrandom03] +workspace = true +features = ["wasm_js"] + [dev-dependencies] tempfile = { workspace = true } diff --git a/common/client-core/src/client/helpers/wasm.rs b/common/client-core/src/client/helpers/wasm.rs index 59f1ec9e75..ef04028396 100644 --- a/common/client-core/src/client/helpers/wasm.rs +++ b/common/client-core/src/client/helpers/wasm.rs @@ -15,3 +15,13 @@ pub(crate) fn get_time_now() -> Instant { pub(crate) fn new_interval_stream(polling_rate: Duration) -> IntervalStream { gloo_timers::future::IntervalStream::new(polling_rate.as_millis() as u32) } + +#[unsafe(no_mangle)] +unsafe extern "Rust" fn __getrandom_v03_custom( + dest: *mut u8, + len: usize, +) -> Result<(), getrandom03::Error> { + let _ = dest; + let _ = len; + Err(getrandom03::Error::UNSUPPORTED) +} diff --git a/common/crypto/Cargo.toml b/common/crypto/Cargo.toml index fca95f0d50..7702c6463b 100644 --- a/common/crypto/Cargo.toml +++ b/common/crypto/Cargo.toml @@ -27,7 +27,7 @@ cipher = { workspace = true, optional = true } x25519-dalek = { workspace = true, features = ["static_secrets"], optional = true } ed25519-dalek = { workspace = true, features = ["rand_core"], optional = true } rand = { workspace = true, optional = true } -rand09 = { workspace = true } +rand09 = { workspace = true, optional = true } serde_bytes = { workspace = true, optional = true } serde = { workspace = true, features = ["derive"], optional = true } sha2 = { workspace = true, optional = true } @@ -41,9 +41,7 @@ nym-pemstore = { workspace = true } [dev-dependencies] anyhow = { workspace = true } -rand_chacha = { workspace = true } serde_json = { workspace = true } -nym-test-utils = { workspace = true } [features] @@ -53,7 +51,7 @@ naive_jwt = ["asymmetric", "jwt-simple"] libcrux_x25519 = ["libcrux-psq", "libcrux-curve25519"] serde = ["dep:serde", "serde_bytes", "ed25519-dalek/serde", "x25519-dalek/serde"] asymmetric = ["x25519-dalek", "ed25519-dalek", "curve25519-dalek", "sha2", "zeroize"] -hashing = ["blake3", "digest", "hkdf", "hmac", "generic-array", "sha2", "zeroize"] +hashing = ["blake3", "digest", "hkdf", "hmac", "generic-array", "sha2", "zeroize", "rand09"] stream_cipher = ["aes", "ctr", "cipher", "generic-array"] sphinx = ["nym-sphinx-types", "nym-sphinx-types/sphinx"] diff --git a/common/store-cipher/Cargo.toml b/common/store-cipher/Cargo.toml index 124d5b1869..a2066a5247 100644 --- a/common/store-cipher/Cargo.toml +++ b/common/store-cipher/Cargo.toml @@ -21,7 +21,7 @@ thiserror = { workspace = true } zeroize = { workspace = true, features = ["zeroize_derive"] } [target.'cfg(target_env = "wasm32-unknown-unknown")'.dependencies] -getrandom = { version = "0.2", features = ["js"] } +getrandom = { workspace = true, features = ["js"] } [features] default = [] diff --git a/common/wasm/client-core/.cargo/config.toml b/common/wasm/client-core/.cargo/config.toml index bdbe517658..e9c3438b6e 100644 --- a/common/wasm/client-core/.cargo/config.toml +++ b/common/wasm/client-core/.cargo/config.toml @@ -1,3 +1,4 @@ [build] target = "wasm32-unknown-unknown" target_arch = "wasm32" +rustflags = ["--cfg=getrandom_backend=\"wasm_js\""] \ No newline at end of file diff --git a/common/wasm/storage/.cargo/config.toml b/common/wasm/storage/.cargo/config.toml index bdbe517658..e9c3438b6e 100644 --- a/common/wasm/storage/.cargo/config.toml +++ b/common/wasm/storage/.cargo/config.toml @@ -1,3 +1,4 @@ [build] target = "wasm32-unknown-unknown" target_arch = "wasm32" +rustflags = ["--cfg=getrandom_backend=\"wasm_js\""] \ No newline at end of file diff --git a/common/wasm/storage/Cargo.toml b/common/wasm/storage/Cargo.toml index 884a7b89b6..7c07592da2 100644 --- a/common/wasm/storage/Cargo.toml +++ b/common/wasm/storage/Cargo.toml @@ -13,8 +13,6 @@ documentation.workspace = true [dependencies] async-trait = { workspace = true } -getrandom = { workspace = true, features = ["js"] } -js-sys = { workspace = true } wasm-bindgen = { workspace = true } serde = { workspace = true, features = ["derive"] } serde-wasm-bindgen = { workspace = true } diff --git a/common/wasm/utils/.cargo/config.toml b/common/wasm/utils/.cargo/config.toml index bdbe517658..e9c3438b6e 100644 --- a/common/wasm/utils/.cargo/config.toml +++ b/common/wasm/utils/.cargo/config.toml @@ -1,3 +1,4 @@ [build] target = "wasm32-unknown-unknown" target_arch = "wasm32" +rustflags = ["--cfg=getrandom_backend=\"wasm_js\""] \ No newline at end of file diff --git a/nym-credential-proxy/vpn-api-lib-wasm/Cargo.toml b/nym-credential-proxy/vpn-api-lib-wasm/Cargo.toml index 52baabd2cb..d6b2666b65 100644 --- a/nym-credential-proxy/vpn-api-lib-wasm/Cargo.toml +++ b/nym-credential-proxy/vpn-api-lib-wasm/Cargo.toml @@ -21,7 +21,6 @@ thiserror.workspace = true zeroize = { workspace = true } # wasm-specific deps -getrandom = { workspace = true, features = ["js"] } wasm-bindgen = { workspace = true } js-sys = { workspace = true } tsify = { workspace = true, features = ["js"] } diff --git a/nym-outfox/Cargo.toml b/nym-outfox/Cargo.toml index 8d7855bc48..d3ea59291d 100644 --- a/nym-outfox/Cargo.toml +++ b/nym-outfox/Cargo.toml @@ -10,18 +10,13 @@ repository = { workspace = true } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rayon = { workspace = true } blake3 = { workspace = true } zeroize = { workspace = true } chacha20 = { workspace = true, features = ["std"] } x25519-dalek = { workspace = true } chacha20poly1305 = { workspace = true } -getrandom = { workspace = true, features = ["js"] } thiserror = { workspace = true } sphinx-packet = { workspace = true } -rand = { workspace = true } -log = { workspace = true } [dev-dependencies] -criterion = { workspace = true } fastrand = { workspace = true } diff --git a/nym-wallet/Cargo.lock b/nym-wallet/Cargo.lock index 57510e57fb..4dc0809176 100644 --- a/nym-wallet/Cargo.lock +++ b/nym-wallet/Cargo.lock @@ -2611,15 +2611,15 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ "cfg-if", "js-sys", "libc", "r-efi", - "wasi 0.14.2+wasi-0.2.4", + "wasi 0.14.7+wasi-0.2.4", "wasm-bindgen", ] @@ -3706,7 +3706,7 @@ version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" dependencies = [ - "getrandom 0.3.2", + "getrandom 0.3.3", "libc", ] @@ -4641,7 +4641,6 @@ dependencies = [ "libcrux-psq", "nym-pemstore", "rand 0.8.5", - "rand 0.9.2", "serde", "serde_bytes", "sha2 0.10.9", @@ -6119,7 +6118,7 @@ checksum = "b820744eb4dc9b57a3398183639c511b5a26d2ed702cedd3febaa1393caa22cc" dependencies = [ "aws-lc-rs", "bytes", - "getrandom 0.3.2", + "getrandom 0.3.3", "rand 0.9.2", "ring", "rustc-hash", @@ -6250,7 +6249,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ - "getrandom 0.3.2", + "getrandom 0.3.3", ] [[package]] @@ -7949,7 +7948,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" dependencies = [ "fastrand", - "getrandom 0.3.2", + "getrandom 0.3.3", "once_cell", "rustix 1.0.5", "windows-sys 0.59.0", @@ -8730,7 +8729,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" dependencies = [ - "getrandom 0.3.2", + "getrandom 0.3.3", "serde", ] @@ -8826,11 +8825,20 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi" -version = "0.14.2+wasi-0.2.4" +version = "0.14.7+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c" dependencies = [ - "wit-bindgen-rt", + "wasip2", +] + +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", ] [[package]] @@ -9740,13 +9748,10 @@ dependencies = [ ] [[package]] -name = "wit-bindgen-rt" -version = "0.39.0" +name = "wit-bindgen" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" -dependencies = [ - "bitflags 2.9.0", -] +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" [[package]] name = "wl-clipboard-rs" diff --git a/wasm/client/.cargo/config.toml b/wasm/client/.cargo/config.toml index a7f24f6737..f506045a7f 100644 --- a/wasm/client/.cargo/config.toml +++ b/wasm/client/.cargo/config.toml @@ -1,6 +1,8 @@ [build] target = "wasm32-unknown-unknown" target_arch = "wasm32" +rustflags = ["--cfg=getrandom_backend=\"wasm_js\""] + [target.wasm32-unknown-unknown] runner = 'wasm-bindgen-test-runner' \ No newline at end of file diff --git a/wasm/client/Cargo.toml b/wasm/client/Cargo.toml index 3bc15e7ade..2377ddcb6d 100644 --- a/wasm/client/Cargo.toml +++ b/wasm/client/Cargo.toml @@ -44,6 +44,7 @@ nym-node-tester-wasm = { path = "../node-tester", optional = true } tokio_with_wasm = { workspace = true, features = ["full"] } + [dev-dependencies] wasm-bindgen-test = { workspace = true } diff --git a/wasm/full-nym-wasm/.cargo/config.toml b/wasm/full-nym-wasm/.cargo/config.toml index bdbe517658..e9c3438b6e 100644 --- a/wasm/full-nym-wasm/.cargo/config.toml +++ b/wasm/full-nym-wasm/.cargo/config.toml @@ -1,3 +1,4 @@ [build] target = "wasm32-unknown-unknown" target_arch = "wasm32" +rustflags = ["--cfg=getrandom_backend=\"wasm_js\""] \ No newline at end of file diff --git a/wasm/mix-fetch/.cargo/config.toml b/wasm/mix-fetch/.cargo/config.toml index bdbe517658..e9c3438b6e 100644 --- a/wasm/mix-fetch/.cargo/config.toml +++ b/wasm/mix-fetch/.cargo/config.toml @@ -1,3 +1,4 @@ [build] target = "wasm32-unknown-unknown" target_arch = "wasm32" +rustflags = ["--cfg=getrandom_backend=\"wasm_js\""] \ No newline at end of file diff --git a/wasm/node-tester/.cargo/config.toml b/wasm/node-tester/.cargo/config.toml index bdbe517658..e9c3438b6e 100644 --- a/wasm/node-tester/.cargo/config.toml +++ b/wasm/node-tester/.cargo/config.toml @@ -1,3 +1,4 @@ [build] target = "wasm32-unknown-unknown" target_arch = "wasm32" +rustflags = ["--cfg=getrandom_backend=\"wasm_js\""] \ No newline at end of file diff --git a/wasm/zknym-lib/.cargo/config.toml b/wasm/zknym-lib/.cargo/config.toml index bdbe517658..e9c3438b6e 100644 --- a/wasm/zknym-lib/.cargo/config.toml +++ b/wasm/zknym-lib/.cargo/config.toml @@ -1,3 +1,4 @@ [build] target = "wasm32-unknown-unknown" target_arch = "wasm32" +rustflags = ["--cfg=getrandom_backend=\"wasm_js\""] \ No newline at end of file diff --git a/wasm/zknym-lib/Cargo.toml b/wasm/zknym-lib/Cargo.toml index b9d086535e..385ed467f1 100644 --- a/wasm/zknym-lib/Cargo.toml +++ b/wasm/zknym-lib/Cargo.toml @@ -16,31 +16,21 @@ crate-type = ["cdylib", "rlib"] [dependencies] async-trait.workspace = true -bs58.workspace = true -getrandom = { workspace = true, features = ["js"] } js-sys.workspace = true wasm-bindgen.workspace = true serde = { workspace = true, features = ["derive"] } thiserror.workspace = true tsify = { workspace = true, features = ["js"] } uuid = { workspace = true, features = ["serde"] } -reqwest = { workspace = true } wasmtimer = { workspace = true } zeroize.workspace = true -rand = { workspace = true } - - nym-bin-common = { workspace = true } nym-compact-ecash = { workspace = true } -nym-credentials = { workspace = true } -nym-crypto = { workspace = true, features = ["asymmetric", "rand"] } nym-http-api-client = { workspace = true } nym-wasm-utils = { workspace = true } [dev-dependencies] -anyhow = { workspace = true } -tokio = { workspace = true, features = ["full"] } [package.metadata.wasm-pack.profile.release]