aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/crypto/emscInterface.ts8
-rw-r--r--src/crypto/emscLoader.js16
2 files changed, 13 insertions, 11 deletions
diff --git a/src/crypto/emscInterface.ts b/src/crypto/emscInterface.ts
index eae8ee5c0..61289fb75 100644
--- a/src/crypto/emscInterface.ts
+++ b/src/crypto/emscInterface.ts
@@ -103,7 +103,11 @@ interface EmscAllocFunctions {
ecdsa_public_key_from_private(a1: number): number;
eddsa_key_create(): number;
eddsa_public_key_from_private(a1: number): number;
- get_amount(a1: number, a2: number, a22: number, a3: string): number;
+ /**
+ * Note that value_1 and value_2 are the first 64-bit parameter,
+ * and not two separate parameters (by the emscripten calling convention).
+ */
+ get_amount(value_1: number, value_2: number, fraction: number, currency: string): number;
hash_context_start(): number;
malloc(size: number): number;
purpose_create(a1: number, a2: number, a3: number): number;
@@ -147,7 +151,7 @@ class EmscEnvironment {
ecdsa_public_key_from_private: getEmsc( "TALER_WRALL_ecdsa_public_key_from_private", "number", ["number"]),
eddsa_key_create: getEmsc("GNUNET_CRYPTO_eddsa_key_create", "number", []),
eddsa_public_key_from_private: getEmsc( "TALER_WRALL_eddsa_public_key_from_private", "number", ["number"]),
- get_amount: getEmsc("TALER_WRALL_get_amount", "number", ["number", "number", "string"]),
+ get_amount: getEmsc("TALER_WRALL_get_amount", "number", ["number", "number", "number", "string"]),
hash_context_start: getEmsc("GNUNET_CRYPTO_hash_context_start", "number", []),
malloc: (size: number) => lib._malloc(size),
purpose_create: getEmsc("TALER_WRALL_purpose_create", "number", ["number", "number", "number"]),
diff --git a/src/crypto/emscLoader.js b/src/crypto/emscLoader.js
index 7251a5984..59437da42 100644
--- a/src/crypto/emscLoader.js
+++ b/src/crypto/emscLoader.js
@@ -71,16 +71,14 @@ export function getLib() {
return scriptDir + "../emscripten/" + path;
};
console.log("instantiating TalerEmscriptenLib");
- //const lib = self.TalerEmscriptenLib({ locateFile });
- const lib = self.TalerEmscriptenLib;
+ const lib = self.TalerEmscriptenLib({ locateFile });
cachedLib = lib;
- return Promise.resolve({ lib: lib });
- //return new Promise((resolve, reject) => {
- // lib.then(mod => {
- // console.log("emscripten module fully loaded");
- // resolve({ lib: mod });
- // });
- //});
+ return new Promise((resolve, reject) => {
+ lib.then(mod => {
+ console.log("emscripten module fully loaded");
+ resolve({ lib: mod });
+ });
+ });
}
// Last resort, we don't have require, we're not running in a webworker.