summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-embedded/src/wallet-qjs.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-embedded/src/wallet-qjs.ts')
-rw-r--r--packages/taler-wallet-embedded/src/wallet-qjs.ts22
1 files changed, 8 insertions, 14 deletions
diff --git a/packages/taler-wallet-embedded/src/wallet-qjs.ts b/packages/taler-wallet-embedded/src/wallet-qjs.ts
index e475f9542..5e2f1e0a4 100644
--- a/packages/taler-wallet-embedded/src/wallet-qjs.ts
+++ b/packages/taler-wallet-embedded/src/wallet-qjs.ts
@@ -27,9 +27,9 @@ import {
CoreApiResponseSuccess,
getErrorDetailFromException,
InitRequest,
+ j2s,
Logger,
setGlobalLogLevelFromString,
- setPRNG,
WalletNotification,
} from "@gnu-taler/taler-util";
import { createPlatformHttpLib } from "@gnu-taler/taler-util/http";
@@ -47,20 +47,11 @@ import {
getRecoveryStartState,
discoverPolicies,
mergeDiscoveryAggregate,
- ReducerState,
} from "@gnu-taler/anastasis-core";
import { userIdentifierDerive } from "@gnu-taler/anastasis-core/lib/crypto.js";
setGlobalLogLevelFromString("trace");
-setPRNG(function (x: Uint8Array, n: number) {
- // @ts-ignore
- const va = globalThis._tart.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;
-});
-
const logger = new Logger("taler-wallet-embedded/index.ts");
/**
@@ -222,6 +213,8 @@ async function handleAnastasisRequest(
cursor: discoverRes.cursor,
},
});
+ default:
+ throw Error("unsupported anastasis operation");
}
}
@@ -295,10 +288,10 @@ export async function testWithGv() {
});
}
-export async function testWithLocal() {
+export async function testWithLocal(path: string) {
console.log("running local test");
const w = await createNativeWalletHost2({
- persistentStoragePath: "walletdb.json",
+ persistentStoragePath: path ?? "walletdb.json",
config: {
features: {
allowHttp: true,
@@ -310,7 +303,7 @@ export async function testWithLocal() {
skipDefaults: true,
});
console.log("initialized wallet");
- await w.wallet.client.call(WalletApiOperation.RunIntegrationTestV2, {
+ await w.wallet.client.call(WalletApiOperation.RunIntegrationTest, {
amountToSpend: "TESTKUDOS:1",
amountToWithdraw: "TESTKUDOS:3",
bankAccessApiBaseUrl: "http://localhost:8082/taler-bank-access/",
@@ -323,6 +316,7 @@ export async function testWithLocal() {
});
console.log("done with task loop");
w.wallet.stop();
+ console.log("DB stats:", j2s(w.getDbStats()));
}
export async function testArgon2id() {
@@ -357,4 +351,4 @@ globalThis.testArgon2id = testArgon2id;
// @ts-ignore
globalThis.testReduceAction = reduceAction;
// @ts-ignore
-globalThis.testDiscoverPolicies = discoverPolicies; \ No newline at end of file
+globalThis.testDiscoverPolicies = discoverPolicies;