diff options
author | Florian Dold <florian@dold.me> | 2022-12-06 14:53:35 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-12-06 19:45:04 +0100 |
commit | d040c3b861cb6c7f79606d9d46f79db15c6d2e4c (patch) | |
tree | 584c3eac8ceb26b01743dd250f8a7bcc084a2956 /packages/taler-wallet-embedded | |
parent | 265e7a713753b0b6b8502445200688806fecfbf1 (diff) |
wallet: use native crypto if available
Diffstat (limited to 'packages/taler-wallet-embedded')
-rw-r--r-- | packages/taler-wallet-embedded/src/wallet-qjs.ts | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/packages/taler-wallet-embedded/src/wallet-qjs.ts b/packages/taler-wallet-embedded/src/wallet-qjs.ts index 21796870a..cad8b68bf 100644 --- a/packages/taler-wallet-embedded/src/wallet-qjs.ts +++ b/packages/taler-wallet-embedded/src/wallet-qjs.ts @@ -42,6 +42,7 @@ import { j2s, Logger, setGlobalLogLevelFromString, + setPRNG, WalletNotification, } from "@gnu-taler/taler-util"; import { BridgeIDBFactory } from "@gnu-taler/idb-bridge"; @@ -54,6 +55,16 @@ import * as _qjsOsImp from "os"; const textDecoder = new TextDecoder(); const textEncoder = new TextEncoder(); +setGlobalLogLevelFromString("trace"); + +setPRNG(function (x: Uint8Array, n: number) { + // @ts-ignore + const va = globalThis._randomBytes(n); + const v = new Uint8Array(va); + for (let i = 0; i < n; i++) x[i] = v[i]; + for (let i = 0; i < v.length; i++) v[i] = 0; +}); + export interface QjsHttpResp { status: number; data: ArrayBuffer; @@ -126,8 +137,6 @@ export class NativeHttpLib implements HttpRequestLibrary { data = new ArrayBuffer(0); } } - console.log(`data type ${data?.constructor.name}`); - console.log(`data: ${j2s(data)}`); const res = qjsOs.fetchHttp(url, { method, data, |