diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-08-15 23:59:42 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-08-15 23:59:42 +0200 |
commit | 0cab39f2b6e84a16467bf535150e1700a2fcf566 (patch) | |
tree | e4a8f7ea3dae6997b9b28876ae7bcc702b5c3859 | |
parent | ea2fb677d0268eed8153a614603cca04b1b2172d (diff) |
load wasm manually from correct location
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/crypto/synchronousWorker.ts | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/package.json b/package.json index d72316e7d..4068c5ef0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "taler-wallet", - "version": "0.0.2", + "version": "0.0.3", "description": "", "main": "dist/node/index.js", "repository": { diff --git a/src/crypto/synchronousWorker.ts b/src/crypto/synchronousWorker.ts index d8a3d83cb..4d1ff964c 100644 --- a/src/crypto/synchronousWorker.ts +++ b/src/crypto/synchronousWorker.ts @@ -17,6 +17,8 @@ import { EmscEnvironment } from "./emscInterface"; import { CryptoImplementation } from "./cryptoImplementation"; +import fs = require("fs"); + /** * Worker implementation that uses node subprocesses. */ @@ -95,7 +97,12 @@ export class SynchronousCryptoWorker { ); } + const binaryPath = __dirname + "/../../../emscripten/taler-emscripten-lib.wasm"; + console.log("reading from", binaryPath); + const wasmBinary = new Uint8Array(fs.readFileSync(binaryPath)); + this.cachedEmscEnvironmentPromise = new Promise((resolve, reject) => { + lib.wasmBinary = wasmBinary; lib.onRuntimeInitialized = () => { this.cachedEmscEnvironmentPromise = undefined; this.cachedEmscEnvironment = new EmscEnvironment(lib); @@ -150,7 +157,9 @@ export class SynchronousCryptoWorker { return; } - this.handleRequest(operation, id, args); + this.handleRequest(operation, id, args).catch((e) => { + console.error("Error while handling crypto request:", e); + }); } /** |