From f3db1e87818b008f7f6549207b2d89f5cd8cf7a2 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 14 Nov 2026 20:41:19 +0000 Subject: [PATCH 1/2] Make the WASM package build for Node. Enable getrandom 0.4 wasm_js so the locked graph compiles to wasm32, and add a nodejs wasm-pack script next to the bundler target. --- README.md | 3 +++ bindings/ts/package.json | 1 + crates/encryptoglyph/Cargo.lock | 3 +++ crates/encryptoglyph/Cargo.toml | 6 ++++++ 4 files changed, 13 insertions(+) diff --git a/README.md b/README.md index c2eebbd..1cebd81 100644 --- a/README.md +++ b/README.md @@ -173,6 +173,9 @@ pytest cd bindings/ts npm run build:wasm npm run build +# Node services use the CommonJS package instead of the bundler target: +npm run build:wasm:node +node vector-test.cjs pkg-node ``` ```ts diff --git a/bindings/ts/package.json b/bindings/ts/package.json index 41d608c..7a7fa01 100644 --- a/bindings/ts/package.json +++ b/bindings/ts/package.json @@ -8,6 +8,7 @@ "types": "dist/index.d.ts", "scripts": { "build:wasm": "wasm-pack build ../../crates/encryptoglyph --target bundler --out-dir ../../bindings/ts/pkg -- --features wasm", + "build:wasm:node": "wasm-pack build ../../crates/encryptoglyph --target nodejs --out-dir ../../bindings/ts/pkg-node -- --features wasm", "build": "tsc -p ." } } diff --git a/crates/encryptoglyph/Cargo.lock b/crates/encryptoglyph/Cargo.lock index fbb07c4..3f3427a 100644 --- a/crates/encryptoglyph/Cargo.lock +++ b/crates/encryptoglyph/Cargo.lock @@ -292,6 +292,7 @@ dependencies = [ "ed25519-dalek", "fpe", "getrandom 0.2.17", + "getrandom 0.4.3", "hkdf", "hmac", "ml-kem", @@ -389,9 +390,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi", "rand_core 0.10.1", + "wasm-bindgen", ] [[package]] diff --git a/crates/encryptoglyph/Cargo.toml b/crates/encryptoglyph/Cargo.toml index d268b40..37f5933 100644 --- a/crates/encryptoglyph/Cargo.toml +++ b/crates/encryptoglyph/Cargo.toml @@ -29,5 +29,11 @@ subtle = "2.6" zeroize = { version = "1.8", features = ["derive"] } getrandom = "0.2" wasm-bindgen = { version = "0.2", optional = true } + +# rand_core 0.10 pulls getrandom 0.4, which has no `js` feature. Enabling +# `wasm_js` on that version lets the wasm32 build use the locked graph. +# The direct 0.2 dependency stays named `getrandom` for getrandom::getrandom. +[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies] +getrandom04 = { package = "getrandom", version = "0.4", features = ["wasm_js"] } fpe = "0.6.1" blahaj = "0.7" From d2e915d4eee0993d356a55357dffa1b9f0205e71 Mon Sep 17 00:00:00 2001 From: GoDeskio <62771363+GoDeskio@users.noreply.github.com> Date: Sat, 14 Nov 2026 13:48:26 -0700 Subject: [PATCH 2/2] Keep fpe and blahaj in the main dependency table --- crates/encryptoglyph/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/encryptoglyph/Cargo.toml b/crates/encryptoglyph/Cargo.toml index 37f5933..8129edb 100644 --- a/crates/encryptoglyph/Cargo.toml +++ b/crates/encryptoglyph/Cargo.toml @@ -29,11 +29,11 @@ subtle = "2.6" zeroize = { version = "1.8", features = ["derive"] } getrandom = "0.2" wasm-bindgen = { version = "0.2", optional = true } +fpe = "0.6.1" +blahaj = "0.7" # rand_core 0.10 pulls getrandom 0.4, which has no `js` feature. Enabling # `wasm_js` on that version lets the wasm32 build use the locked graph. # The direct 0.2 dependency stays named `getrandom` for getrandom::getrandom. [target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies] getrandom04 = { package = "getrandom", version = "0.4", features = ["wasm_js"] } -fpe = "0.6.1" -blahaj = "0.7"