diff --git a/Cargo.toml b/Cargo.toml index 0bc5cb3..8964de8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,19 +6,26 @@ edition = "2021" [lib] crate-type = ["cdylib", "rlib"] +[features] +default = ["sp_client/blindbit-backend"] +wasm = ["dep:js-sys", "dep:serde-wasm-bindgen", "sp_client/wasm"] + [dependencies] aes-gcm = "0.10.3" anyhow = "1.0" -js-sys = "0.3.69" env_logger = "0.9" log = "0.4.6" rand = "0.8.5" serde = { version = "1.0.193", features = ["derive"] } serde_json = { version = "1.0.108" } -serde-wasm-bindgen = "0.6.5" -# sp_client = { path = "../sp-client", features = ["blindbit-backend"] } -sp_client = { git = "https://github.com/Sosthene00/sp-client.git", branch = "4nk" ,features = ["blindbit-backend"]} -tsify = { git = "https://github.com/Sosthene00/tsify", branch = "next" } -wasm-bindgen = "0.2.91" rs_merkle = "1.4.2" zstd = "0.13.3" +getrandom = { version = "0.2", features = ["js"] } +sp_client = { git = "https://github.com/Sosthene00/sp-client.git", branch = "4nk", default-features = false } +tsify = { git = "https://github.com/Sosthene00/tsify", branch = "next" } +wasm-bindgen = "0.2.91" + +# WASM-specific dependencies (optional) +js-sys = { version = "0.3.69", optional = true } +serde-wasm-bindgen = { version = "0.6.5", optional = true } + diff --git a/src/lib.rs b/src/lib.rs index 5660264..fa3bf2d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,17 +4,20 @@ use std::sync::{Mutex, MutexGuard}; pub use aes_gcm; pub use env_logger; -pub use js_sys; pub use log; pub use rand; pub use serde; pub use serde_json; -pub use serde_wasm_bindgen; pub use sp_client; pub use tsify; pub use wasm_bindgen; pub use zstd; +#[cfg(feature = "wasm")] +pub use js_sys; +#[cfg(feature = "wasm")] +pub use serde_wasm_bindgen; + pub mod crypto; pub mod device; pub mod error;