Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ jobs:
llvm-ar-18 --version | head -n1

- name: Run WASM compile check
run: cargo check -p walletkit --features embed-zkeys --target wasm32-unknown-unknown
run: |
cargo check -p walletkit --features embed-zkeys --locked --target wasm32-unknown-unknown
git diff --exit-code -- Cargo.lock

# Keep this version aligned with the wasm-bindgen version in Cargo.lock.
- name: Install WASM browser test runner
Expand All @@ -119,7 +121,17 @@ jobs:
- name: Test walletkit-sqlite in a browser runner
run: |
CHROMEDRIVER="$CHROMEWEBDRIVER/chromedriver" \
cargo test -p walletkit-sqlite --target wasm32-unknown-unknown
cargo test -p walletkit-sqlite --locked --target wasm32-unknown-unknown

- name: Build JavaScript and WASM package
run: bash web/build.sh

- name: Test browser package in Chromium and WebKit
working-directory: web
run: |
npm ci
npx playwright install --with-deps chromium webkit
npm test

swift-build:
name: Build Swift
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
target/
/target-web/
.DS_Store
**/ios_build
.swiftpm/
Expand Down
46 changes: 35 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ members = [
"crates/uniffi-bindgen",
"crates/walletkit-core",
"crates/walletkit",
"crates/walletkit-web",
"crates/walletkit-db",
"crates/walletkit-sqlite",
"crates/walletkit-cli",
Expand Down Expand Up @@ -41,9 +42,9 @@ clap = "4"
ctor = "0.2"
dirs = "6"
dotenvy = "0.15.7"
flamingo-verifier-client = "0.3.0"
flamingo-verifier-protocol = "0.3.0"
flamingo-verifier-sealed-types = "0.3.0"
flamingo-verifier-client = { version = "0.3.0", git = "https://github.com/worldcoin/flamingo", rev = "3fc9028493359476aea6a871a95cd05951bc6513" }
flamingo-verifier-protocol = { version = "0.3.0", git = "https://github.com/worldcoin/flamingo", rev = "3fc9028493359476aea6a871a95cd05951bc6513" }
flamingo-verifier-sealed-types = { version = "0.3.0", git = "https://github.com/worldcoin/flamingo", rev = "3fc9028493359476aea6a871a95cd05951bc6513" }
eyre = "0.6"
getrandom = "0.3"
hex = "0.4"
Expand Down
8 changes: 4 additions & 4 deletions crates/walletkit-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ crate-type = ["lib", "staticlib", "cdylib"]
name = "walletkit_core"

[dependencies]
async-trait = { workspace = true }
alloy-core = { workspace = true }
backon = { workspace = true }
base64 = { workspace = true }
ciborium = { workspace = true }
hex = { workspace = true }
flamingo-verifier-client = { workspace = true }
flamingo-verifier-protocol = { workspace = true }
flamingo-verifier-sealed-types = { workspace = true }
hkdf = { workspace = true }
log = { workspace = true }
rand = { workspace = true }
Expand Down Expand Up @@ -57,11 +61,7 @@ getrandom = { workspace = true, features = ["wasm_js"] }

# Native-only dependencies (not available on wasm32)
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
async-trait = { workspace = true }
ctor = { workspace = true }
flamingo-verifier-client = { workspace = true }
flamingo-verifier-protocol = { workspace = true }
flamingo-verifier-sealed-types = { workspace = true }
reqwest = { workspace = true, features = ["brotli", "rustls-tls"] }
rustls = { workspace = true, features = ["ring"] }

Expand Down
8 changes: 5 additions & 3 deletions crates/walletkit-core/src/flamingo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ pub enum FlamingoError {
Verifier(String),
}

#[async_trait]
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
trait MatchClient: Sync {
type Assignment: Send + Sync;

Expand Down Expand Up @@ -297,7 +298,8 @@ impl From<FailureReason> for FlamingoMatchRejection {
}
}

#[async_trait]
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
impl MatchClient for FlamingoVerifierClient {
type Assignment = VerifiedAssignment;

Expand Down Expand Up @@ -404,7 +406,7 @@ fn verifier_error(error: &ClientError) -> FlamingoError {
FlamingoError::Verifier(error.to_string())
}

#[cfg(test)]
#[cfg(all(test, not(target_arch = "wasm32")))]
mod tests {
use std::{
collections::{HashMap, VecDeque},
Expand Down
1 change: 0 additions & 1 deletion crates/walletkit-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ pub enum Region {
}

/// Attested Flamingo matching in preparation for zero-knowledge proof generation.
#[cfg(not(target_arch = "wasm32"))]
pub mod flamingo;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Route supported WASM builds through the dependency patches

When invoking the supported nix/build-wasm.sh or the WASM-shell command documented in nix/README.md, this newly ungated module selects the published Flamingo/Pontifex crates, while their required WASM RNG and clock support exists only in the temporary patches supplied by web/cargo.sh. Neither supported entry point bootstraps or applies those patches, so a fresh checkout's standard WalletKit WASM build now fails; route all documented WASM builds through the bootstrap/wrapper or make the patched dependencies part of the normal dependency setup.

AGENTS.md reference: AGENTS.md:L5-L7

Useful? React with 👍 / 👎.


/// Contains error outputs from `WalletKit`
Expand Down
27 changes: 27 additions & 0 deletions crates/walletkit-web/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[package]
name = "walletkit-web"
description = "Browser bindings for WalletKit's attested Flamingo client."
publish = false
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true

[lib]
crate-type = ["cdylib", "rlib"]

[dependencies]
walletkit-core = { workspace = true, default-features = false }
hex = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_bytes = "0.11"
serde-wasm-bindgen = "0.6"
wasm-bindgen = "=0.2.126"
wasm-bindgen-futures = "=0.4.76"
js-sys = "=0.3.103"

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = { workspace = true }

[lints]
workspace = true
Loading
Loading