diff --git a/crates/tlsn/Cargo.toml b/crates/tlsn/Cargo.toml index 5efe1d029..b240edf8d 100644 --- a/crates/tlsn/Cargo.toml +++ b/crates/tlsn/Cargo.toml @@ -14,6 +14,7 @@ workspace = true default = ["rayon"] rayon = ["mpz-common/rayon"] force-st = ["mpz-common/force-st"] +web = ["dep:web-spawn"] [dependencies] tlsn-attestation = { workspace = true } @@ -27,7 +28,7 @@ tlsn-cipher = { workspace = true } serio = { workspace = true, features = ["compat"] } uid-mux = { workspace = true, features = ["serio"] } -web-spawn = { workspace = true } +web-spawn = { workspace = true, optional = true } mpz-common = { workspace = true } mpz-core = { workspace = true } diff --git a/crates/tlsn/src/context.rs b/crates/tlsn/src/context.rs index 3716d3239..9a587b344 100644 --- a/crates/tlsn/src/context.rs +++ b/crates/tlsn/src/context.rs @@ -11,7 +11,7 @@ pub(crate) const MAX_CONCURRENCY: usize = 8; pub(crate) fn build_mt_context(mux: MuxControl) -> Multithread { let builder = Multithread::builder().mux(mux).concurrency(MAX_CONCURRENCY); - #[cfg(target_arch = "wasm32")] + #[cfg(all(feature = "web", target_arch = "wasm32"))] let builder = builder.spawn_handler(|f| { let _ = web_spawn::spawn(f); Ok(()) diff --git a/crates/wasm/Cargo.toml b/crates/wasm/Cargo.toml index 36f384887..756fd0446 100644 --- a/crates/wasm/Cargo.toml +++ b/crates/wasm/Cargo.toml @@ -24,7 +24,7 @@ no-bundler = ["web-spawn/no-bundler"] [dependencies] tlsn-core = { workspace = true } -tlsn = { workspace = true } +tlsn = { workspace = true, features = ["web"] } tlsn-server-fixture-certs = { workspace = true } tlsn-tls-client-async = { workspace = true } tlsn-tls-core = { workspace = true }