[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: make CSPRNG work on ES6
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: make CSPRNG work on ES6 |
Date: |
Mon, 14 Jun 2021 18:19:23 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new b4f97f45 make CSPRNG work on ES6
b4f97f45 is described below
commit b4f97f4592cbab6632aff4f1ea4bedccdbf00d3a
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Jun 14 18:19:18 2021 +0200
make CSPRNG work on ES6
---
packages/taler-wallet-core/package.json | 2 +-
.../taler-wallet-core/src/crypto/primitives/nacl-fast.ts | 12 ++++++++++--
packages/taler-wallet-core/tsconfig.json | 4 ++--
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/packages/taler-wallet-core/package.json
b/packages/taler-wallet-core/package.json
index 9956cb31..e14ae0dd 100644
--- a/packages/taler-wallet-core/package.json
+++ b/packages/taler-wallet-core/package.json
@@ -68,7 +68,7 @@
},
"ava": {
"files": [
- "lib/**/*test*"
+ "lib/**/*test.*"
]
}
}
diff --git a/packages/taler-wallet-core/src/crypto/primitives/nacl-fast.ts
b/packages/taler-wallet-core/src/crypto/primitives/nacl-fast.ts
index acaebf54..711c83ec 100644
--- a/packages/taler-wallet-core/src/crypto/primitives/nacl-fast.ts
+++ b/packages/taler-wallet-core/src/crypto/primitives/nacl-fast.ts
@@ -5,6 +5,12 @@
// Implementation derived from TweetNaCl version 20140427.
// See for details: http://tweetnacl.cr.yp.to/
+import { createRequire } from "module";
+
+// We need this require function to synchronously
+// import the "crypto" module in the CSPRNG initialization.
+const require = createRequire(import.meta.url);
+
const gf = function (init: number[] = []): Float64Array {
const r = new Float64Array(16);
if (init) for (let i = 0; i < init.length; i++) r[i] = init[i];
@@ -3021,7 +3027,7 @@ export function secretbox_open(
return m.subarray(crypto_secretbox_ZEROBYTES);
}
-(function () {
+function initPRNG() {
// Initialize PRNG if environment provides CSPRNG.
// If not, methods calling randombytes will throw.
// @ts-ignore-error
@@ -3050,4 +3056,6 @@ export function secretbox_open(
});
}
}
-})();
+}
+
+initPRNG();
diff --git a/packages/taler-wallet-core/tsconfig.json
b/packages/taler-wallet-core/tsconfig.json
index c8f5c23b..3da33236 100644
--- a/packages/taler-wallet-core/tsconfig.json
+++ b/packages/taler-wallet-core/tsconfig.json
@@ -4,7 +4,7 @@
"composite": true,
"declaration": true,
"declarationMap": false,
- "target": "ES6",
+ "target": "ES2017",
"module": "ESNext",
"moduleResolution": "node",
"sourceMap": true,
@@ -21,7 +21,7 @@
"esModuleInterop": true,
"importHelpers": true,
"rootDir": "./src",
- "typeRoots": ["./node_modules/@types"]
+ "typeRoots": ["./node_modules/@types"],
},
"references": [
{
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: make CSPRNG work on ES6,
gnunet <=