Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.
Describe the bug
The package wasm-themis can not be used with Node.js because it tries to call fetch() on a file path.
To Reproduce
Steps to reproduce the behavior:
Install Node.js v22
Run npm i wasm-themis
Minimal example script
const themis = require('wasm-themis');
async function test() {
await themis.initialized;
console.log('Themis initialized');
const keyPair = new themis.KeyPair();
console.log('Generated key pair:', keyPair);
}
test();
**Exception:**
TypeError: fetch failed
at node:internal/deps/undici/undici:13392:13 {
[cause]: Error: unknown scheme
at makeNetworkError (node:internal/deps/undici/undici:9166:35)
at schemeFetch (node:internal/deps/undici/undici:10568:34)
at node:internal/deps/undici/undici:10410:26
at mainFetch (node:internal/deps/undici/undici:10429:11)
at fetching (node:internal/deps/undici/undici:10377:7)
at fetch (node:internal/deps/undici/undici:10246:20)
at fetch (node:internal/deps/undici/undici:13390:10)
at fetch (node:internal/bootstrap/web/exposed-window-or-worker:72:12)
at instantiateAsync (C:\Users\info\Documents\Git\hash-chat\backend\node_modules\wasm-themis\dist\libthemis.js:9:19056)
at createWasm (C:\Users\info\Documents\Git\hash-chat\backend\node_modules\wasm-themis\dist\libthemis.js:9:19666)
}
**Expected behavior**
A clear and concise description of what you expected to happen.
**Environment (please complete the following information):**
- OS: Windows 11
- Hardware: 64-bit
- Themis version: wasm-themis@0.15.0
- Installation way: via package manager
**Additional context**
A temporary workaround I found is modifying the function `instantiateAsync` in the file `libthemis.js` by adding `return instantiateArrayBuffer(receiveInstantiationResult);` to the begging of the function.
Thank you for reporting!
That's definitely not expected, we will test on Linux/macOS to see if we could reproduce the issue, or maybe it will required a windows-only fix.
Describe the bug The package
wasm-themis
can not be used with Node.js because it tries to callfetch()
on a file path.To Reproduce Steps to reproduce the behavior:
npm i wasm-themis
async function test() { await themis.initialized; console.log('Themis initialized'); const keyPair = new themis.KeyPair(); console.log('Generated key pair:', keyPair); }
test();
TypeError: fetch failed at node:internal/deps/undici/undici:13392:13 { [cause]: Error: unknown scheme at makeNetworkError (node:internal/deps/undici/undici:9166:35) at schemeFetch (node:internal/deps/undici/undici:10568:34) at node:internal/deps/undici/undici:10410:26 at mainFetch (node:internal/deps/undici/undici:10429:11) at fetching (node:internal/deps/undici/undici:10377:7) at fetch (node:internal/deps/undici/undici:10246:20) at fetch (node:internal/deps/undici/undici:13390:10) at fetch (node:internal/bootstrap/web/exposed-window-or-worker:72:12) at instantiateAsync (C:\Users\info\Documents\Git\hash-chat\backend\node_modules\wasm-themis\dist\libthemis.js:9:19056) at createWasm (C:\Users\info\Documents\Git\hash-chat\backend\node_modules\wasm-themis\dist\libthemis.js:9:19666) }