diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5486b01aa..9fb3cf843e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,6 +73,22 @@ jobs: RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG' }} + wasm_build: + name: Build wasm32 + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Install stable toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Add wasm target + run: rustup target add wasm32-unknown-unknown + + - name: wasm32 build (iroh-base) + run: cargo build -p iroh-base --all-features --target wasm32-unknown-unknown + check_semver: runs-on: ubuntu-latest env: diff --git a/Cargo.lock b/Cargo.lock index 1ff4dfda21..1a7774d317 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2443,12 +2443,13 @@ version = "0.16.0" dependencies = [ "aead", "anyhow", - "bao-tree", "crypto_box", "data-encoding", "derive_more", "ed25519-dalek", + "getrandom", "hex", + "iroh-blake3", "iroh-test", "once_cell", "postcard", diff --git a/iroh-base/Cargo.toml b/iroh-base/Cargo.toml index 2ff93311e3..f21488401c 100644 --- a/iroh-base/Cargo.toml +++ b/iroh-base/Cargo.toml @@ -16,7 +16,7 @@ workspace = true [dependencies] anyhow = { version = "1" } -bao-tree = { version = "0.13", features = ["tokio_fsm", "validate"], default-features = false, optional = true } +blake3 = { version = "1.4.5", package = "iroh-blake3", optional = true } data-encoding = { version = "2.3.3", optional = true } hex = "0.4.3" postcard = { version = "1", default-features = false, features = ["alloc", "use-std", "experimental-derive"], optional = true } @@ -37,6 +37,8 @@ ttl_cache = { version = "0.5.1", optional = true } crypto_box = { version = "0.9.1", features = ["serde", "chacha20"], optional = true } zeroize = { version = "1.5", optional = true } url = { version = "2.5.0", features = ["serde"], optional = true } +# wasm +getrandom = { version = "0.2", default-features = false, optional = true } [dev-dependencies] iroh-test = { path = "../iroh-test" } @@ -46,10 +48,11 @@ serde_test = "1.0.176" [features] default = ["hash", "base32"] -hash = ["dep:bao-tree", "dep:data-encoding", "dep:postcard", "dep:derive_more"] -base32 = ["dep:data-encoding"] +hash = ["dep:blake3", "dep:data-encoding", "dep:postcard", "dep:derive_more", "base32"] +base32 = ["dep:data-encoding", "dep:postcard"] redb = ["dep:redb"] -key = ["dep:ed25519-dalek", "dep:once_cell", "dep:rand", "dep:rand_core", "dep:ssh-key", "dep:ttl_cache", "dep:aead", "dep:crypto_box", "dep:zeroize", "dep:url", "dep:derive_more"] +key = ["dep:ed25519-dalek", "dep:once_cell", "dep:rand", "dep:rand_core", "dep:ssh-key", "dep:ttl_cache", "dep:aead", "dep:crypto_box", "dep:zeroize", "dep:url", "dep:derive_more", "dep:getrandom"] +wasm = ["getrandom?/js"] [package.metadata.docs.rs] all-features = true diff --git a/iroh-base/src/hash.rs b/iroh-base/src/hash.rs index e1d73716ec..3574f6c1e2 100644 --- a/iroh-base/src/hash.rs +++ b/iroh-base/src/hash.rs @@ -3,7 +3,6 @@ use std::str::FromStr; use std::{borrow::Borrow, fmt}; -use bao_tree::blake3; use postcard::experimental::max_size::MaxSize; use serde::{de, Deserialize, Deserializer, Serialize, Serializer};