aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/index.browser.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-10-07 12:01:40 +0200
committerFlorian Dold <florian@dold.me>2021-10-07 12:01:40 +0200
commite2fe2d6db16b422ee6d69ef03f1393e1f0f42749 (patch)
tree7016f657b08b284afd62a55752baeab69d7be946 /packages/taler-wallet-core/src/index.browser.ts
parent2c3456608e8e87a86a5b2f62301b4ea78a2cb00d (diff)
downloadwallet-core-e2fe2d6db16b422ee6d69ef03f1393e1f0f42749.tar.xz
add anastasis skeleton, put crypto in taler-util
Diffstat (limited to 'packages/taler-wallet-core/src/index.browser.ts')
-rw-r--r--packages/taler-wallet-core/src/index.browser.ts55
1 files changed, 0 insertions, 55 deletions
diff --git a/packages/taler-wallet-core/src/index.browser.ts b/packages/taler-wallet-core/src/index.browser.ts
index d0b82d3e0..88ea52479 100644
--- a/packages/taler-wallet-core/src/index.browser.ts
+++ b/packages/taler-wallet-core/src/index.browser.ts
@@ -15,58 +15,3 @@
*/
export * from "./index.js";
-
-import { setPRNG } from './crypto/primitives/nacl-fast.js';
-// export default API;
-
-function cleanup(arr: Uint8Array): void {
- for (let i = 0; i < arr.length; i++) arr[i] = 0;
-}
-
-// Initialize PRNG if environment provides CSPRNG.
-// If not, methods calling randombytes will throw.
-// @ts-ignore-error
-const cr = typeof self !== "undefined" ? self.crypto || self.msCrypto : null;
-
-const QUOTA = 65536;
-setPRNG(function (x: Uint8Array, n: number) {
- let i;
- const v = new Uint8Array(n);
- for (i = 0; i < n; i += QUOTA) {
- cr.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
- }
- for (i = 0; i < n; i++) x[i] = v[i];
- cleanup(v);
-});
-// function initPRNG() {
-// // Initialize PRNG if environment provides CSPRNG.
-// // If not, methods calling randombytes will throw.
-// // @ts-ignore-error
-// const cr = typeof self !== "undefined" ? self.crypto || self.msCrypto : null;
-// if (cr && cr.getRandomValues) {
-// // Browsers.
-// const QUOTA = 65536;
-// setPRNG(function (x: Uint8Array, n: number) {
-// let i;
-// const v = new Uint8Array(n);
-// for (i = 0; i < n; i += QUOTA) {
-// cr.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
-// }
-// for (i = 0; i < n; i++) x[i] = v[i];
-// cleanup(v);
-// });
-// } else if (typeof require !== "undefined") {
-// // Node.js.
-// // eslint-disable-next-line @typescript-eslint/no-var-requires
-// const cr = require("crypto");
-// if (cr && cr.randomBytes) {
-// setPRNG(function (x: Uint8Array, n: number) {
-// const v = cr.randomBytes(n);
-// for (let i = 0; i < n; i++) x[i] = v[i];
-// cleanup(v);
-// });
-// }
-// }
-// }
-
-// initPRNG(); \ No newline at end of file