aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-03-17 17:56:37 +0100
committerFlorian Dold <florian@dold.me>2021-03-17 17:56:37 +0100
commit07cdfb2e4ec761021477271776b81f33af0e731d (patch)
treecb62b1d1a04e1e64b8ee47e78196e858727d2c0a
parent42a4d666f42ce94274995bfdae644444ff5f6d53 (diff)
towards wallet-core / util split
-rw-r--r--.vscode/settings.json6
-rw-r--r--package.json1
-rw-r--r--packages/taler-util/README.md9
-rw-r--r--packages/taler-util/package.json44
-rw-r--r--packages/taler-util/src/ReserveStatus.ts (renamed from packages/taler-wallet-core/src/types/ReserveStatus.ts)2
-rw-r--r--packages/taler-util/src/ReserveTransaction.ts (renamed from packages/taler-wallet-core/src/types/ReserveTransaction.ts)4
-rw-r--r--packages/taler-util/src/amounts.test.ts (renamed from packages/taler-wallet-core/src/util/amounts-test.ts)2
-rw-r--r--packages/taler-util/src/amounts.ts (renamed from packages/taler-wallet-core/src/util/amounts.ts)2
-rw-r--r--packages/taler-util/src/backupTypes.ts (renamed from packages/taler-wallet-core/src/types/backupTypes.ts)13
-rw-r--r--packages/taler-util/src/codec.test.ts (renamed from packages/taler-wallet-core/src/util/codec-test.ts)0
-rw-r--r--packages/taler-util/src/codec.ts (renamed from packages/taler-wallet-core/src/util/codec.ts)0
-rw-r--r--packages/taler-util/src/helpers.ts152
-rw-r--r--packages/taler-util/src/index.ts19
-rw-r--r--packages/taler-util/src/libtool-version.test.ts (renamed from packages/taler-wallet-core/src/util/libtoolVersion-test.ts)2
-rw-r--r--packages/taler-util/src/libtool-version.ts (renamed from packages/taler-wallet-core/src/util/libtoolVersion.ts)0
-rw-r--r--packages/taler-util/src/notifications.ts (renamed from packages/taler-wallet-core/src/types/notifications.ts)0
-rw-r--r--packages/taler-util/src/payto.test.ts (renamed from packages/taler-wallet-core/src/util/payto-test.ts)0
-rw-r--r--packages/taler-util/src/payto.ts (renamed from packages/taler-wallet-core/src/util/payto.ts)2
-rw-r--r--packages/taler-util/src/taler-error-codes.ts (renamed from packages/taler-wallet-core/src/TalerErrorCode.ts)0
-rw-r--r--packages/taler-util/src/talerTypes.ts (renamed from packages/taler-wallet-core/src/types/talerTypes.ts)6
-rw-r--r--packages/taler-util/src/talerconfig.test.ts (renamed from packages/taler-wallet-core/src/util/talerconfig-test.ts)0
-rw-r--r--packages/taler-util/src/talerconfig.ts (renamed from packages/taler-wallet-core/src/util/talerconfig.ts)0
-rw-r--r--packages/taler-util/src/taleruri.test.ts (renamed from packages/taler-wallet-core/src/util/taleruri-test.ts)0
-rw-r--r--packages/taler-util/src/taleruri.ts (renamed from packages/taler-wallet-core/src/util/taleruri.ts)0
-rw-r--r--packages/taler-util/src/time.ts (renamed from packages/taler-wallet-core/src/util/time.ts)7
-rw-r--r--packages/taler-util/src/transactionsTypes.ts (renamed from packages/taler-wallet-core/src/types/transactionsTypes.ts)8
-rw-r--r--packages/taler-util/src/types-test.ts (renamed from packages/taler-wallet-core/src/types/types-test.ts)0
-rw-r--r--packages/taler-util/src/url.ts74
-rw-r--r--packages/taler-util/src/walletTypes.ts (renamed from packages/taler-wallet-core/src/types/walletTypes.ts)102
-rw-r--r--packages/taler-util/tsconfig.json27
-rw-r--r--packages/taler-wallet-cli/package.json1
-rw-r--r--packages/taler-wallet-cli/src/index.ts35
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/harness.ts112
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/helpers.ts42
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/merchantApiTypes.ts2
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/sync.ts3
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts4
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts8
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts4
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-libeufin-tutorial.ts4
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-merchant-exchange-confusion.ts3
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-merchant-longpolling.ts4
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-merchant-refund-api.ts4
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-pay-abort.ts3
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-pay-paid.ts4
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-payment-claim.ts4
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-payment-fault.ts2
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-payment-idempotency.ts2
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts11
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-paywall-flow.ts2
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-refund-auto.ts2
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-refund-gone.ts2
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-refund-incremental.ts2
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-refund.ts2
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-timetravel-autorefresh.ts4
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-timetravel-withdraw.ts2
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-doublespend.ts5
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-withdrawal-abort-bank.ts5
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-withdrawal-bank-integrated.ts2
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-withdrawal-manual.ts4
-rw-r--r--packages/taler-wallet-cli/tsconfig.json3
-rw-r--r--packages/taler-wallet-core/package.json1
-rw-r--r--packages/taler-wallet-core/src/crypto/cryptoTypes.ts (renamed from packages/taler-wallet-core/src/types/cryptoTypes.ts)2
-rw-r--r--packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts8
-rw-r--r--packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts14
-rw-r--r--packages/taler-wallet-core/src/db.ts1737
-rw-r--r--packages/taler-wallet-core/src/headless/NodeHttpLib.ts3
-rw-r--r--packages/taler-wallet-core/src/headless/helpers.ts12
-rw-r--r--packages/taler-wallet-core/src/index.ts16
-rw-r--r--packages/taler-wallet-core/src/operations/backup/export.ts6
-rw-r--r--packages/taler-wallet-core/src/operations/backup/import.ts37
-rw-r--r--packages/taler-wallet-core/src/operations/backup/index.ts20
-rw-r--r--packages/taler-wallet-core/src/operations/backup/state.ts11
-rw-r--r--packages/taler-wallet-core/src/operations/balance.ts10
-rw-r--r--packages/taler-wallet-core/src/operations/deposits.ts40
-rw-r--r--packages/taler-wallet-core/src/operations/errors.ts3
-rw-r--r--packages/taler-wallet-core/src/operations/exchanges.ts68
-rw-r--r--packages/taler-wallet-core/src/operations/pay.ts77
-rw-r--r--packages/taler-wallet-core/src/operations/pending.ts6
-rw-r--r--packages/taler-wallet-core/src/operations/recoup.ts18
-rw-r--r--packages/taler-wallet-core/src/operations/refresh.ts14
-rw-r--r--packages/taler-wallet-core/src/operations/refund.ts49
-rw-r--r--packages/taler-wallet-core/src/operations/reserves.ts80
-rw-r--r--packages/taler-wallet-core/src/operations/state.ts17
-rw-r--r--packages/taler-wallet-core/src/operations/testing.ts24
-rw-r--r--packages/taler-wallet-core/src/operations/tip.ts57
-rw-r--r--packages/taler-wallet-core/src/operations/transactions.ts8
-rw-r--r--packages/taler-wallet-core/src/operations/withdraw-test.ts4
-rw-r--r--packages/taler-wallet-core/src/operations/withdraw.ts112
-rw-r--r--packages/taler-wallet-core/src/pending-types.ts (renamed from packages/taler-wallet-core/src/types/pendingTypes.ts)10
-rw-r--r--packages/taler-wallet-core/src/types/dbTypes.ts1775
-rw-r--r--packages/taler-wallet-core/src/util/RequestThrottler.ts2
-rw-r--r--packages/taler-wallet-core/src/util/coinSelection-test.ts2
-rw-r--r--packages/taler-wallet-core/src/util/coinSelection.ts2
-rw-r--r--packages/taler-wallet-core/src/util/helpers.ts3
-rw-r--r--packages/taler-wallet-core/src/util/http.ts9
-rw-r--r--packages/taler-wallet-core/src/util/retries.ts2
-rw-r--r--packages/taler-wallet-core/src/util/testvectors.ts36
-rw-r--r--packages/taler-wallet-core/src/util/timer.ts2
-rw-r--r--packages/taler-wallet-core/src/util/wire.ts51
-rw-r--r--packages/taler-wallet-core/src/wallet.ts19
-rw-r--r--packages/taler-wallet-core/tsconfig.json5
-rw-r--r--pnpm-lock.yaml250
103 files changed, 2724 insertions, 2667 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 0a134958d..a30ba4651 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -42,5 +42,9 @@
"src/i18n/*.po": true
},
"search.collapseResults": "auto",
- "files.associations": { "api-extractor.json": "jsonc" }
+ "files.associations": {
+ "api-extractor.json": "jsonc"
+ },
+ "typescript.preferences.importModuleSpecifierEnding": "js",
+ "typescript.preferences.importModuleSpecifier": "project-relative"
} \ No newline at end of file
diff --git a/package.json b/package.json
index 1f5c01781..3d5f494c7 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,7 @@
{
"private": true,
"scripts": {
+ "preinstall": "npx only-allow pnpm",
"compile": "pnpm run --filter '{packages}' compile",
"clean": "pnpm run --filter '{packages}' clean",
"pretty": "pnpm run --filter '{packages}' pretty",
diff --git a/packages/taler-util/README.md b/packages/taler-util/README.md
new file mode 100644
index 000000000..07d74eeeb
--- /dev/null
+++ b/packages/taler-util/README.md
@@ -0,0 +1,9 @@
+# @gnu-taler/taler-util
+
+This package implements various utility functionality for GNU Taler.
+
+
+## When should something be moved to this package?
+
+The ``@gnu-taler/taler-util`` package should have minimal dependencies
+and as few platform-specific functionality as possible.
diff --git a/packages/taler-util/package.json b/packages/taler-util/package.json
new file mode 100644
index 000000000..aacabd21a
--- /dev/null
+++ b/packages/taler-util/package.json
@@ -0,0 +1,44 @@
+{
+ "name": "@gnu-taler/taler-util",
+ "version": "0.8.2",
+ "description": "Generic helper functionality for GNU Taler",
+ "exports": {
+ ".": "./lib/index.js"
+ },
+ "module": "./lib/index.js",
+ "types": "./lib/index.d.ts",
+ "typesVersions": {
+ "*": {
+ "lib/index.d.ts": [
+ "lib/index.d.ts"
+ ],
+ "src/*": [],
+ "*": []
+ }
+ },
+ "author": "Florian Dold",
+ "license": "AGPL-3.0-or-later",
+ "private": false,
+ "scripts": {
+ "prepare": "tsc",
+ "test": "tsc && ava",
+ "clean": "rimraf dist lib tsconfig.tsbuildinfo",
+ "pretty": "prettier --write src"
+ },
+ "devDependencies": {
+ "@types/node": "^14.14.22",
+ "ava": "^3.15.0",
+ "esbuild": "^0.9.2",
+ "prettier": "^2.2.1",
+ "rimraf": "^3.0.2",
+ "typescript": "^4.2.3"
+ },
+ "dependencies": {
+ "tslib": "^2.1.0"
+ },
+ "ava": {
+ "require": [
+ "esm"
+ ]
+ }
+}
diff --git a/packages/taler-wallet-core/src/types/ReserveStatus.ts b/packages/taler-util/src/ReserveStatus.ts
index 8a6092a7f..cd204f55e 100644
--- a/packages/taler-wallet-core/src/types/ReserveStatus.ts
+++ b/packages/taler-util/src/ReserveStatus.ts
@@ -26,7 +26,7 @@ import {
buildCodecForObject,
codecForList,
Codec,
-} from "../util/codec";
+} from "./codec.js";
import { AmountString } from "./talerTypes";
import {
ReserveTransaction,
diff --git a/packages/taler-wallet-core/src/types/ReserveTransaction.ts b/packages/taler-util/src/ReserveTransaction.ts
index 6847d8376..f477106b2 100644
--- a/packages/taler-wallet-core/src/types/ReserveTransaction.ts
+++ b/packages/taler-util/src/ReserveTransaction.ts
@@ -30,7 +30,7 @@ import {
buildCodecForUnion,
Codec,
codecForNumber,
-} from "../util/codec";
+} from "./codec.js";
import {
AmountString,
Base32String,
@@ -38,7 +38,7 @@ import {
EddsaPublicKeyString,
CoinPublicKeyString,
} from "./talerTypes";
-import { Timestamp, codecForTimestamp } from "../util/time";
+import { Timestamp, codecForTimestamp } from "./time.js";
export enum ReserveTransactionType {
Withdraw = "WITHDRAW",
diff --git a/packages/taler-wallet-core/src/util/amounts-test.ts b/packages/taler-util/src/amounts.test.ts
index afd8caa51..d9734ce82 100644
--- a/packages/taler-wallet-core/src/util/amounts-test.ts
+++ b/packages/taler-util/src/amounts.test.ts
@@ -16,7 +16,7 @@
import test from "ava";
-import { Amounts, AmountJson } from "../util/amounts";
+import { Amounts, AmountJson } from "./amounts.js";
const jAmt = (
value: number,
diff --git a/packages/taler-wallet-core/src/util/amounts.ts b/packages/taler-util/src/amounts.ts
index 7a242f41d..8984db11b 100644
--- a/packages/taler-wallet-core/src/util/amounts.ts
+++ b/packages/taler-util/src/amounts.ts
@@ -27,7 +27,7 @@ import {
codecForNumber,
Codec,
} from "./codec";
-import { AmountString } from "../types/talerTypes";
+import { AmountString } from "./talerTypes";
/**
* Number of fractional units that one value unit represents.
diff --git a/packages/taler-wallet-core/src/types/backupTypes.ts b/packages/taler-util/src/backupTypes.ts
index 7e6ceb04c..b31b8e58b 100644
--- a/packages/taler-wallet-core/src/types/backupTypes.ts
+++ b/packages/taler-util/src/backupTypes.ts
@@ -53,7 +53,7 @@
/**
* Imports.
*/
-import { Duration, Timestamp } from "../util/time";
+import { Duration, Timestamp } from "./time.js";
/**
* Type alias for strings that are to be treated like amounts.
@@ -1094,7 +1094,7 @@ export class BackupExchangeSignKey {
/**
* Signature by the auditor that a particular denomination key is audited.
*/
-export class AuditorDenomSig {
+export class BackupAuditorDenomSig {
/**
* Denomination public key's hash.
*/
@@ -1123,7 +1123,7 @@ export class BackupExchangeAuditor {
/**
* List of signatures for denominations by the auditor.
*/
- denomination_keys: AuditorDenomSig[];
+ denomination_keys: BackupAuditorDenomSig[];
}
/**
@@ -1297,3 +1297,10 @@ export interface BackupProposal {
*/
download_session_id?: string;
}
+
+export interface BackupRecovery {
+ walletRootPriv: string;
+ providers: {
+ url: string;
+ }[];
+} \ No newline at end of file
diff --git a/packages/taler-wallet-core/src/util/codec-test.ts b/packages/taler-util/src/codec.test.ts
index f8f4c797c..f8f4c797c 100644
--- a/packages/taler-wallet-core/src/util/codec-test.ts
+++ b/packages/taler-util/src/codec.test.ts
diff --git a/packages/taler-wallet-core/src/util/codec.ts b/packages/taler-util/src/codec.ts
index 8605ff335..8605ff335 100644
--- a/packages/taler-wallet-core/src/util/codec.ts
+++ b/packages/taler-util/src/codec.ts
diff --git a/packages/taler-util/src/helpers.ts b/packages/taler-util/src/helpers.ts
new file mode 100644
index 000000000..f5c204310
--- /dev/null
+++ b/packages/taler-util/src/helpers.ts
@@ -0,0 +1,152 @@
+/*
+ This file is part of TALER
+ (C) 2016 GNUnet e.V.
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+
+/**
+ * Small helper functions that don't fit anywhere else.
+ */
+
+/**
+ * Imports.
+ */
+import { AmountJson } from "./amounts";
+import * as Amounts from "./amounts";
+import { URL } from "./url";
+
+/**
+ * Show an amount in a form suitable for the user.
+ * FIXME: In the future, this should consider currency-specific
+ * settings such as significant digits or currency symbols.
+ */
+export function amountToPretty(amount: AmountJson): string {
+ const x = amount.value + amount.fraction / Amounts.fractionalBase;
+ return `${x} ${amount.currency}`;
+}
+
+/**
+ * Canonicalize a base url, typically for the exchange.
+ *
+ * See http://api.taler.net/wallet.html#general
+ */
+export function canonicalizeBaseUrl(url: string): string {
+ if (!url.startsWith("http") && !url.startsWith("https")) {
+ url = "https://" + url;
+ }
+ const x = new URL(url);
+ if (!x.pathname.endsWith("/")) {
+ x.pathname = x.pathname + "/";
+ }
+ x.search = "";
+ x.hash = "";
+ return x.href;
+}
+
+/**
+ * Convert object to JSON with canonical ordering of keys
+ * and whitespace omitted.
+ */
+export function canonicalJson(obj: any): string {
+ // Check for cycles, etc.
+ obj = JSON.parse(JSON.stringify(obj));
+ if (typeof obj === "string" || typeof obj === "number" || obj === null) {
+ return JSON.stringify(obj);
+ }
+ if (Array.isArray(obj)) {
+ const objs: string[] = obj.map((e) => canonicalJson(e));
+ return `[${objs.join(",")}]`;
+ }
+ const keys: string[] = [];
+ for (const key in obj) {
+ keys.push(key);
+ }
+ keys.sort();
+ let s = "{";
+ for (let i = 0; i < keys.length; i++) {
+ const key = keys[i];
+ s += JSON.stringify(key) + ":" + canonicalJson(obj[key]);
+ if (i !== keys.length - 1) {
+ s += ",";
+ }
+ }
+ return s + "}";
+}
+
+/**
+ * Check for deep equality of two objects.
+ * Only arrays, objects and primitives are supported.
+ */
+export function deepEquals(x: any, y: any): boolean {
+ if (x === y) {
+ return true;
+ }
+
+ if (Array.isArray(x) && x.length !== y.length) {
+ return false;
+ }
+
+ const p = Object.keys(x);
+ return (
+ Object.keys(y).every((i) => p.indexOf(i) !== -1) &&
+ p.every((i) => deepEquals(x[i], y[i]))
+ );
+}
+
+export function deepCopy(x: any): any {
+ // FIXME: this has many issues ...
+ return JSON.parse(JSON.stringify(x));
+}
+
+/**
+ * Map from a collection to a list or results and then
+ * concatenate the results.
+ */
+export function flatMap<T, U>(xs: T[], f: (x: T) => U[]): U[] {
+ return xs.reduce((acc: U[], next: T) => [...f(next), ...acc], []);
+}
+
+/**
+ * Compute the hash function of a JSON object.
+ */
+export function hash(val: any): number {
+ const str = canonicalJson(val);
+ // https://github.com/darkskyapp/string-hash
+ let h = 5381;
+ let i = str.length;
+ while (i) {
+ h = (h * 33) ^ str.charCodeAt(--i);
+ }
+
+ /* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
+ * integers. Since we want the results to be always positive, convert the
+ * signed int to an unsigned by doing an unsigned bitshift. */
+ return h >>> 0;
+}
+
+/**
+ * Lexically compare two strings.
+ */
+export function strcmp(s1: string, s2: string): number {
+ if (s1 < s2) {
+ return -1;
+ }
+ if (s1 > s2) {
+ return 1;
+ }
+ return 0;
+}
+
+export function j2s(x: any): string {
+ return JSON.stringify(x, undefined, 2);
+}
diff --git a/packages/taler-util/src/index.ts b/packages/taler-util/src/index.ts
new file mode 100644
index 000000000..5a82ea081
--- /dev/null
+++ b/packages/taler-util/src/index.ts
@@ -0,0 +1,19 @@
+import { TalerErrorCode } from "./taler-error-codes.js";
+
+export { TalerErrorCode };
+
+export * from "./codec.js";
+export * from "./amounts.js";
+export * from "./talerconfig.js";
+export * from "./time.js";
+export * from "./walletTypes";
+export * from "./transactionsTypes";
+export * from "./notifications";
+export * from "./talerTypes";
+export * from "./talerconfig";
+export * from "./taleruri";
+export * from "./ReserveStatus";
+export * from "./ReserveTransaction";
+export * from "./backupTypes";
+export * from "./payto.js";
+export * from "./libtool-version"; \ No newline at end of file
diff --git a/packages/taler-wallet-core/src/util/libtoolVersion-test.ts b/packages/taler-util/src/libtool-version.test.ts
index e58e94759..19f997722 100644
--- a/packages/taler-wallet-core/src/util/libtoolVersion-test.ts
+++ b/packages/taler-util/src/libtool-version.test.ts
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import * as LibtoolVersion from "./libtoolVersion";
+import * as LibtoolVersion from "./libtool-version";
import test from "ava";
diff --git a/packages/taler-wallet-core/src/util/libtoolVersion.ts b/packages/taler-util/src/libtool-version.ts
index 5e9d0b74e..5e9d0b74e 100644
--- a/packages/taler-wallet-core/src/util/libtoolVersion.ts
+++ b/packages/taler-util/src/libtool-version.ts
diff --git a/packages/taler-wallet-core/src/types/notifications.ts b/packages/taler-util/src/notifications.ts
index edfb377b9..edfb377b9 100644
--- a/packages/taler-wallet-core/src/types/notifications.ts
+++ b/packages/taler-util/src/notifications.ts
diff --git a/packages/taler-wallet-core/src/util/payto-test.ts b/packages/taler-util/src/payto.test.ts
index 01280b650..01280b650 100644
--- a/packages/taler-wallet-core/src/util/payto-test.ts
+++ b/packages/taler-util/src/payto.test.ts
diff --git a/packages/taler-wallet-core/src/util/payto.ts b/packages/taler-util/src/payto.ts
index a1c47eb2f..504db533b 100644
--- a/packages/taler-wallet-core/src/util/payto.ts
+++ b/packages/taler-util/src/payto.ts
@@ -14,7 +14,7 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { URLSearchParams } from "./url";
+import { URLSearchParams } from "./url.js";
interface PaytoUri {
targetType: string;
diff --git a/packages/taler-wallet-core/src/TalerErrorCode.ts b/packages/taler-util/src/taler-error-codes.ts
index a78b04f25..a78b04f25 100644
--- a/packages/taler-wallet-core/src/TalerErrorCode.ts
+++ b/packages/taler-util/src/taler-error-codes.ts
diff --git a/packages/taler-wallet-core/src/types/talerTypes.ts b/packages/taler-util/src/talerTypes.ts
index fe1370cb7..bef7ab223 100644
--- a/packages/taler-wallet-core/src/types/talerTypes.ts
+++ b/packages/taler-util/src/talerTypes.ts
@@ -40,14 +40,14 @@ import {
codecForConstNumber,
buildCodecForUnion,
codecForConstString,
-} from "../util/codec";
+} from "./codec";
import {
Timestamp,
codecForTimestamp,
Duration,
codecForDuration,
-} from "../util/time";
-import { codecForAmountString } from "../util/amounts";
+} from "./time";
+import { codecForAmountString } from "./amounts";
/**
* Denomination as found in the /keys response from the exchange.
diff --git a/packages/taler-wallet-core/src/util/talerconfig-test.ts b/packages/taler-util/src/talerconfig.test.ts
index 2f920fccf..2f920fccf 100644
--- a/packages/taler-wallet-core/src/util/talerconfig-test.ts
+++ b/packages/taler-util/src/talerconfig.test.ts
diff --git a/packages/taler-wallet-core/src/util/talerconfig.ts b/packages/taler-util/src/talerconfig.ts
index fa8c2d40f..fa8c2d40f 100644
--- a/packages/taler-wallet-core/src/util/talerconfig.ts
+++ b/packages/taler-util/src/talerconfig.ts
diff --git a/packages/taler-wallet-core/src/util/taleruri-test.ts b/packages/taler-util/src/taleruri.test.ts
index e80acc5c3..e80acc5c3 100644
--- a/packages/taler-wallet-core/src/util/taleruri-test.ts
+++ b/packages/taler-util/src/taleruri.test.ts
diff --git a/packages/taler-wallet-core/src/util/taleruri.ts b/packages/taler-util/src/taleruri.ts
index d8366fd0f..d8366fd0f 100644
--- a/packages/taler-wallet-core/src/util/taleruri.ts
+++ b/packages/taler-util/src/taleruri.ts
diff --git a/packages/taler-wallet-core/src/util/time.ts b/packages/taler-util/src/time.ts
index be63aef6b..1a23037a0 100644
--- a/packages/taler-wallet-core/src/util/time.ts
+++ b/packages/taler-util/src/time.ts
@@ -1,5 +1,3 @@
-import { Codec, renderContext, Context } from "./codec";
-
/*
This file is part of GNU Taler
(C) 2017-2019 Taler Systems S.A.
@@ -20,6 +18,11 @@ import { Codec, renderContext, Context } from "./codec";
* Helpers for relative and absolute time.
*/
+/**
+ * Imports.
+ */
+import { Codec, renderContext, Context } from "./codec";
+
export class Timestamp {
/**
* Timestamp in milliseconds.
diff --git a/packages/taler-wallet-core/src/types/transactionsTypes.ts b/packages/taler-util/src/transactionsTypes.ts
index 81dc78039..b3cc274a0 100644
--- a/packages/taler-wallet-core/src/types/transactionsTypes.ts
+++ b/packages/taler-util/src/transactionsTypes.ts
@@ -24,7 +24,7 @@
/**
* Imports.
*/
-import { Timestamp } from "../util/time";
+import { Timestamp } from "./time.js";
import {
AmountString,
Product,
@@ -33,7 +33,7 @@ import {
codecForInternationalizedString,
codecForMerchantInfo,
codecForProduct,
-} from "./talerTypes";
+} from "./talerTypes.js";
import {
Codec,
buildCodecForObject,
@@ -41,8 +41,8 @@ import {
codecForString,
codecForList,
codecForAny,
-} from "../util/codec";
-import { TalerErrorDetails } from "./walletTypes";
+} from "./codec.js";
+import { TalerErrorDetails } from "./walletTypes.js";
export interface TransactionsRequest {
/**
diff --git a/packages/taler-wallet-core/src/types/types-test.ts b/packages/taler-util/src/types-test.ts
index 19c9b5aa6..19c9b5aa6 100644
--- a/packages/taler-wallet-core/src/types/types-test.ts
+++ b/packages/taler-util/src/types-test.ts
diff --git a/packages/taler-util/src/url.ts b/packages/taler-util/src/url.ts
new file mode 100644
index 000000000..b50b4b466
--- /dev/null
+++ b/packages/taler-util/src/url.ts
@@ -0,0 +1,74 @@
+/*
+ This file is part of GNU Taler
+ (C) 2020 Taler Systems S.A.
+
+ GNU Taler is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+
+interface URL {
+ hash: string;
+ host: string;
+ hostname: string;
+ href: string;
+ toString(): string;
+ readonly origin: string;
+ password: string;
+ pathname: string;
+ port: string;
+ protocol: string;
+ search: string;
+ readonly searchParams: URLSearchParams;
+ username: string;
+ toJSON(): string;
+}
+
+interface URLSearchParams {
+ append(name: string, value: string): void;
+ delete(name: string): void;
+ get(name: string): string | null;
+ getAll(name: string): string[];
+ has(name: string): boolean;
+ set(name: string, value: string): void;
+ sort(): void;
+ toString(): string;
+ forEach(
+ callbackfn: (value: string, key: string, parent: URLSearchParams) => void,
+ thisArg?: any,
+ ): void;
+}
+
+export interface URLSearchParamsCtor {
+ new (
+ init?: string[][] | Record<string, string> | string | URLSearchParams,
+ ): URLSearchParams;
+}
+
+export interface URLCtor {
+ new (url: string, base?: string | URL): URL;
+}
+
+// @ts-ignore
+const _URL = globalThis.URL;
+if (!_URL) {
+ throw Error("FATAL: URL not available");
+}
+
+export const URL: URLCtor = _URL;
+
+// @ts-ignore
+const _URLSearchParams = globalThis.URLSearchParams;
+
+if (!_URLSearchParams) {
+ throw Error("FATAL: URLSearchParams not available");
+}
+
+export const URLSearchParams: URLSearchParamsCtor = _URLSearchParams;
diff --git a/packages/taler-wallet-core/src/types/walletTypes.ts b/packages/taler-util/src/walletTypes.ts
index 9ecca059b..d25108df7 100644
--- a/packages/taler-wallet-core/src/types/walletTypes.ts
+++ b/packages/taler-util/src/walletTypes.ts
@@ -31,14 +31,9 @@ import {
AmountJson,
codecForAmountJson,
codecForAmountString,
-} from "../util/amounts";
-import * as LibtoolVersion from "../util/libtoolVersion";
-import {
- ExchangeRecord,
- ExchangeWireInfo,
- DenominationSelectionInfo,
-} from "./dbTypes";
-import { Timestamp, codecForTimestamp } from "../util/time";
+} from "./amounts.js";
+import * as LibtoolVersion from "./libtool-version.js";
+import { Timestamp, codecForTimestamp } from "./time.js";
import {
buildCodecForObject,
codecForString,
@@ -49,14 +44,14 @@ import {
codecForConstString,
codecForAny,
buildCodecForUnion,
-} from "../util/codec";
+} from "./codec.js";
import {
AmountString,
codecForContractTerms,
ContractTerms,
-} from "./talerTypes";
+} from "./talerTypes.js";
import { OrderShortInfo, codecForOrderShortInfo } from "./transactionsTypes";
-import { BackupRecovery } from "../operations/backup";
+import { BackupRecovery } from "./backupTypes.js";
/**
* Response for the create reserve request to the wallet.
@@ -74,92 +69,7 @@ export class CreateReserveResponse {
reservePub: string;
}
-/**
- * Information about what will happen when creating a reserve.
- *
- * Sent to the wallet frontend to be rendered and shown to the user.
- */
-export interface ExchangeWithdrawDetails {
- /**
- * Exchange that the reserve will be created at.
- */
- exchangeInfo: ExchangeRecord;
-
- /**
- * Filtered wire info to send to the bank.
- */
- exchangeWireAccounts: string[];
-
- /**
- * Selected denominations for withdraw.
- */
- selectedDenoms: DenominationSelectionInfo;
-
- /**
- * Fees for withdraw.
- */
- withdrawFee: AmountJson;
-
- /**
- * Remaining balance that is too small to be withdrawn.
- */
- overhead: AmountJson;
-
- /**
- * Wire fees from the exchange.
- */
- wireFees: ExchangeWireInfo;
-
- /**
- * Does the wallet know about an auditor for
- * the exchange that the reserve.
- */
- isAudited: boolean;
-
- /**
- * Did the user already accept the current terms of service for the exchange?
- */
- termsOfServiceAccepted: boolean;
-
- /**
- * The exchange is trusted directly.
- */
- isTrusted: boolean;
-
- /**
- * The earliest deposit expiration of the selected coins.
- */
- earliestDepositExpiration: Timestamp;
-
- /**
- * Number of currently offered denominations.
- */
- numOfferedDenoms: number;
-
- /**
- * Public keys of trusted auditors for the currency we're withdrawing.
- */
- trustedAuditorPubs: string[];
-
- /**
- * Result of checking the wallet's version
- * against the exchange's version.
- *
- * Older exchanges don't return version information.
- */
- versionMatch: LibtoolVersion.VersionMatchResult | undefined;
-
- /**
- * Libtool-style version string for the exchange or "unknown"
- * for older exchanges.
- */
- exchangeVersion: string;
- /**
- * Libtool-style version string for the wallet.
- */
- walletVersion: string;
-}
export interface Balance {
available: AmountString;
diff --git a/packages/taler-util/tsconfig.json b/packages/taler-util/tsconfig.json
new file mode 100644
index 000000000..30cb65e1d
--- /dev/null
+++ b/packages/taler-util/tsconfig.json
@@ -0,0 +1,27 @@
+{
+ "compileOnSave": true,
+ "compilerOptions": {
+ "composite": true,
+ "declaration": true,
+ "declarationMap": false,
+ "target": "ES6",
+ "module": "ESNext",
+ "moduleResolution": "node",
+ "sourceMap": true,
+ "lib": ["es6"],
+ "types": ["node"],
+ "noImplicitReturns": true,
+ "noFallthroughCasesInSwitch": true,
+ "strict": true,
+ "strictPropertyInitialization": false,
+ "outDir": "lib",
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "incremental": true,
+ "esModuleInterop": true,
+ "importHelpers": true,
+ "rootDir": "./src",
+ "typeRoots": ["./node_modules/@types"]
+ },
+ "include": ["src/**/*"]
+}
diff --git a/packages/taler-wallet-cli/package.json b/packages/taler-wallet-cli/package.json
index 993723278..1c391e1de 100644
--- a/packages/taler-wallet-cli/package.json
+++ b/packages/taler-wallet-cli/package.json
@@ -44,6 +44,7 @@
"typescript": "^4.1.3"
},
"dependencies": {
+ "@gnu-taler/taler-util": "workspace:*",
"@gnu-taler/taler-wallet-core": "workspace:*",
"@types/minimatch": "^3.0.3",
"axios": "^0.21.1",
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts
index acf46526f..8865c3303 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -14,34 +14,16 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
+/**
+ * Imports.
+ */
import os from "os";
import fs from "fs";
-import {
- getDefaultNodeWallet,
- Logger,
- Amounts,
- Wallet,
- OperationFailedAndReportedError,
- OperationFailedError,
- NodeHttpLib,
- PreparePayResultType,
- setDangerousTimetravel,
- classifyTalerUri,
- TalerUriType,
- decodeCrock,
- addPaytoQueryParams,
- codecForList,
- codecForString,
- printTestVectors,
- NodeThreadCryptoWorkerFactory,
- CryptoApi,
- rsaBlind,
- RecoveryMergeStrategy,
- stringToBytes,
-} from "@gnu-taler/taler-wallet-core";
-import * as clk from "./clk";
+import * as clk from "./clk.js";
import { deepStrictEqual } from "assert";
-import { getTestInfo, runTests } from "./integrationtests/testrunner";
+import { getTestInfo, runTests } from "./integrationtests/testrunner.js";
+import { PreparePayResultType, setDangerousTimetravel, classifyTalerUri, TalerUriType, RecoveryMergeStrategy, Amounts, addPaytoQueryParams, codecForList, codecForString } from "@gnu-taler/taler-util";
+import { Logger, Wallet, NodeHttpLib, getDefaultNodeWallet, OperationFailedAndReportedError, OperationFailedError, decodeCrock, rsaBlind, NodeThreadCryptoWorkerFactory, CryptoApi } from "@gnu-taler/taler-wallet-core";
// This module also serves as the entry point for the crypto
// thread worker, and thus must expose these two handlers.
@@ -811,9 +793,6 @@ testCli
});
});
-testCli.subcommand("vectors", "vectors").action(async (args) => {
- printTestVectors();
-});
async function read(stream: NodeJS.ReadStream) {
const chunks = [];
diff --git a/packages/taler-wallet-cli/src/integrationtests/harness.ts b/packages/taler-wallet-cli/src/integrationtests/harness.ts
index 31f9131a3..65ffdafb5 100644
--- a/packages/taler-wallet-cli/src/integrationtests/harness.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/harness.ts
@@ -30,81 +30,83 @@ import * as path from "path";
import * as http from "http";
import { deepStrictEqual } from "assert";
import { ChildProcess, spawn } from "child_process";
+import { URL } from "url";
+import axios, { AxiosError } from "axios";
+import {
+ codecForMerchantOrderPrivateStatusResponse,
+ codecForPostOrderResponse,
+ PostOrderRequest,
+ PostOrderResponse,
+ MerchantOrderPrivateStatusResponse,
+ TippingReserveStatus,
+ TipCreateConfirmation,
+ TipCreateRequest,
+ MerchantInstancesResponse,
+} from "./merchantApiTypes";
+import {
+ createEddsaKeyPair,
+ eddsaGetPublic,
+ EddsaKeyPair,
+ encodeCrock,
+ getRandomBytes,
+ openPromise,
+ OperationFailedError,
+} from "@gnu-taler/taler-wallet-core";
import {
- Configuration,
AmountJson,
Amounts,
+ Configuration,
+ AmountString,
Codec,
buildCodecForObject,
codecForString,
Duration,
+ parsePaytoUri,
CoreApiResponse,
- PreparePayResult,
+ ApplyRefundRequest,
+ ApplyRefundResponse,
+ codecForApplyRefundResponse,
PreparePayRequest,
+ PreparePayResult,
codecForPreparePayResult,
- OperationFailedError,
- AddExchangeRequest,
- ExchangesListRespose,
- codecForExchangesListResponse,
- GetWithdrawalDetailsForUriRequest,
- WithdrawUriInfoResponse,
- codecForWithdrawUriInfoResponse,
+ CreateDepositGroupRequest,
+ CreateDepositGroupResponse,
+ AbortPayWithRefundRequest,
ConfirmPayRequest,
ConfirmPayResult,
codecForConfirmPayResult,
- IntegrationTestArgs,
- TestPayArgs,
+ PrepareTipRequest,
+ PrepareTipResult,
+ codecForPrepareTipResult,
+ AcceptTipRequest,
+ CoinDumpJson,
+ codecForAny,
+ AddExchangeRequest,
+ ForceExchangeUpdateRequest,
+ ForceRefreshRequest,
+ ExchangesListRespose,
+ codecForExchangesListResponse,
BalancesResponse,
codecForBalancesResponse,
- encodeCrock,
- getRandomBytes,
- EddsaKeyPair,
- eddsaGetPublic,
- createEddsaKeyPair,
TransactionsResponse,
codecForTransactionsResponse,
- WithdrawTestBalanceRequest,
- AmountString,
- ApplyRefundRequest,
- codecForApplyRefundResponse,
- codecForAny,
- CoinDumpJson,
- ForceExchangeUpdateRequest,
- ForceRefreshRequest,
- PrepareTipResult,
- PrepareTipRequest,
- codecForPrepareTipResult,
- AcceptTipRequest,
- AbortPayWithRefundRequest,
- openPromise,
- parsePaytoUri,
- CreateDepositGroupRequest,
- CreateDepositGroupResponse,
TrackDepositGroupRequest,
TrackDepositGroupResponse,
+ IntegrationTestArgs,
+ TestPayArgs,
+ WithdrawTestBalanceRequest,
+ GetWithdrawalDetailsForUriRequest,
+ WithdrawUriInfoResponse,
+ codecForWithdrawUriInfoResponse,
+ BackupRecovery,
RecoveryLoadRequest,
-} from "@gnu-taler/taler-wallet-core";
-import { URL } from "url";
-import axios, { AxiosError } from "axios";
-import {
- codecForMerchantOrderPrivateStatusResponse,
- codecForPostOrderResponse,
- PostOrderRequest,
- PostOrderResponse,
- MerchantOrderPrivateStatusResponse,
- TippingReserveStatus,
- TipCreateConfirmation,
- TipCreateRequest,
- MerchantInstancesResponse,
-} from "./merchantApiTypes";
-import { ApplyRefundResponse } from "@gnu-taler/taler-wallet-core";
-import { PendingOperationsResponse } from "@gnu-taler/taler-wallet-core";
-import { CoinConfig } from "./denomStructures";
+} from "@gnu-taler/taler-util";
import {
AddBackupProviderRequest,
BackupInfo,
- BackupRecovery,
} from "@gnu-taler/taler-wallet-core/src/operations/backup";
+import { PendingOperationsResponse } from "@gnu-taler/taler-wallet-core/src/pending-types";
+import { CoinConfig } from "./denomStructures.js";
const exec = util.promisify(require("child_process").exec);
@@ -486,7 +488,7 @@ export async function pingProc(
}
}
-export interface ExchangeBankAccount {
+export interface HarnessExchangeBankAccount {
accountName: string;
accountPassword: string;
accountPaytoUri: string;
@@ -573,7 +575,7 @@ export namespace BankApi {
export async function adminAddIncoming(
bank: BankServiceInterface,
params: {
- exchangeBankAccount: ExchangeBankAccount;
+ exchangeBankAccount: HarnessExchangeBankAccount;
amount: string;
reservePub: string;
debitAccountPayto: string;
@@ -701,7 +703,7 @@ export class BankService implements BankServiceInterface {
async createExchangeAccount(
accountName: string,
password: string,
- ): Promise<ExchangeBankAccount> {
+ ): Promise<HarnessExchangeBankAccount> {
await sh(
this.globalTestState,
"taler-bank-manage_django",
@@ -944,7 +946,7 @@ export class ExchangeService implements ExchangeServiceInterface {
async addBankAccount(
localName: string,
- exchangeBankAccount: ExchangeBankAccount,
+ exchangeBankAccount: HarnessExchangeBankAccount,
): Promise<void> {
const config = Configuration.load(this.configFilename);
config.setString(
diff --git a/packages/taler-wallet-cli/src/integrationtests/helpers.ts b/packages/taler-wallet-cli/src/integrationtests/helpers.ts
index bca983758..35146a82c 100644
--- a/packages/taler-wallet-cli/src/integrationtests/helpers.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/helpers.ts
@@ -24,38 +24,38 @@
* Imports
*/
import {
- GlobalTestState,
+ FaultInjectedExchangeService,
+ FaultInjectedMerchantService,
+} from "./faultInjection";
+import { CoinConfig, defaultCoinConfig } from "./denomStructures";
+import {
+ AmountString,
+ Duration,
+ ContractTerms,
+ PreparePayResultType,
+ ConfirmPayResultType,
+} from "@gnu-taler/taler-util";
+import {
DbInfo,
+ BankService,
ExchangeService,
- WalletCli,
MerchantService,
+ WalletCli,
+ GlobalTestState,
setupDb,
- BankService,
- ExchangeBankAccount,
- MerchantServiceInterface,
+ ExchangeServiceInterface,
BankApi,
BankAccessApi,
+ MerchantServiceInterface,
MerchantPrivateApi,
- ExchangeServiceInterface,
-} from "./harness";
-import {
- AmountString,
- Duration,
- PreparePayResultType,
- ConfirmPayResultType,
- ContractTerms,
-} from "@gnu-taler/taler-wallet-core";
-import {
- FaultInjectedExchangeService,
- FaultInjectedMerchantService,
-} from "./faultInjection";
-import { CoinConfig, defaultCoinConfig } from "./denomStructures";
+ HarnessExchangeBankAccount,
+} from "./harness.js";
export interface SimpleTestEnvironment {
commonDb: DbInfo;
bank: BankService;
exchange: ExchangeService;
- exchangeBankAccount: ExchangeBankAccount;
+ exchangeBankAccount: HarnessExchangeBankAccount;
merchant: MerchantService;
wallet: WalletCli;
}
@@ -154,7 +154,7 @@ export interface FaultyMerchantTestEnvironment {
bank: BankService;
exchange: ExchangeService;
faultyExchange: FaultInjectedExchangeService;
- exchangeBankAccount: ExchangeBankAccount;
+ exchangeBankAccount: HarnessExchangeBankAccount;
merchant: MerchantService;
faultyMerchant: FaultInjectedMerchantService;
wallet: WalletCli;
diff --git a/packages/taler-wallet-cli/src/integrationtests/merchantApiTypes.ts b/packages/taler-wallet-cli/src/integrationtests/merchantApiTypes.ts
index 1326d3a53..2233c7ad2 100644
--- a/packages/taler-wallet-cli/src/integrationtests/merchantApiTypes.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/merchantApiTypes.ts
@@ -41,7 +41,7 @@ import {
Timestamp,
CoinPublicKeyString,
EddsaPublicKeyString,
-} from "@gnu-taler/taler-wallet-core";
+} from "@gnu-taler/taler-util";
import { codecForAmountString } from "@gnu-taler/taler-wallet-core/lib/util/amounts";
export interface PostOrderRequest {
diff --git a/packages/taler-wallet-cli/src/integrationtests/sync.ts b/packages/taler-wallet-cli/src/integrationtests/sync.ts
index 83024ec79..e0f9e22c3 100644
--- a/packages/taler-wallet-cli/src/integrationtests/sync.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/sync.ts
@@ -18,7 +18,7 @@
* Imports.
*/
import axios from "axios";
-import { Configuration, URL } from "@gnu-taler/taler-wallet-core";
+import { URL } from "@gnu-taler/taler-wallet-core";
import * as fs from "fs";
import * as util from "util";
import {
@@ -30,6 +30,7 @@ import {
setupDb,
sh,
} from "./harness";
+import { Configuration } from "@gnu-taler/taler-util";
const exec = util.promisify(require("child_process").exec);
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts b/packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts
index 1b7deefc5..0d0253d71 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts
@@ -28,11 +28,9 @@ import {
BankAccessApi,
} from "./harness";
import {
- PreparePayResultType,
- ExchangesListRespose,
URL,
- TalerErrorCode,
} from "@gnu-taler/taler-wallet-core";
+import { ExchangesListRespose, TalerErrorCode } from "@gnu-taler/taler-util";
import {
FaultInjectedExchangeService,
FaultInjectionResponseContext,
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts
index 609ec596f..655f18632 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts
@@ -17,11 +17,11 @@
/**
* Imports.
*/
-import { CoreApiResponse } from "@gnu-taler/taler-wallet-core";
+import { CoreApiResponse } from "@gnu-taler/taler-util";
import { CoinConfig, defaultCoinConfig } from "./denomStructures";
import {
DbInfo,
- ExchangeBankAccount,
+ HarnessExchangeBankAccount,
ExchangeService,
GlobalTestState,
MerchantService,
@@ -44,7 +44,7 @@ const merchantIban = "DE42500105171245624648";
export interface LibeufinTestEnvironment {
commonDb: DbInfo;
exchange: ExchangeService;
- exchangeBankAccount: ExchangeBankAccount;
+ exchangeBankAccount: HarnessExchangeBankAccount;
merchant: MerchantService;
wallet: WalletCli;
libeufinSandbox: LibeufinSandboxService;
@@ -181,7 +181,7 @@ export async function createLibeufinTestEnvironment(
database: db.connStr,
});
- const exchangeBankAccount: ExchangeBankAccount = {
+ const exchangeBankAccount: HarnessExchangeBankAccount = {
accountName: "twguser",
accountPassword: "twgpw",
accountPaytoUri: `payto://iban/${exchangeIban}?receiver-name=Exchange`,
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts
index 2ceb8be0e..0adabbf4e 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts
@@ -17,15 +17,11 @@
/**
* Imports.
*/
-import { CoreApiResponse } from "@gnu-taler/taler-wallet-core";
-import { CoinConfig, defaultCoinConfig } from "./denomStructures";
import { GlobalTestState } from "./harness";
-import { getRandomIban } from "./helpers";
import {
SandboxUserBundle,
NexusUserBundle,
launchLibeufinServices,
- LibeufinNexusApi,
LibeufinSandboxApi,
} from "./libeufin";
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-tutorial.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-tutorial.ts
index 23fc9126d..271eedbc2 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-tutorial.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-tutorial.ts
@@ -17,13 +17,9 @@
/**
* Imports.
*/
-import { CoreApiResponse } from "@gnu-taler/taler-wallet-core";
-import { CoinConfig, defaultCoinConfig } from "./denomStructures";
import { GlobalTestState } from "./harness";
import {
- LibeufinNexusApi,
LibeufinNexusService,
- LibeufinSandboxApi,
LibeufinSandboxService,
LibeufinCli,
} from "./libeufin";
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-merchant-exchange-confusion.ts b/packages/taler-wallet-cli/src/integrationtests/test-merchant-exchange-confusion.ts
index a60f7f015..a14b63e00 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-merchant-exchange-confusion.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-merchant-exchange-confusion.ts
@@ -35,8 +35,7 @@ import {
PreparePayResultType,
codecForMerchantOrderStatusUnpaid,
ConfirmPayResultType,
- URL,
-} from "@gnu-taler/taler-wallet-core";
+} from "@gnu-taler/taler-util";
import axios from "axios";
import {
FaultInjectedExchangeService,
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-merchant-longpolling.ts b/packages/taler-wallet-cli/src/integrationtests/test-merchant-longpolling.ts
index 17563c027..0f6ba654f 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-merchant-longpolling.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-merchant-longpolling.ts
@@ -23,9 +23,9 @@ import {
PreparePayResultType,
codecForMerchantOrderStatusUnpaid,
ConfirmPayResultType,
- URL,
-} from "@gnu-taler/taler-wallet-core";
+} from "@gnu-taler/taler-util";
import axios from "axios";
+import { URL } from "@gnu-taler/taler-wallet-core";
/**
* Run test for basic, bank-integrated withdrawal.
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-merchant-refund-api.ts b/packages/taler-wallet-cli/src/integrationtests/test-merchant-refund-api.ts
index 07ed56397..25c2ea365 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-merchant-refund-api.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-merchant-refund-api.ts
@@ -33,9 +33,9 @@ import {
import {
durationFromSpec,
PreparePayResultType,
- URL,
-} from "@gnu-taler/taler-wallet-core";
+} from "@gnu-taler/taler-util";
import axios from "axios";
+import { URL } from "@gnu-taler/taler-wallet-core";
async function testRefundApiWithFulfillmentUrl(
t: GlobalTestState,
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-pay-abort.ts b/packages/taler-wallet-cli/src/integrationtests/test-pay-abort.ts
index 44a81b516..1a4219a94 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-pay-abort.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-pay-abort.ts
@@ -22,9 +22,8 @@
/**
* Imports.
*/
+import { PreparePayResultType, TalerErrorCode } from "@gnu-taler/taler-util";
import {
- PreparePayResultType,
- TalerErrorCode,
URL,
} from "@gnu-taler/taler-wallet-core";
import {
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-pay-paid.ts b/packages/taler-wallet-cli/src/integrationtests/test-pay-paid.ts
index f826bdc6d..575228a8b 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-pay-paid.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-pay-paid.ts
@@ -26,10 +26,10 @@ import {
PreparePayResultType,
codecForMerchantOrderStatusUnpaid,
ConfirmPayResultType,
- URL,
-} from "@gnu-taler/taler-wallet-core";
+} from "@gnu-taler/taler-util";
import axios from "axios";
import { FaultInjectionRequestContext } from "./faultInjection";
+import { URL } from "@gnu-taler/taler-wallet-core";
/**
* Run test for the wallets repurchase detection mechanism
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-payment-claim.ts b/packages/taler-wallet-cli/src/integrationtests/test-payment-claim.ts
index 2432c1118..a26b6724b 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-payment-claim.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-payment-claim.ts
@@ -21,8 +21,8 @@ import { GlobalTestState, MerchantPrivateApi, WalletCli } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
import {
PreparePayResultType,
- TalerErrorCode,
-} from "@gnu-taler/taler-wallet-core";
+} from "@gnu-taler/taler-util";
+import { TalerErrorCode } from "@gnu-taler/taler-util";
/**
* Run test for basic, bank-integrated withdrawal.
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-payment-fault.ts b/packages/taler-wallet-cli/src/integrationtests/test-payment-fault.ts
index 713f7162f..d467eb66f 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-payment-fault.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-payment-fault.ts
@@ -37,7 +37,7 @@ import {
FaultInjectionRequestContext,
FaultInjectionResponseContext,
} from "./faultInjection";
-import { CoreApiResponse } from "@gnu-taler/taler-wallet-core";
+import { CoreApiResponse } from "@gnu-taler/taler-util";
import { defaultCoinConfig } from "./denomStructures";
/**
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-payment-idempotency.ts b/packages/taler-wallet-cli/src/integrationtests/test-payment-idempotency.ts
index d456554cc..4d7d5f959 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-payment-idempotency.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-payment-idempotency.ts
@@ -19,7 +19,7 @@
*/
import { GlobalTestState, MerchantPrivateApi } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
-import { PreparePayResultType } from "@gnu-taler/taler-wallet-core";
+import { PreparePayResultType } from "@gnu-taler/taler-util";
/**
* Test the wallet-core payment API, especially that repeated operations
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts b/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts
index b9e5670d8..8825def7a 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts
@@ -22,20 +22,13 @@ import {
withdrawViaBank,
createFaultInjectedMerchantTestkudosEnvironment,
} from "./helpers";
-import {
- PreparePayResultType,
- codecForMerchantOrderStatusUnpaid,
- ConfirmPayResultType,
- URL,
- codecForExchangeKeysJson,
- TalerErrorDetails,
- TalerErrorCode,
-} from "@gnu-taler/taler-wallet-core";
import axios from "axios";
import {
FaultInjectionRequestContext,
FaultInjectionResponseContext,
} from "./faultInjection";
+import { codecForMerchantOrderStatusUnpaid, ConfirmPayResultType, PreparePayResultType, TalerErrorCode, TalerErrorDetails } from "@gnu-taler/taler-util";
+import { URL } from "@gnu-taler/taler-wallet-core";
/**
* Run test for a payment where the merchant has a transient
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-paywall-flow.ts b/packages/taler-wallet-cli/src/integrationtests/test-paywall-flow.ts
index 4d5fac5c6..85bcbfd0e 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-paywall-flow.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-paywall-flow.ts
@@ -23,7 +23,7 @@ import {
PreparePayResultType,
codecForMerchantOrderStatusUnpaid,
ConfirmPayResultType,
-} from "@gnu-taler/taler-wallet-core";
+} from "@gnu-taler/taler-util";
import axios from "axios";
/**
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-refund-auto.ts b/packages/taler-wallet-cli/src/integrationtests/test-refund-auto.ts
index 4ec4ff5a6..1b3fb2852 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-refund-auto.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-refund-auto.ts
@@ -19,7 +19,7 @@
*/
import { GlobalTestState, MerchantPrivateApi } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
-import { durationFromSpec } from "@gnu-taler/taler-wallet-core";
+import { durationFromSpec } from "@gnu-taler/taler-util";
/**
* Run test for basic, bank-integrated withdrawal.
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-refund-gone.ts b/packages/taler-wallet-cli/src/integrationtests/test-refund-gone.ts
index 74c99ec37..7158a40af 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-refund-gone.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-refund-gone.ts
@@ -28,7 +28,7 @@ import {
timestampAddDuration,
getTimestampNow,
timestampTruncateToSecond,
-} from "@gnu-taler/taler-wallet-core";
+} from "@gnu-taler/taler-util";
/**
* Run test for basic, bank-integrated withdrawal.
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-refund-incremental.ts b/packages/taler-wallet-cli/src/integrationtests/test-refund-incremental.ts
index 69d503269..9f961b2b7 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-refund-incremental.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-refund-incremental.ts
@@ -23,7 +23,7 @@ import {
TransactionType,
Amounts,
durationFromSpec,
-} from "@gnu-taler/taler-wallet-core";
+} from "@gnu-taler/taler-util";
/**
* Run test for basic, bank-integrated withdrawal.
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-refund.ts b/packages/taler-wallet-cli/src/integrationtests/test-refund.ts
index c6af7cdc1..b97b21b3e 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-refund.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-refund.ts
@@ -17,7 +17,7 @@
/**
* Imports.
*/
-import { durationFromSpec } from "@gnu-taler/taler-wallet-core";
+import { durationFromSpec } from "@gnu-taler/taler-util";
import { GlobalTestState, MerchantPrivateApi } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-timetravel-autorefresh.ts b/packages/taler-wallet-cli/src/integrationtests/test-timetravel-autorefresh.ts
index f7e51e714..c54f667a1 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-timetravel-autorefresh.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-timetravel-autorefresh.ts
@@ -21,9 +21,9 @@ import {
ConfirmPayResultType,
Duration,
durationFromSpec,
- PendingOperationsResponse,
PreparePayResultType,
-} from "@gnu-taler/taler-wallet-core";
+} from "@gnu-taler/taler-util";
+import { PendingOperationsResponse } from "@gnu-taler/taler-wallet-core";
import { makeNoFeeCoinConfig } from "./denomStructures";
import {
BankService,
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-timetravel-withdraw.ts b/packages/taler-wallet-cli/src/integrationtests/test-timetravel-withdraw.ts
index 3b2fac582..4af85585a 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-timetravel-withdraw.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-timetravel-withdraw.ts
@@ -23,7 +23,7 @@ import {
withdrawViaBank,
startWithdrawViaBank,
} from "./helpers";
-import { Duration, TransactionType } from "@gnu-taler/taler-wallet-core";
+import { Duration, TransactionType } from "@gnu-taler/taler-util";
/**
* Basic time travel test.
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-doublespend.ts b/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-doublespend.ts
index 94cad7510..ef53046cd 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-doublespend.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-doublespend.ts
@@ -17,12 +17,9 @@
/**
* Imports.
*/
-import { PreparePayResultType } from "@gnu-taler/taler-wallet-core";
-import { testPay } from "@gnu-taler/taler-wallet-core/src/operations/testing";
+import { PreparePayResultType } from "@gnu-taler/taler-util";
import {
GlobalTestState,
- BankApi,
- BankAccessApi,
WalletCli,
MerchantPrivateApi,
} from "./harness";
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-withdrawal-abort-bank.ts b/packages/taler-wallet-cli/src/integrationtests/test-withdrawal-abort-bank.ts
index 861e616e6..6cd508b25 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-withdrawal-abort-bank.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-withdrawal-abort-bank.ts
@@ -17,12 +17,9 @@
/**
* Imports.
*/
+import { TalerErrorCode } from "@gnu-taler/taler-util";
import { GlobalTestState, BankApi, BankAccessApi } from "./harness";
import { createSimpleTestkudosEnvironment } from "./helpers";
-import {
- codecForBalancesResponse,
- TalerErrorCode,
-} from "@gnu-taler/taler-wallet-core";
/**
* Run test for basic, bank-integrated withdrawal.
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-withdrawal-bank-integrated.ts b/packages/taler-wallet-cli/src/integrationtests/test-withdrawal-bank-integrated.ts
index e21434ff3..1a3268ada 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-withdrawal-bank-integrated.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-withdrawal-bank-integrated.ts
@@ -19,7 +19,7 @@
*/
import { GlobalTestState, BankApi, BankAccessApi } from "./harness";
import { createSimpleTestkudosEnvironment } from "./helpers";
-import { codecForBalancesResponse } from "@gnu-taler/taler-wallet-core";
+import { codecForBalancesResponse } from "@gnu-taler/taler-util";
/**
* Run test for basic, bank-integrated withdrawal.
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-withdrawal-manual.ts b/packages/taler-wallet-cli/src/integrationtests/test-withdrawal-manual.ts
index dc0180dea..5921510bf 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-withdrawal-manual.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-withdrawal-manual.ts
@@ -19,8 +19,8 @@
*/
import { GlobalTestState, BankApi } from "./harness";
import { createSimpleTestkudosEnvironment } from "./helpers";
-import { CoreApiResponse } from "@gnu-taler/taler-wallet-core";
-import { codecForBalancesResponse } from "@gnu-taler/taler-wallet-core";
+import { CoreApiResponse } from "@gnu-taler/taler-util";
+import { codecForBalancesResponse } from "@gnu-taler/taler-util";
/**
* Run test for basic, bank-integrated withdrawal.
diff --git a/packages/taler-wallet-cli/tsconfig.json b/packages/taler-wallet-cli/tsconfig.json
index 5985a516d..5ded91d7a 100644
--- a/packages/taler-wallet-cli/tsconfig.json
+++ b/packages/taler-wallet-cli/tsconfig.json
@@ -25,6 +25,9 @@
"references": [
{
"path": "../taler-wallet-core/"
+ },
+ {
+ "path": "../taler-util/"
}
]
}
diff --git a/packages/taler-wallet-core/package.json b/packages/taler-wallet-core/package.json
index 82ef825bb..15485cb56 100644
--- a/packages/taler-wallet-core/package.json
+++ b/packages/taler-wallet-core/package.json
@@ -58,6 +58,7 @@
},
"dependencies": {
"@gnu-taler/idb-bridge": "workspace:*",
+ "@gnu-taler/taler-util": "workspace:*",
"@types/node": "^14.14.22",
"axios": "^0.21.1",
"big-integer": "^1.6.48",
diff --git a/packages/taler-wallet-core/src/types/cryptoTypes.ts b/packages/taler-wallet-core/src/crypto/cryptoTypes.ts
index 9b67b5963..922fbbfac 100644
--- a/packages/taler-wallet-core/src/types/cryptoTypes.ts
+++ b/packages/taler-wallet-core/src/crypto/cryptoTypes.ts
@@ -27,7 +27,7 @@
/**
* Imports.
*/
-import { AmountJson } from "../util/amounts";
+import { AmountJson } from "@gnu-taler/taler-util";
export interface RefreshNewDenomInfo {
count: number;
diff --git a/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts b/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts
index d7eddd699..c124b89d4 100644
--- a/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts
+++ b/packages/taler-wallet-core/src/crypto/workers/cryptoApi.ts
@@ -22,11 +22,11 @@
/**
* Imports.
*/
-import { CoinRecord, DenominationRecord, WireFee } from "../../types/dbTypes";
+import { CoinRecord, DenominationRecord, WireFee } from "../../db";
import { CryptoWorker } from "./cryptoWorker";
-import { RecoupRequest, CoinDepositPermission } from "../../types/talerTypes";
+import { RecoupRequest, CoinDepositPermission } from "@gnu-taler/taler-util";
import {
BenchmarkResult,
@@ -34,7 +34,7 @@ import {
PlanchetCreationRequest,
DepositInfo,
MakeSyncSignatureRequest,
-} from "../../types/walletTypes";
+} from "@gnu-taler/taler-util";
import * as timer from "../../util/timer";
import { Logger } from "../../util/logging";
@@ -44,7 +44,7 @@ import {
DeriveRefreshSessionRequest,
DeriveTipRequest,
SignTrackTransactionRequest,
-} from "../../types/cryptoTypes";
+} from "../cryptoTypes.js";
const logger = new Logger("cryptoApi.ts");
diff --git a/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts b/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts
index 87fad8634..6e9427e57 100644
--- a/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts
+++ b/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts
@@ -26,23 +26,25 @@
* Imports.
*/
+// FIXME: Crypto should not use DB Types!
import {
CoinRecord,
DenominationRecord,
RefreshPlanchet,
WireFee,
CoinSourceType,
-} from "../../types/dbTypes";
+} from "../../db.js";
-import { CoinDepositPermission, RecoupRequest } from "../../types/talerTypes";
+import { CoinDepositPermission, RecoupRequest } from "@gnu-taler/taler-util";
+// FIXME: These types should be internal to the wallet!
import {
BenchmarkResult,
PlanchetCreationResult,
PlanchetCreationRequest,
DepositInfo,
MakeSyncSignatureRequest,
-} from "../../types/walletTypes";
-import { AmountJson, Amounts } from "../../util/amounts";
+} from "@gnu-taler/taler-util";
+import { AmountJson, Amounts } from "@gnu-taler/taler-util";
import * as timer from "../../util/timer";
import {
encodeCrock,
@@ -64,7 +66,7 @@ import {
} from "../talerCrypto";
import { randomBytes } from "../primitives/nacl-fast";
import { kdf } from "../primitives/kdf";
-import { Timestamp, timestampTruncateToSecond } from "../../util/time";
+import { Timestamp, timestampTruncateToSecond } from "@gnu-taler/taler-util";
import { Logger } from "../../util/logging";
import {
@@ -73,7 +75,7 @@ import {
DeriveRefreshSessionRequest,
DeriveTipRequest,
SignTrackTransactionRequest,
-} from "../../types/cryptoTypes";
+} from "../cryptoTypes.js";
const logger = new Logger("cryptoImplementation.ts");
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index bc0e45017..c1076b900 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -1,4 +1,3 @@
-import { MetaStores, Stores } from "./types/dbTypes";
import {
openDatabase,
Database,
@@ -11,8 +10,12 @@ import {
IDBDatabase,
IDBObjectStore,
IDBTransaction,
+ IDBKeyPath,
} from "@gnu-taler/idb-bridge";
import { Logger } from "./util/logging";
+import { AmountJson, AmountString, Auditor, CoinDepositPermission, ContractTerms, Duration, ExchangeSignKeyJson, InternationalizedString, MerchantInfo, Product, RefreshReason, ReserveTransaction, TalerErrorDetails, Timestamp } from "@gnu-taler/taler-util";
+import { RetryInfo } from "./util/retries.js";
+import { PayCoinSelection } from "./util/coinSelection.js";
/**
* Name of the Taler database. This is effectively the major
@@ -166,3 +169,1735 @@ export async function openTalerDatabase(
export function deleteTalerDatabase(idbFactory: IDBFactory): void {
Database.deleteDatabase(idbFactory, TALER_DB_NAME);
}
+
+
+export enum ReserveRecordStatus {
+ /**
+ * Reserve must be registered with the bank.
+ */
+ REGISTERING_BANK = "registering-bank",
+
+ /**
+ * We've registered reserve's information with the bank
+ * and are now waiting for the user to confirm the withdraw
+ * with the bank (typically 2nd factor auth).
+ */
+ WAIT_CONFIRM_BANK = "wait-confirm-bank",
+
+ /**
+ * Querying reserve status with the exchange.
+ */
+ QUERYING_STATUS = "querying-status",
+
+ /**
+ * The corresponding withdraw record has been created.
+ * No further processing is done, unless explicitly requested
+ * by the user.
+ */
+ DORMANT = "dormant",
+
+ /**
+ * The bank aborted the withdrawal.
+ */
+ BANK_ABORTED = "bank-aborted",
+}
+
+export interface ReserveBankInfo {
+ /**
+ * Status URL that the wallet will use to query the status
+ * of the Taler withdrawal operation on the bank's side.
+ */
+ statusUrl: string;
+
+ confirmUrl?: string;
+
+ /**
+ * Exchange payto URI that the bank will use to fund the reserve.
+ */
+ exchangePaytoUri: string;
+}
+
+/**
+ * A reserve record as stored in the wallet's database.
+ */
+export interface ReserveRecord {
+ /**
+ * The reserve public key.
+ */
+ reservePub: string;
+
+ /**
+ * The reserve private key.
+ */
+ reservePriv: string;
+
+ /**
+ * The exchange base URL.
+ */
+ exchangeBaseUrl: string;
+
+ /**
+ * Currency of the reserve.
+ */
+ currency: string;
+
+ /**
+ * Time when the reserve was created.
+ */
+ timestampCreated: Timestamp;
+
+ /**
+ * Time when the information about this reserve was posted to the bank.
+ *
+ * Only applies if bankWithdrawStatusUrl is defined.
+ *
+ * Set to 0 if that hasn't happened yet.
+ */
+ timestampReserveInfoPosted: Timestamp | undefined;
+
+ /**
+ * Time when the reserve was confirmed by the bank.
+ *
+ * Set to undefined if not confirmed yet.
+ */
+ timestampBankConfirmed: Timestamp | undefined;
+
+ /**
+ * Wire information (as payto URI) for the bank account that
+ * transfered funds for this reserve.
+ */
+ senderWire?: string;
+
+ /**
+ * Amount that was sent by the user to fund the reserve.
+ */
+ instructedAmount: AmountJson;
+
+ /**
+ * Extra state for when this is a withdrawal involving
+ * a Taler-integrated bank.
+ */
+ bankInfo?: ReserveBankInfo;
+
+ initialWithdrawalGroupId: string;
+
+ /**
+ * Did we start the first withdrawal for this reserve?
+ *
+ * We only report a pending withdrawal for the reserve before
+ * the first withdrawal has started.
+ */
+ initialWithdrawalStarted: boolean;
+
+ /**
+ * Initial denomination selection, stored here so that
+ * we can show this information in the transactions/balances
+ * before we have a withdrawal group.
+ */
+ initialDenomSel: DenomSelectionState;
+
+ reserveStatus: ReserveRecordStatus;
+
+ /**
+ * Was a reserve query requested? If so, query again instead
+ * of going into dormant status.
+ */
+ requestedQuery: boolean;
+
+ /**
+ * Time of the last successful status query.
+ */
+ lastSuccessfulStatusQuery: Timestamp | undefined;
+
+ /**
+ * Retry info. This field is present even if no retry is scheduled,
+ * because we need it to be present for the index on the object store
+ * to work.
+ */
+ retryInfo: RetryInfo;
+
+ /**
+ * Last error that happened in a reserve operation
+ * (either talking to the bank or the exchange).
+ */
+ lastError: TalerErrorDetails | undefined;
+}
+
+/**
+ * Auditor record as stored with currencies in the exchange database.
+ */
+export interface AuditorRecord {
+ /**
+ * Base url of the auditor.
+ */
+ baseUrl: string;
+
+ /**
+ * Public signing key of the auditor.
+ */
+ auditorPub: string;
+
+ /**
+ * Time when the auditing expires.
+ */
+ expirationStamp: number;
+}
+
+/**
+ * Exchange for currencies as stored in the wallet's currency
+ * information database.
+ */
+export interface ExchangeForCurrencyRecord {
+ /**
+ * FIXME: unused?
+ */
+ exchangeMasterPub: string;
+
+ /**
+ * Base URL of the exchange.
+ */
+ exchangeBaseUrl: string;
+}
+
+/**
+ * Information about a currency as displayed in the wallet's database.
+ */
+export interface CurrencyRecord {
+ /**
+ * Name of the currency.
+ */
+ name: string;
+
+ /**
+ * Number of fractional digits to show when rendering the currency.
+ */
+ fractionalDigits: number;
+
+ /**
+ * Auditors that the wallet trusts for this currency.
+ */
+ auditors: AuditorRecord[];
+
+ /**
+ * Exchanges that the wallet trusts for this currency.
+ */
+ exchanges: ExchangeForCurrencyRecord[];
+}
+
+/**
+ * Status of a denomination.
+ */
+export enum DenominationStatus {
+ /**
+ * Verification was delayed.
+ */
+ Unverified = "unverified",
+ /**
+ * Verified as valid.
+ */
+ VerifiedGood = "verified-good",
+ /**
+ * Verified as invalid.
+ */
+ VerifiedBad = "verified-bad",
+}
+
+/**
+ * Denomination record as stored in the wallet's database.
+ */
+export interface DenominationRecord {
+ /**
+ * Value of one coin of the denomination.
+ */
+ value: AmountJson;
+
+ /**
+ * The denomination public key.
+ */
+ denomPub: string;
+
+ /**
+ * Hash of the denomination public key.
+ * Stored in the database for faster lookups.
+ */
+ denomPubHash: string;
+
+ /**
+ * Fee for withdrawing.
+ */
+ feeWithdraw: AmountJson;
+
+ /**
+ * Fee for depositing.
+ */
+ feeDeposit: AmountJson;
+
+ /**
+ * Fee for refreshing.
+ */
+ feeRefresh: AmountJson;
+
+ /**
+ * Fee for refunding.
+ */
+ feeRefund: AmountJson;
+
+ /**
+ * Validity start date of the denomination.
+ */
+ stampStart: Timestamp;
+
+ /**
+ * Date after which the currency can't be withdrawn anymore.
+ */
+ stampExpireWithdraw: Timestamp;
+
+ /**
+ * Date after the denomination officially doesn't exist anymore.
+ */
+ stampExpireLegal: Timestamp;
+
+ /**
+ * Data after which coins of this denomination can't be deposited anymore.
+ */
+ stampExpireDeposit: Timestamp;
+
+ /**
+ * Signature by the exchange's master key over the denomination
+ * information.
+ */
+ masterSig: string;
+
+ /**
+ * Did we verify the signature on the denomination?
+ *
+ * FIXME: Rename to "verificationStatus"?
+ */
+ status: DenominationStatus;
+
+ /**
+ * Was this denomination still offered by the exchange the last time
+ * we checked?
+ * Only false when the exchange redacts a previously published denomination.
+ */
+ isOffered: boolean;
+
+ /**
+ * Did the exchange revoke the denomination?
+ * When this field is set to true in the database, the same transaction
+ * should also mark all affected coins as revoked.
+ */
+ isRevoked: boolean;
+
+ /**
+ * Base URL of the exchange.
+ */
+ exchangeBaseUrl: string;
+}
+
+/**
+ * Details about the exchange that we only know after
+ * querying /keys and /wire.
+ */
+export interface ExchangeDetails {
+ /**
+ * Master public key of the exchange.
+ */
+ masterPublicKey: string;
+
+ /**
+ * Auditors (partially) auditing the exchange.
+ */
+ auditors: Auditor[];
+
+ /**
+ * Currency that the exchange offers.
+ */
+ currency: string;
+
+ /**
+ * Last observed protocol version.
+ */
+ protocolVersion: string;
+
+ reserveClosingDelay: Duration;
+
+ /**
+ * Signing keys we got from the exchange, can also contain
+ * older signing keys that are not returned by /keys anymore.
+ */
+ signingKeys: ExchangeSignKeyJson[];
+
+ /**
+ * Timestamp for last update.
+ */
+ lastUpdateTime: Timestamp;
+
+ /**
+ * When should we next update the information about the exchange?
+ */
+ nextUpdateTime: Timestamp;
+}
+
+export enum ExchangeUpdateStatus {
+ FetchKeys = "fetch-keys",
+ FetchWire = "fetch-wire",
+ FetchTerms = "fetch-terms",
+ FinalizeUpdate = "finalize-update",
+ Finished = "finished",
+}
+
+export interface ExchangeBankAccount {
+ payto_uri: string;
+ master_sig: string;
+}
+
+export interface ExchangeWireInfo {
+ feesForType: { [wireMethod: string]: WireFee[] };
+ accounts: ExchangeBankAccount[];
+}
+
+export enum ExchangeUpdateReason {
+ Initial = "initial",
+ Forced = "forced",
+ Scheduled = "scheduled",
+}
+
+/**
+ * Exchange record as stored in the wallet's database.
+ */
+export interface ExchangeRecord {
+ /**
+ * Base url of the exchange.
+ */
+ baseUrl: string;
+
+ /**
+ * Did we finish adding the exchange?
+ */
+ addComplete: boolean;
+
+ /**
+ * Is this a permanent or temporary exchange record?
+ */
+ permanent: boolean;
+
+ /**
+ * Was the exchange added as a built-in exchange?
+ */
+ builtIn: boolean;
+
+ /**
+ * Details, once known.
+ */
+ details: ExchangeDetails | undefined;
+
+ /**
+ * Mapping from wire method type to the wire fee.
+ */
+ wireInfo: ExchangeWireInfo | undefined;
+
+ /**
+ * Terms of service text or undefined if not downloaded yet.
+ *
+ * This is just used as a cache of the last downloaded ToS.
+ */
+ termsOfServiceText: string | undefined;
+
+ /**
+ * ETag for last terms of service download.
+ */
+ termsOfServiceLastEtag: string | undefined;
+
+ /**
+ * ETag for last terms of service download.
+ */
+ termsOfServiceAcceptedEtag: string | undefined;
+
+ /**
+ * Time when the update to the exchange has been started or
+ * undefined if no update is in progress.
+ */
+ updateStarted: Timestamp | undefined;
+
+ /**
+ * Status of updating the info about the exchange.
+ */
+ updateStatus: ExchangeUpdateStatus;
+
+ updateReason?: ExchangeUpdateReason;
+
+ lastError?: TalerErrorDetails;
+
+ /**
+ * Retry status for fetching updated information about the exchange.
+ */
+ retryInfo: RetryInfo;
+
+ /**
+ * Next time that we should check if coins need to be refreshed.
+ *
+ * Updated whenever the exchange's denominations are updated or when
+ * the refresh check has been done.
+ */
+ nextRefreshCheck?: Timestamp;
+}
+
+/**
+ * A coin that isn't yet signed by an exchange.
+ */
+export interface PlanchetRecord {
+ /**
+ * Public key of the coin.
+ */
+ coinPub: string;
+
+ /**
+ * Private key of the coin.
+ */
+ coinPriv: string;
+
+ /**
+ * Withdrawal group that this planchet belongs to
+ * (or the empty string).
+ */
+ withdrawalGroupId: string;
+
+ /**
+ * Index within the withdrawal group (or -1).
+ */
+ coinIdx: number;
+
+ withdrawalDone: boolean;
+
+ lastError: TalerErrorDetails | undefined;
+
+ /**
+ * Public key of the reserve that this planchet
+ * is being withdrawn from.
+ *
+ * Can be the empty string (non-null/undefined for DB indexing)
+ * if this is a tipping reserve.
+ */
+ reservePub: string;
+
+ denomPubHash: string;
+
+ denomPub: string;
+
+ blindingKey: string;
+
+ withdrawSig: string;
+
+ coinEv: string;
+
+ coinEvHash: string;
+
+ coinValue: AmountJson;
+
+ isFromTip: boolean;
+}
+
+/**
+ * Planchet for a coin during refrehs.
+ */
+export interface RefreshPlanchet {
+ /**
+ * Public key for the coin.
+ */
+ publicKey: string;
+
+ /**
+ * Private key for the coin.
+ */
+ privateKey: string;
+
+ /**
+ * Blinded public key.
+ */
+ coinEv: string;
+
+ coinEvHash: string;
+
+ /**
+ * Blinding key used.
+ */
+ blindingKey: string;
+}
+
+/**
+ * Status of a coin.
+ */
+export enum CoinStatus {
+ /**
+ * Withdrawn and never shown to anybody.
+ */
+ Fresh = "fresh",
+ /**
+ * A coin that has been spent and refreshed.
+ */
+ Dormant = "dormant",
+}
+
+export enum CoinSourceType {
+ Withdraw = "withdraw",
+ Refresh = "refresh",
+ Tip = "tip",
+}
+
+export interface WithdrawCoinSource {
+ type: CoinSourceType.Withdraw;
+
+ /**
+ * Can be the empty string for orphaned coins.
+ */
+ withdrawalGroupId: string;
+
+ /**
+ * Index of the coin in the withdrawal session.
+ */
+ coinIndex: number;
+
+ /**
+ * Reserve public key for the reserve we got this coin from.
+ */
+ reservePub: string;
+}
+
+export interface RefreshCoinSource {
+ type: CoinSourceType.Refresh;
+ oldCoinPub: string;
+}
+
+export interface TipCoinSource {
+ type: CoinSourceType.Tip;
+ walletTipId: string;
+ coinIndex: number;
+}
+
+export type CoinSource = WithdrawCoinSource | RefreshCoinSource | TipCoinSource;
+
+/**
+ * CoinRecord as stored in the "coins" data store
+ * of the wallet database.
+ */
+export interface CoinRecord {
+ /**
+ * Where did the coin come from? Used for recouping coins.
+ */
+ coinSource: CoinSource;
+
+ /**
+ * Public key of the coin.
+ */
+ coinPub: string;
+
+ /**
+ * Private key to authorize operations on the coin.
+ */
+ coinPriv: string;
+
+ /**
+ * Key used by the exchange used to sign the coin.
+ */
+ denomPub: string;
+
+ /**
+ * Hash of the public key that signs the coin.
+ */
+ denomPubHash: string;
+
+ /**
+ * Unblinded signature by the exchange.
+ */
+ denomSig: string;
+
+ /**
+ * Amount that's left on the coin.
+ */
+ currentAmount: AmountJson;
+
+ /**
+ * Base URL that identifies the exchange from which we got the
+ * coin.
+ */
+ exchangeBaseUrl: string;
+
+ /**
+ * The coin is currently suspended, and will not be used for payments.
+ */
+ suspended: boolean;
+
+ /**
+ * Blinding key used when withdrawing the coin.
+ * Potentionally used again during payback.
+ */
+ blindingKey: string;
+
+ /**
+ * Hash of the coin envelope.
+ *
+ * Stored here for indexing purposes, so that when looking at a
+ * reserve history, we can quickly find the coin for a withdrawal transaction.
+ */
+ coinEvHash: string;
+
+ /**
+ * Status of the coin.
+ */
+ status: CoinStatus;
+}
+
+export enum ProposalStatus {
+ /**
+ * Not downloaded yet.
+ */
+ DOWNLOADING = "downloading",
+ /**
+ * Proposal downloaded, but the user needs to accept/reject it.
+ */
+ PROPOSED = "proposed",
+ /**
+ * The user has accepted the proposal.
+ */
+ ACCEPTED = "accepted",
+ /**
+ * The user has rejected the proposal.
+ */
+ REFUSED = "refused",
+ /**
+ * Downloading or processing the proposal has failed permanently.
+ */
+ PERMANENTLY_FAILED = "permanently-failed",
+ /**
+ * Downloaded proposal was detected as a re-purchase.
+ */
+ REPURCHASE = "repurchase",
+}
+
+export interface ProposalDownload {
+ /**
+ * The contract that was offered by the merchant.
+ */
+ contractTermsRaw: any;
+
+ contractData: WalletContractData;
+}
+
+/**
+ * Record for a downloaded order, stored in the wallet's database.
+ */
+export interface ProposalRecord {
+ orderId: string;
+
+ merchantBaseUrl: string;
+
+ /**
+ * Downloaded data from the merchant.
+ */
+ download: ProposalDownload | undefined;
+
+ /**
+ * Unique ID when the order is stored in the wallet DB.
+ */
+ proposalId: string;
+
+ /**
+ * Timestamp (in ms) of when the record
+ * was created.
+ */
+ timestamp: Timestamp;
+
+ /**
+ * Private key for the nonce.
+ */
+ noncePriv: string;
+
+ /**
+ * Public key for the nonce.
+ */
+ noncePub: string;
+
+ claimToken: string | undefined;
+
+ proposalStatus: ProposalStatus;
+
+ repurchaseProposalId: string | undefined;
+
+ /**
+ * Session ID we got when downloading the contract.
+ */
+ downloadSessionId?: string;
+
+ /**
+ * Retry info, even present when the operation isn't active to allow indexing
+ * on the next retry timestamp.
+ */
+ retryInfo: RetryInfo;
+
+ lastError: TalerErrorDetails | undefined;
+}
+
+/**
+ * Status of a tip we got from a merchant.
+ */
+export interface TipRecord {
+ lastError: TalerErrorDetails | undefined;
+
+ /**
+ * Has the user accepted the tip? Only after the tip has been accepted coins
+ * withdrawn from the tip may be used.
+ */
+ acceptedTimestamp: Timestamp | undefined;
+
+ /**
+ * The tipped amount.
+ */
+ tipAmountRaw: AmountJson;
+
+ tipAmountEffective: AmountJson;
+
+ /**
+ * Timestamp, the tip can't be picked up anymore after this deadline.
+ */
+ tipExpiration: Timestamp;
+
+ /**
+ * The exchange that will sign our coins, chosen by the merchant.
+ */
+ exchangeBaseUrl: string;
+
+ /**
+ * Base URL of the merchant that is giving us the tip.
+ */
+ merchantBaseUrl: string;
+
+ /**
+ * Denomination selection made by the wallet for picking up
+ * this tip.
+ */
+ denomsSel: DenomSelectionState;
+
+ /**
+ * Tip ID chosen by the wallet.
+ */
+ walletTipId: string;
+
+ /**
+ * Secret seed used to derive planchets for this tip.
+ */
+ secretSeed: string;
+
+ /**
+ * The merchant's identifier for this tip.
+ */
+ merchantTipId: string;
+
+ createdTimestamp: Timestamp;
+
+ /**
+ * Timestamp for when the wallet finished picking up the tip
+ * from the merchant.
+ */
+ pickedUpTimestamp: Timestamp | undefined;
+
+ /**
+ * Retry info, even present when the operation isn't active to allow indexing
+ * on the next retry timestamp.
+ */
+ retryInfo: RetryInfo;
+}
+
+export interface RefreshGroupRecord {
+ /**
+ * Retry info, even present when the operation isn't active to allow indexing
+ * on the next retry timestamp.
+ */
+ retryInfo: RetryInfo;
+
+ lastError: TalerErrorDetails | undefined;
+
+ lastErrorPerCoin: { [coinIndex: number]: TalerErrorDetails };
+
+ refreshGroupId: string;
+
+ reason: RefreshReason;
+
+ oldCoinPubs: string[];
+
+ refreshSessionPerCoin: (RefreshSessionRecord | undefined)[];
+
+ inputPerCoin: AmountJson[];
+
+ estimatedOutputPerCoin: AmountJson[];
+
+ /**
+ * Flag for each coin whether refreshing finished.
+ * If a coin can't be refreshed (remaining value too small),
+ * it will be marked as finished, but no refresh session will
+ * be created.
+ */
+ finishedPerCoin: boolean[];
+
+ timestampCreated: Timestamp;
+
+ /**
+ * Timestamp when the refresh session finished.
+ */
+ timestampFinished: Timestamp | undefined;
+}
+
+/**
+ * Ongoing refresh
+ */
+export interface RefreshSessionRecord {
+ /**
+ * 512-bit secret that can be used to derive
+ * the other cryptographic material for the refresh session.
+ *
+ * FIXME: We currently store the derived material, but
+ * should always derive it.
+ */
+ sessionSecretSeed: string;
+
+ /**
+ * Sum of the value of denominations we want
+ * to withdraw in this session, without fees.
+ */
+ amountRefreshOutput: AmountJson;
+
+ /**
+ * Hashed denominations of the newly requested coins.
+ */
+ newDenoms: {
+ denomPubHash: string;
+ count: number;
+ }[];
+
+ /**
+ * The no-reveal-index after we've done the melting.
+ */
+ norevealIndex?: number;
+}
+
+/**
+ * Wire fee for one wire method as stored in the
+ * wallet's database.
+ */
+export interface WireFee {
+ /**
+ * Fee for wire transfers.
+ */
+ wireFee: AmountJson;
+
+ /**
+ * Fees to close and refund a reserve.
+ */
+ closingFee: AmountJson;
+
+ /**
+ * Start date of the fee.
+ */
+ startStamp: Timestamp;
+
+ /**
+ * End date of the fee.
+ */
+ endStamp: Timestamp;
+
+ /**
+ * Signature made by the exchange master key.
+ */
+ sig: string;
+}
+
+/**
+ * Record to store information about a refund event.
+ *
+ * All information about a refund is stored with the purchase,
+ * this event is just for the history.
+ *
+ * The event is only present for completed refunds.
+ */
+export interface RefundEventRecord {
+ timestamp: Timestamp;
+ merchantExecutionTimestamp: Timestamp;
+ refundGroupId: string;
+ proposalId: string;
+}
+
+export enum RefundState {
+ Failed = "failed",
+ Applied = "applied",
+ Pending = "pending",
+}
+
+/**
+ * State of one refund from the merchant, maintained by the wallet.
+ */
+export type WalletRefundItem =
+ | WalletRefundFailedItem
+ | WalletRefundPendingItem
+ | WalletRefundAppliedItem;
+
+export interface WalletRefundItemCommon {
+ // Execution time as claimed by the merchant
+ executionTime: Timestamp;
+
+ /**
+ * Time when the wallet became aware of the refund.
+ */
+ obtainedTime: Timestamp;
+
+ refundAmount: AmountJson;
+
+ refundFee: AmountJson;
+
+ /**
+ * Upper bound on the refresh cost incurred by
+ * applying this refund.
+ *
+ * Might be lower in practice when two refunds on the same
+ * coin are refreshed in the same refresh operation.
+ */
+ totalRefreshCostBound: AmountJson;
+
+ coinPub: string;
+
+ rtransactionId: number;
+}
+
+/**
+ * Failed refund, either because the merchant did
+ * something wrong or it expired.
+ */
+export interface WalletRefundFailedItem extends WalletRefundItemCommon {
+ type: RefundState.Failed;
+}
+
+export interface WalletRefundPendingItem extends WalletRefundItemCommon {
+ type: RefundState.Pending;
+}
+
+export interface WalletRefundAppliedItem extends WalletRefundItemCommon {
+ type: RefundState.Applied;
+}
+
+export enum RefundReason {
+ /**
+ * Normal refund given by the merchant.
+ */
+ NormalRefund = "normal-refund",
+ /**
+ * Refund from an aborted payment.
+ */
+ AbortRefund = "abort-pay-refund",
+}
+
+/**
+ * Record stored for every time we successfully submitted
+ * a payment to the merchant (both first time and re-play).
+ */
+export interface PayEventRecord {
+ proposalId: string;
+ sessionId: string | undefined;
+ isReplay: boolean;
+ timestamp: Timestamp;
+}
+
+export interface ExchangeUpdatedEventRecord {
+ exchangeBaseUrl: string;
+ timestamp: Timestamp;
+}
+
+export interface ReserveUpdatedEventRecord {
+ amountReserveBalance: string;
+ amountExpected: string;
+ reservePub: string;
+ timestamp: Timestamp;
+ reserveUpdateId: string;
+ newHistoryTransactions: ReserveTransaction[];
+}
+
+export interface AllowedAuditorInfo {
+ auditorBaseUrl: string;
+ auditorPub: string;
+}
+
+export interface AllowedExchangeInfo {
+ exchangeBaseUrl: string;
+ exchangePub: string;
+}
+
+/**
+ * Data extracted from the contract terms that is relevant for payment
+ * processing in the wallet.
+ */
+export interface WalletContractData {
+ products?: Product[];
+ summaryI18n: { [lang_tag: string]: string } | undefined;
+
+ /**
+ * Fulfillment URL, or the empty string if the order has no fulfillment URL.
+ *
+ * Stored as a non-nullable string as we use this field for IndexedDB indexing.
+ */
+ fulfillmentUrl: string;
+
+ contractTermsHash: string;
+ fulfillmentMessage?: string;
+ fulfillmentMessageI18n?: InternationalizedString;
+ merchantSig: string;
+ merchantPub: string;
+ merchant: MerchantInfo;
+ amount: AmountJson;
+ orderId: string;
+ merchantBaseUrl: string;
+ summary: string;
+ autoRefund: Duration | undefined;
+ maxWireFee: AmountJson;
+ wireFeeAmortization: number;
+ payDeadline: Timestamp;
+ refundDeadline: Timestamp;
+ allowedAuditors: AllowedAuditorInfo[];
+ allowedExchanges: AllowedExchangeInfo[];
+ timestamp: Timestamp;
+ wireMethod: string;
+ wireInfoHash: string;
+ maxDepositFee: AmountJson;
+}
+
+
+export enum AbortStatus {
+ None = "none",
+ AbortRefund = "abort-refund",
+ AbortFinished = "abort-finished",
+}
+
+/**
+ * Record that stores status information about one purchase, starting from when
+ * the customer accepts a proposal. Includes refund status if applicable.
+ */
+export interface PurchaseRecord {
+ /**
+ * Proposal ID for this purchase. Uniquely identifies the
+ * purchase and the proposal.
+ */
+ proposalId: string;
+
+ /**
+ * Private key for the nonce.
+ */
+ noncePriv: string;
+
+ /**
+ * Public key for the nonce.
+ */
+ noncePub: string;
+
+ /**
+ * Downloaded and parsed proposal data.
+ */
+ download: ProposalDownload;
+
+ /**
+ * Deposit permissions, available once the user has accepted the payment.
+ *
+ * This value is cached and derived from payCoinSelection.
+ */
+ coinDepositPermissions: CoinDepositPermission[] | undefined;
+
+ payCoinSelection: PayCoinSelection;
+
+ /**
+ * Pending removals from pay coin selection.
+ *
+ * Used when a the pay coin selection needs to be changed
+ * because a coin became known as double-spent or invalid,
+ * but a new coin selection can't immediately be done, as
+ * there is not enough balance (e.g. when waiting for a refresh).
+ */
+ pendingRemovedCoinPubs?: string[];
+
+ totalPayCost: AmountJson;
+
+ /**
+ * Timestamp of the first time that sending a payment to the merchant
+ * for this purchase was successful.
+ */
+ timestampFirstSuccessfulPay: Timestamp | undefined;
+
+ merchantPaySig: string | undefined;
+
+ /**
+ * When was the purchase made?
+ * Refers to the time that the user accepted.
+ */
+ timestampAccept: Timestamp;
+
+ /**
+ * Pending refunds for the purchase. A refund is pending
+ * when the merchant reports a transient error from the exchange.
+ */
+ refunds: { [refundKey: string]: WalletRefundItem };
+
+ /**
+ * When was the last refund made?
+ * Set to 0 if no refund was made on the purchase.
+ */
+ timestampLastRefundStatus: Timestamp | undefined;
+
+ /**
+ * Last session signature that we submitted to /pay (if any).
+ */
+ lastSessionId: string | undefined;
+
+ /**
+ * Set for the first payment, or on re-plays.
+ */
+ paymentSubmitPending: boolean;
+
+ /**
+ * Do we need to query the merchant for the refund status
+ * of the payment?
+ */
+ refundQueryRequested: boolean;
+
+ abortStatus: AbortStatus;
+
+ payRetryInfo: RetryInfo;
+
+ lastPayError: TalerErrorDetails | undefined;
+
+ /**
+ * Retry information for querying the refund status with the merchant.
+ */
+ refundStatusRetryInfo: RetryInfo;
+
+ /**
+ * Last error (or undefined) for querying the refund status with the merchant.
+ */
+ lastRefundStatusError: TalerErrorDetails | undefined;
+
+ /**
+ * Continue querying the refund status until this deadline has expired.
+ */
+ autoRefundDeadline: Timestamp | undefined;
+}
+
+/**
+ * Configuration key/value entries to configure
+ * the wallet.
+ */
+export interface ConfigRecord<T> {
+ key: string;
+ value: T;
+}
+
+/**
+ * FIXME: Eliminate this in favor of DenomSelectionState.
+ */
+export interface DenominationSelectionInfo {
+ totalCoinValue: AmountJson;
+ totalWithdrawCost: AmountJson;
+ selectedDenoms: {
+ /**
+ * How many times do we withdraw this denomination?
+ */
+ count: number;
+ denom: DenominationRecord;
+ }[];
+}
+
+/**
+ * Selected denominations withn some extra info.
+ */
+export interface DenomSelectionState {
+ totalCoinValue: AmountJson;
+ totalWithdrawCost: AmountJson;
+ selectedDenoms: {
+ denomPubHash: string;
+ count: number;
+ }[];
+}
+
+/**
+ * Group of withdrawal operations that need to be executed.
+ * (Either for a normal withdrawal or from a tip.)
+ *
+ * The withdrawal group record is only created after we know
+ * the coin selection we want to withdraw.
+ */
+export interface WithdrawalGroupRecord {
+ withdrawalGroupId: string;
+
+ /**
+ * Secret seed used to derive planchets.
+ */
+ secretSeed: string;
+
+ reservePub: string;
+
+ exchangeBaseUrl: string;
+
+ /**
+ * When was the withdrawal operation started started?
+ * Timestamp in milliseconds.
+ */
+ timestampStart: Timestamp;
+
+ /**
+ * When was the withdrawal operation completed?
+ */
+ timestampFinish?: Timestamp;
+
+ /**
+ * Amount including fees (i.e. the amount subtracted from the
+ * reserve to withdraw all coins in this withdrawal session).
+ */
+ rawWithdrawalAmount: AmountJson;
+
+ denomsSel: DenomSelectionState;
+
+ /**
+ * Retry info, always present even on completed operations so that indexing works.
+ */
+ retryInfo: RetryInfo;
+
+ lastError: TalerErrorDetails | undefined;
+}
+
+export interface BankWithdrawUriRecord {
+ /**
+ * The withdraw URI we got from the bank.
+ */
+ talerWithdrawUri: string;
+
+ /**
+ * Reserve that was created for the withdraw URI.
+ */
+ reservePub: string;
+}
+
+/**
+ * Status of recoup operations that were grouped together.
+ *
+ * The remaining amount of involved coins should be set to zero
+ * in the same transaction that inserts the RecoupGroupRecord.
+ */
+export interface RecoupGroupRecord {
+ /**
+ * Unique identifier for the recoup group record.
+ */
+ recoupGroupId: string;
+
+ timestampStarted: Timestamp;
+
+ timestampFinished: Timestamp | undefined;
+
+ /**
+ * Public keys that identify the coins being recouped
+ * as part of this session.
+ *
+ * (Structured like this to enable multiEntry indexing in IndexedDB.)
+ */
+ coinPubs: string[];
+
+ /**
+ * Array of flags to indicate whether the recoup finished on each individual coin.
+ */
+ recoupFinishedPerCoin: boolean[];
+
+ /**
+ * We store old amount (i.e. before recoup) of recouped coins here,
+ * as the balance of a recouped coin is set to zero when the
+ * recoup group is created.
+ */
+ oldAmountPerCoin: AmountJson[];
+
+ /**
+ * Public keys of coins that should be scheduled for refreshing
+ * after all individual recoups are done.
+ */
+ scheduleRefreshCoins: string[];
+
+ /**
+ * Retry info.
+ */
+ retryInfo: RetryInfo;
+
+ /**
+ * Last error that occured, if any.
+ */
+ lastError: TalerErrorDetails | undefined;
+}
+
+export enum ImportPayloadType {
+ CoreSchema = "core-schema",
+}
+
+export enum BackupProviderStatus {
+ PaymentRequired = "payment-required",
+ Ready = "ready",
+}
+
+export interface BackupProviderRecord {
+ baseUrl: string;
+
+ /**
+ * Terms of service of the provider.
+ * Might be unavailable in the DB in certain situations
+ * (such as loading a recovery document).
+ */
+ terms?: {
+ supportedProtocolVersion: string;
+ annualFee: AmountString;
+ storageLimitInMegabytes: number;
+ };
+
+ active: boolean;
+
+ /**
+ * Hash of the last encrypted backup that we already merged
+ * or successfully uploaded ourselves.
+ */
+ lastBackupHash?: string;
+
+ /**
+ * Clock of the last backup that we already
+ * merged.
+ */
+ lastBackupClock?: number;
+
+ lastBackupTimestamp?: Timestamp;
+
+ /**
+ * Proposal that we're currently trying to pay for.
+ *
+ * (Also included in paymentProposalIds.)
+ */
+ currentPaymentProposalId?: string;
+
+ /**
+ * Proposals that were used to pay (or attempt to pay) the provider.
+ *
+ * Stored to display a history of payments to the provider, and
+ * to make sure that the wallet isn't overpaying.
+ */
+ paymentProposalIds: string[];
+
+ /**
+ * Next scheduled backup.
+ */
+ nextBackupTimestamp?: Timestamp;
+
+ /**
+ * Retry info.
+ */
+ retryInfo: RetryInfo;
+
+ /**
+ * Last error that occured, if any.
+ */
+ lastError: TalerErrorDetails | undefined;
+}
+
+/**
+ * Group of deposits made by the wallet.
+ */
+export interface DepositGroupRecord {
+ depositGroupId: string;
+
+ merchantPub: string;
+ merchantPriv: string;
+
+ noncePriv: string;
+ noncePub: string;
+
+ /**
+ * Wire information used by all deposits in this
+ * deposit group.
+ */
+ wire: {
+ payto_uri: string;
+ salt: string;
+ };
+
+ /**
+ * Verbatim contract terms.
+ */
+ contractTermsRaw: ContractTerms;
+
+ contractTermsHash: string;
+
+ payCoinSelection: PayCoinSelection;
+
+ totalPayCost: AmountJson;
+
+ effectiveDepositAmount: AmountJson;
+
+ depositedPerCoin: boolean[];
+
+ timestampCreated: Timestamp;
+
+ timestampFinished: Timestamp | undefined;
+
+ lastError: TalerErrorDetails | undefined;
+
+ /**
+ * Retry info.
+ */
+ retryInfo: RetryInfo;
+}
+
+/**
+ * Record for a deposits that the wallet observed
+ * as a result of double spending, but which is not
+ * present in the wallet's own database otherwise.
+ */
+export interface GhostDepositGroupRecord {
+ /**
+ * When multiple deposits for the same contract terms hash
+ * have a different timestamp, we choose the earliest one.
+ */
+ timestamp: Timestamp;
+
+ contractTermsHash: string;
+
+ deposits: {
+ coinPub: string;
+ amount: AmountString;
+ timestamp: Timestamp;
+ depositFee: AmountString;
+ merchantPub: string;
+ coinSig: string;
+ wireHash: string;
+ }[];
+}
+
+class ExchangesStore extends Store<"exchanges", ExchangeRecord> {
+ constructor() {
+ super("exchanges", { keyPath: "baseUrl" });
+ }
+}
+
+class CoinsStore extends Store<"coins", CoinRecord> {
+ constructor() {
+ super("coins", { keyPath: "coinPub" });
+ }
+
+ exchangeBaseUrlIndex = new Index<
+ "coins",
+ "exchangeBaseUrl",
+ string,
+ CoinRecord
+ >(this, "exchangeBaseUrl", "exchangeBaseUrl");
+
+ denomPubHashIndex = new Index<
+ "coins",
+ "denomPubHashIndex",
+ string,
+ CoinRecord
+ >(this, "denomPubHashIndex", "denomPubHash");
+
+ coinEvHashIndex = new Index<"coins", "coinEvHashIndex", string, CoinRecord>(
+ this,
+ "coinEvHashIndex",
+ "coinEvHash",
+ );
+}
+
+class ProposalsStore extends Store<"proposals", ProposalRecord> {
+ constructor() {
+ super("proposals", { keyPath: "proposalId" });
+ }
+ urlAndOrderIdIndex = new Index<
+ "proposals",
+ "urlIndex",
+ string,
+ ProposalRecord
+ >(this, "urlIndex", ["merchantBaseUrl", "orderId"]);
+}
+
+class PurchasesStore extends Store<"purchases", PurchaseRecord> {
+ constructor() {
+ super("purchases", { keyPath: "proposalId" });
+ }
+
+ fulfillmentUrlIndex = new Index<
+ "purchases",
+ "fulfillmentUrlIndex",
+ string,
+ PurchaseRecord
+ >(this, "fulfillmentUrlIndex", "download.contractData.fulfillmentUrl");
+
+ orderIdIndex = new Index<"purchases", "orderIdIndex", string, PurchaseRecord>(
+ this,
+ "orderIdIndex",
+ ["download.contractData.merchantBaseUrl", "download.contractData.orderId"],
+ );
+}
+
+class DenominationsStore extends Store<"denominations", DenominationRecord> {
+ constructor() {
+ // cast needed because of bug in type annotations
+ super("denominations", {
+ keyPath: (["exchangeBaseUrl", "denomPubHash"] as any) as IDBKeyPath,
+ });
+ }
+ exchangeBaseUrlIndex = new Index<
+ "denominations",
+ "exchangeBaseUrlIndex",
+ string,
+ DenominationRecord
+ >(this, "exchangeBaseUrlIndex", "exchangeBaseUrl");
+}
+
+class CurrenciesStore extends Store<"currencies", CurrencyRecord> {
+ constructor() {
+ super("currencies", { keyPath: "name" });
+ }
+}
+
+class ConfigStore extends Store<"config", ConfigRecord<any>> {
+ constructor() {
+ super("config", { keyPath: "key" });
+ }
+}
+
+class ReservesStore extends Store<"reserves", ReserveRecord> {
+ constructor() {
+ super("reserves", { keyPath: "reservePub" });
+ }
+}
+
+class TipsStore extends Store<"tips", TipRecord> {
+ constructor() {
+ super("tips", { keyPath: "walletTipId" });
+ }
+ // Added in version 2
+ byMerchantTipIdAndBaseUrl = new Index<
+ "tips",
+ "tipsByMerchantTipIdAndOriginIndex",
+ [string, string],
+ TipRecord
+ >(this, "tipsByMerchantTipIdAndOriginIndex", [
+ "merchantTipId",
+ "merchantBaseUrl",
+ ]);
+}
+
+class WithdrawalGroupsStore extends Store<
+ "withdrawals",
+ WithdrawalGroupRecord
+> {
+ constructor() {
+ super("withdrawals", { keyPath: "withdrawalGroupId" });
+ }
+ byReservePub = new Index<
+ "withdrawals",
+ "withdrawalsByReserveIndex",
+ string,
+ WithdrawalGroupRecord
+ >(this, "withdrawalsByReserveIndex", "reservePub");
+}
+
+class PlanchetsStore extends Store<"planchets", PlanchetRecord> {
+ constructor() {
+ super("planchets", { keyPath: "coinPub" });
+ }
+ byGroupAndIndex = new Index<
+ "planchets",
+ "withdrawalGroupAndCoinIdxIndex",
+ string,
+ PlanchetRecord
+ >(this, "withdrawalGroupAndCoinIdxIndex", ["withdrawalGroupId", "coinIdx"]);
+ byGroup = new Index<
+ "planchets",
+ "withdrawalGroupIndex",
+ string,
+ PlanchetRecord
+ >(this, "withdrawalGroupIndex", "withdrawalGroupId");
+
+ coinEvHashIndex = new Index<
+ "planchets",
+ "coinEvHashIndex",
+ string,
+ PlanchetRecord
+ >(this, "coinEvHashIndex", "coinEvHash");
+}
+
+/**
+ * This store is effectively a materialized index for
+ * reserve records that are for a bank-integrated withdrawal.
+ */
+class BankWithdrawUrisStore extends Store<
+ "bankWithdrawUris",
+ BankWithdrawUriRecord
+> {
+ constructor() {
+ super("bankWithdrawUris", { keyPath: "talerWithdrawUri" });
+ }
+}
+
+/**
+ */
+class BackupProvidersStore extends Store<
+ "backupProviders",
+ BackupProviderRecord
+> {
+ constructor() {
+ super("backupProviders", { keyPath: "baseUrl" });
+ }
+}
+
+class DepositGroupsStore extends Store<"depositGroups", DepositGroupRecord> {
+ constructor() {
+ super("depositGroups", { keyPath: "depositGroupId" });
+ }
+}
+
+/**
+ * The stores and indices for the wallet database.
+ */
+export const Stores = {
+ coins: new CoinsStore(),
+ config: new ConfigStore(),
+ currencies: new CurrenciesStore(),
+ denominations: new DenominationsStore(),
+ exchanges: new ExchangesStore(),
+ proposals: new ProposalsStore(),
+ refreshGroups: new Store<"refreshGroups", RefreshGroupRecord>(
+ "refreshGroups",
+ {
+ keyPath: "refreshGroupId",
+ },
+ ),
+ recoupGroups: new Store<"recoupGroups", RecoupGroupRecord>("recoupGroups", {
+ keyPath: "recoupGroupId",
+ }),
+ reserves: new ReservesStore(),
+ purchases: new PurchasesStore(),
+ tips: new TipsStore(),
+ withdrawalGroups: new WithdrawalGroupsStore(),
+ planchets: new PlanchetsStore(),
+ bankWithdrawUris: new BankWithdrawUrisStore(),
+ backupProviders: new BackupProvidersStore(),
+ depositGroups: new DepositGroupsStore(),
+ ghostDepositGroups: new Store<"ghostDepositGroups", GhostDepositGroupRecord>(
+ "ghostDepositGroups",
+ {
+ keyPath: "contractTermsHash",
+ },
+ ),
+};
+
+export class MetaConfigStore extends Store<"metaConfig", ConfigRecord<any>> {
+ constructor() {
+ super("metaConfig", { keyPath: "key" });
+ }
+}
+
+export const MetaStores = {
+ metaConfig: new MetaConfigStore(),
+};
diff --git a/packages/taler-wallet-core/src/headless/NodeHttpLib.ts b/packages/taler-wallet-core/src/headless/NodeHttpLib.ts
index dc649a65e..74672cd3f 100644
--- a/packages/taler-wallet-core/src/headless/NodeHttpLib.ts
+++ b/packages/taler-wallet-core/src/headless/NodeHttpLib.ts
@@ -28,11 +28,10 @@ import {
import { RequestThrottler } from "../util/RequestThrottler";
import Axios, { AxiosResponse } from "axios";
import { OperationFailedError, makeErrorDetails } from "../operations/errors";
-import { TalerErrorCode } from "../TalerErrorCode";
import { URL } from "../util/url";
import { Logger } from "../util/logging";
import { bytesToString } from "../crypto/talerCrypto";
-import { j2s } from "../util/helpers";
+import { TalerErrorCode } from "@gnu-taler/taler-util";
const logger = new Logger("NodeHttpLib.ts");
diff --git a/packages/taler-wallet-core/src/headless/helpers.ts b/packages/taler-wallet-core/src/headless/helpers.ts
index ef97bc48e..5007a65ac 100644
--- a/packages/taler-wallet-core/src/headless/helpers.ts
+++ b/packages/taler-wallet-core/src/headless/helpers.ts
@@ -23,18 +23,20 @@
* Imports.
*/
import { Wallet } from "../wallet";
-import { MemoryBackend, BridgeIDBFactory, shimIndexedDB } from "@gnu-taler/idb-bridge";
+import {
+ MemoryBackend,
+ BridgeIDBFactory,
+ shimIndexedDB,
+} from "@gnu-taler/idb-bridge";
import { openTalerDatabase } from "../db";
import { HttpRequestLibrary } from "../util/http";
import fs from "fs";
import { NodeThreadCryptoWorkerFactory } from "../crypto/workers/nodeThreadWorker";
-import { WalletNotification } from "../types/notifications";
-import { Database } from "../util/query";
import { NodeHttpLib } from "./NodeHttpLib";
import { Logger } from "../util/logging";
import { SynchronousCryptoWorkerFactory } from "../crypto/workers/synchronousWorker";
-import type { IDBFactory } from "@gnu-taler/idb-bridge/lib/idbtypes";
-import { Stores } from "../types/dbTypes";
+import type { IDBFactory } from "@gnu-taler/idb-bridge";
+import { WalletNotification } from "@gnu-taler/taler-util";
const logger = new Logger("headless/helpers.ts");
diff --git a/packages/taler-wallet-core/src/index.ts b/packages/taler-wallet-core/src/index.ts
index c446a0ffa..1faf4e5fa 100644
--- a/packages/taler-wallet-core/src/index.ts
+++ b/packages/taler-wallet-core/src/index.ts
@@ -21,7 +21,6 @@
export { Wallet } from "./wallet";
// Errors
-export { TalerErrorCode } from "./TalerErrorCode";
export * from "./operations/errors";
// Utils for using the wallet under node
@@ -34,7 +33,6 @@ export {
export * from "./operations/versions";
export * from "./db";
-export * from "./types/dbTypes";
// Internationalization
export * from "./i18n";
@@ -47,22 +45,10 @@ export { CryptoWorkerFactory, CryptoApi } from "./crypto/workers/cryptoApi";
export * from "./crypto/talerCrypto";
// Util functionality
-export { Amounts, AmountJson } from "./util/amounts";
export { Logger } from "./util/logging";
-export { Configuration } from "./util/talerconfig";
export { URL } from "./util/url";
-export * from "./util/codec";
export * from "./util/promiseUtils";
export * from "./util/query";
export * from "./util/http";
-export * from "./util/payto";
-export * from "./util/testvectors";
-export * from "./util/taleruri";
-export * from "./util/time";
-// Types
-export * from "./types/talerTypes";
-export * from "./types/walletTypes";
-export * from "./types/notifications";
-export * from "./types/transactionsTypes";
-export * from "./types/pendingTypes";
+export * from "./pending-types"; \ No newline at end of file
diff --git a/packages/taler-wallet-core/src/operations/backup/export.ts b/packages/taler-wallet-core/src/operations/backup/export.ts
index a32aec39d..c6e24289f 100644
--- a/packages/taler-wallet-core/src/operations/backup/export.ts
+++ b/packages/taler-wallet-core/src/operations/backup/export.ts
@@ -14,12 +14,14 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { Stores, Amounts, CoinSourceType, CoinStatus, RefundState, AbortStatus, ProposalStatus, getTimestampNow, encodeCrock, stringToBytes, getRandomBytes } from "../..";
import { hash } from "../../crypto/primitives/nacl-fast";
-import { WalletBackupContentV1, BackupExchange, BackupCoin, BackupDenomination, BackupReserve, BackupPurchase, BackupProposal, BackupRefreshGroup, BackupBackupProvider, BackupTip, BackupRecoupGroup, BackupWithdrawalGroup, BackupBackupProviderTerms, BackupCoinSource, BackupCoinSourceType, BackupExchangeWireFee, BackupRefundItem, BackupRefundState, BackupProposalStatus, BackupRefreshOldCoin, BackupRefreshSession } from "../../types/backupTypes";
+import { WalletBackupContentV1, BackupExchange, BackupCoin, BackupDenomination, BackupReserve, BackupPurchase, BackupProposal, BackupRefreshGroup, BackupBackupProvider, BackupTip, BackupRecoupGroup, BackupWithdrawalGroup, BackupBackupProviderTerms, BackupCoinSource, BackupCoinSourceType, BackupExchangeWireFee, BackupRefundItem, BackupRefundState, BackupProposalStatus, BackupRefreshOldCoin, BackupRefreshSession } from "@gnu-taler/taler-util";
import { canonicalizeBaseUrl, canonicalJson } from "../../util/helpers";
import { InternalWalletState } from "../state";
import { provideBackupState, getWalletBackupState, WALLET_BACKUP_STATE_KEY } from "./state";
+import { Amounts, getTimestampNow } from "@gnu-taler/taler-util";
+import { Stores, CoinSourceType, CoinStatus, RefundState, AbortStatus, ProposalStatus } from "../../db.js";
+import { encodeCrock, stringToBytes, getRandomBytes } from "../../index.js";
/**
* Implementation of wallet backups (export/import/upload) and sync
diff --git a/packages/taler-wallet-core/src/operations/backup/import.ts b/packages/taler-wallet-core/src/operations/backup/import.ts
index 2e33c2070..05b6da084 100644
--- a/packages/taler-wallet-core/src/operations/backup/import.ts
+++ b/packages/taler-wallet-core/src/operations/backup/import.ts
@@ -14,40 +14,9 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import {
- AbortStatus,
- AmountJson,
- Amounts,
- codecForContractTerms,
- CoinSource,
- CoinSourceType,
- CoinStatus,
- DenominationStatus,
- DenomSelectionState,
- ExchangeUpdateStatus,
- ExchangeWireInfo,
- getTimestampNow,
- ProposalDownload,
- ProposalStatus,
- RefreshReason,
- RefreshSessionRecord,
- RefundState,
- ReserveBankInfo,
- ReserveRecordStatus,
- Stores,
- TransactionHandle,
- WalletContractData,
- WalletRefundItem,
-} from "../..";
-import {
- BackupCoinSourceType,
- BackupDenomSel,
- BackupProposalStatus,
- BackupPurchase,
- BackupRefreshReason,
- BackupRefundState,
- WalletBackupContentV1,
-} from "../../types/backupTypes";
+import { BackupPurchase, AmountJson, Amounts, BackupDenomSel, WalletBackupContentV1, getTimestampNow, BackupCoinSourceType, BackupProposalStatus, codecForContractTerms, BackupRefundState, RefreshReason, BackupRefreshReason } from "@gnu-taler/taler-util";
+import { Stores, WalletContractData, DenomSelectionState, ExchangeWireInfo, ExchangeUpdateStatus, DenominationStatus, CoinSource, CoinSourceType, CoinStatus, ReserveBankInfo, ReserveRecordStatus, ProposalDownload, ProposalStatus, WalletRefundItem, RefundState, AbortStatus, RefreshSessionRecord } from "../../db.js";
+import { TransactionHandle } from "../../index.js";
import { PayCoinSelection } from "../../util/coinSelection";
import { j2s } from "../../util/helpers";
import { checkDbInvariant, checkLogicInvariant } from "../../util/invariants";
diff --git a/packages/taler-wallet-core/src/operations/backup/index.ts b/packages/taler-wallet-core/src/operations/backup/index.ts
index edc5acc15..77a3219a5 100644
--- a/packages/taler-wallet-core/src/operations/backup/index.ts
+++ b/packages/taler-wallet-core/src/operations/backup/index.ts
@@ -25,15 +25,14 @@
* Imports.
*/
import { InternalWalletState } from "../state";
-import { WalletBackupContentV1 } from "../../types/backupTypes";
+import { AmountString, BackupRecovery, codecForAmountString, WalletBackupContentV1 } from "@gnu-taler/taler-util";
import { TransactionHandle } from "../../util/query";
import {
BackupProviderRecord,
ConfigRecord,
Stores,
-} from "../../types/dbTypes";
+} from "../../db.js";
import { checkDbInvariant, checkLogicInvariant } from "../../util/invariants";
-import { codecForAmountString } from "../../util/amounts";
import {
bytesToString,
decodeCrock,
@@ -51,9 +50,8 @@ import {
getTimestampNow,
Timestamp,
timestampAddDuration,
-} from "../../util/time";
+} from "@gnu-taler/taler-util";
import { URL } from "../../util/url";
-import { AmountString } from "../../types/talerTypes";
import {
buildCodecForObject,
Codec,
@@ -61,7 +59,7 @@ import {
codecForNumber,
codecForString,
codecOptional,
-} from "../../util/codec";
+} from "@gnu-taler/taler-util";
import {
HttpResponseStatus,
readSuccessResponseJsonOrThrow,
@@ -77,7 +75,7 @@ import {
RecoveryLoadRequest,
RecoveryMergeStrategy,
TalerErrorDetails,
-} from "../../types/walletTypes";
+} from "@gnu-taler/taler-util";
import { CryptoApi } from "../../crypto/workers/cryptoApi";
import { secretbox, secretbox_open } from "../../crypto/primitives/nacl-fast";
import { checkPaymentByProposalId, confirmPay, preparePayForUri } from "../pay";
@@ -89,7 +87,6 @@ import {
getWalletBackupState,
WalletBackupConfState,
} from "./state";
-import { PaymentStatus } from "../../types/transactionsTypes";
const logger = new Logger("operations/backup.ts");
@@ -639,13 +636,6 @@ export async function getBackupInfo(
};
}
-export interface BackupRecovery {
- walletRootPriv: string;
- providers: {
- url: string;
- }[];
-}
-
/**
* Get information about the current state of wallet backups.
*/
diff --git a/packages/taler-wallet-core/src/operations/backup/state.ts b/packages/taler-wallet-core/src/operations/backup/state.ts
index 29c9402c7..686c307a1 100644
--- a/packages/taler-wallet-core/src/operations/backup/state.ts
+++ b/packages/taler-wallet-core/src/operations/backup/state.ts
@@ -14,14 +14,9 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import {
- ConfigRecord,
- encodeCrock,
- getRandomBytes,
- Stores,
- Timestamp,
- TransactionHandle,
-} from "../..";
+import { Timestamp } from "@gnu-taler/taler-util";
+import { ConfigRecord, Stores } from "../../db.js";
+import { getRandomBytes, encodeCrock, TransactionHandle } from "../../index.js";
import { checkDbInvariant } from "../../util/invariants";
import { InternalWalletState } from "../state";
diff --git a/packages/taler-wallet-core/src/operations/balance.ts b/packages/taler-wallet-core/src/operations/balance.ts
index b82e4c9d1..741c46ebf 100644
--- a/packages/taler-wallet-core/src/operations/balance.ts
+++ b/packages/taler-wallet-core/src/operations/balance.ts
@@ -17,13 +17,11 @@
/**
* Imports.
*/
-import { BalancesResponse } from "../types/walletTypes";
-import { TransactionHandle } from "../util/query";
-import { InternalWalletState } from "./state";
-import { Stores, CoinStatus } from "../types/dbTypes";
-import * as Amounts from "../util/amounts";
-import { AmountJson } from "../util/amounts";
+import { AmountJson, BalancesResponse, Amounts } from "@gnu-taler/taler-util";
+import { Stores, CoinStatus } from "../db.js";
+import { TransactionHandle } from "../index.js";
import { Logger } from "../util/logging";
+import { InternalWalletState } from "./state.js";
const logger = new Logger("withdraw.ts");
diff --git a/packages/taler-wallet-core/src/operations/deposits.ts b/packages/taler-wallet-core/src/operations/deposits.ts
index 53f2529b2..6bb4f3d59 100644
--- a/packages/taler-wallet-core/src/operations/deposits.ts
+++ b/packages/taler-wallet-core/src/operations/deposits.ts
@@ -14,42 +14,37 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import {
- Amounts,
- CreateDepositGroupRequest,
- guardOperationException,
- Logger,
- NotificationType,
- TalerErrorDetails,
-} from "..";
import { kdf } from "../crypto/primitives/kdf";
import {
encodeCrock,
getRandomBytes,
stringToBytes,
} from "../crypto/talerCrypto";
-import { DepositGroupRecord, Stores } from "../types/dbTypes";
-import { ContractTerms } from "../types/talerTypes";
-import { CreateDepositGroupResponse, TrackDepositGroupRequest, TrackDepositGroupResponse } from "../types/walletTypes";
-import {
- buildCodecForObject,
- Codec,
- codecForString,
- codecOptional,
-} from "../util/codec";
import { selectPayCoins } from "../util/coinSelection";
import { canonicalJson } from "../util/helpers";
import { readSuccessResponseJsonOrThrow } from "../util/http";
-import { parsePaytoUri } from "../util/payto";
import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries";
import {
+ Amounts,
+ buildCodecForObject,
+ Codec,
+ codecForString,
codecForTimestamp,
+ codecOptional,
+ ContractTerms,
+ CreateDepositGroupRequest,
+ CreateDepositGroupResponse,
durationFromSpec,
getTimestampNow,
+ NotificationType,
+ parsePaytoUri,
+ TalerErrorDetails,
Timestamp,
timestampAddDuration,
timestampTruncateToSecond,
-} from "../util/time";
+ TrackDepositGroupRequest,
+ TrackDepositGroupResponse,
+} from "@gnu-taler/taler-util";
import { URL } from "../util/url";
import {
applyCoinSpend,
@@ -60,6 +55,9 @@ import {
getTotalPaymentCost,
} from "./pay";
import { InternalWalletState } from "./state";
+import { Logger } from "../util/logging.js";
+import { DepositGroupRecord, Stores } from "../db.js";
+import { guardOperationException } from "./errors.js";
/**
* Logger.
@@ -242,7 +240,6 @@ async function processDepositGroupImpl(
});
}
-
export async function trackDepositGroup(
ws: InternalWalletState,
req: TrackDepositGroupRequest,
@@ -384,7 +381,6 @@ export async function createDepositGroup(
prevPayCoins: [],
});
-
if (!payCoinSel) {
throw Error("insufficient funds");
}
@@ -437,4 +433,4 @@ export async function createDepositGroup(
await ws.db.put(Stores.depositGroups, depositGroup);
return { depositGroupId };
-}
+} \ No newline at end of file
diff --git a/packages/taler-wallet-core/src/operations/errors.ts b/packages/taler-wallet-core/src/operations/errors.ts
index 8ec8468a1..61e8c5754 100644
--- a/packages/taler-wallet-core/src/operations/errors.ts
+++ b/packages/taler-wallet-core/src/operations/errors.ts
@@ -23,8 +23,7 @@
/**
* Imports.
*/
-import { TalerErrorDetails } from "../types/walletTypes";
-import { TalerErrorCode } from "../TalerErrorCode";
+import { TalerErrorCode, TalerErrorDetails } from "@gnu-taler/taler-util";
/**
* This exception is there to let the caller know that an error happened,
diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts b/packages/taler-wallet-core/src/operations/exchanges.ts
index 1125645f1..08c554160 100644
--- a/packages/taler-wallet-core/src/operations/exchanges.ts
+++ b/packages/taler-wallet-core/src/operations/exchanges.ts
@@ -14,54 +14,54 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { InternalWalletState } from "./state";
+/**
+ * Imports.
+ */
import {
- Denomination,
+ Amounts,
codecForExchangeKeysJson,
codecForExchangeWireJson,
-} from "../types/talerTypes";
-import { TalerErrorDetails } from "../types/walletTypes";
+ compare,
+ Denomination,
+ Duration,
+ durationFromSpec,
+ getTimestampNow,
+ isTimestampExpired,
+ NotificationType,
+ parsePaytoUri,
+ TalerErrorCode,
+ TalerErrorDetails,
+} from "@gnu-taler/taler-util";
import {
- ExchangeRecord,
- ExchangeUpdateStatus,
- Stores,
DenominationRecord,
DenominationStatus,
+ Stores,
+ ExchangeRecord,
+ ExchangeUpdateStatus,
WireFee,
ExchangeUpdateReason,
- MetaStores,
-} from "../types/dbTypes";
-import { canonicalizeBaseUrl, j2s } from "../util/helpers";
-import * as Amounts from "../util/amounts";
-import { parsePaytoUri } from "../util/payto";
+} from "../db.js";
import {
+ Logger,
+ URL,
+ readSuccessResponseJsonOrThrow,
+ getExpiryTimestamp,
+ readSuccessResponseTextOrThrow,
+} from "../index.js";
+import { j2s, canonicalizeBaseUrl } from "../util/helpers.js";
+import { checkDbInvariant } from "../util/invariants.js";
+import { updateRetryInfoTimeout, initRetryInfo } from "../util/retries.js";
+import {
+ makeErrorDetails,
OperationFailedAndReportedError,
guardOperationException,
- makeErrorDetails,
-} from "./errors";
+} from "./errors.js";
+import { createRecoupGroup, processRecoupGroup } from "./recoup.js";
+import { InternalWalletState } from "./state.js";
import {
WALLET_CACHE_BREAKER_CLIENT_VERSION,
WALLET_EXCHANGE_PROTOCOL_VERSION,
-} from "./versions";
-import {
- getTimestampNow,
- Duration,
- isTimestampExpired,
- durationFromSpec,
-} from "../util/time";
-import { compare } from "../util/libtoolVersion";
-import { createRecoupGroup, processRecoupGroup } from "./recoup";
-import { TalerErrorCode } from "../TalerErrorCode";
-import {
- readSuccessResponseJsonOrThrow,
- readSuccessResponseTextOrThrow,
- getExpiryTimestamp,
-} from "../util/http";
-import { Logger } from "../util/logging";
-import { URL } from "../util/url";
-import { checkDbInvariant } from "../util/invariants";
-import { NotificationType } from "../types/notifications";
-import { updateRetryInfoTimeout, initRetryInfo } from "../util/retries";
+} from "./versions.js";
const logger = new Logger("exchanges.ts");
diff --git a/packages/taler-wallet-core/src/operations/pay.ts b/packages/taler-wallet-core/src/operations/pay.ts
index 1f8c4eb84..168a0f965 100644
--- a/packages/taler-wallet-core/src/operations/pay.ts
+++ b/packages/taler-wallet-core/src/operations/pay.ts
@@ -24,77 +24,14 @@
/**
* Imports.
*/
+import { AmountJson, Amounts, timestampIsBetween, getTimestampNow, isTimestampExpired, Timestamp, RefreshReason, CoinDepositPermission, NotificationType, TalerErrorDetails, Duration, durationMax, durationMin, durationMul, ContractTerms, codecForProposal, TalerErrorCode, codecForContractTerms, timestampAddDuration, ConfirmPayResult, ConfirmPayResultType, codecForMerchantPayResponse, PreparePayResult, PreparePayResultType, parsePayUri } from "@gnu-taler/taler-util";
import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto";
-import {
- CoinStatus,
- ProposalRecord,
- ProposalStatus,
- PurchaseRecord,
- Stores,
- WalletContractData,
- CoinRecord,
- DenominationRecord,
- AbortStatus,
- AllowedExchangeInfo,
- AllowedAuditorInfo,
-} from "../types/dbTypes";
-import { NotificationType } from "../types/notifications";
-import {
- codecForProposal,
- codecForContractTerms,
- CoinDepositPermission,
- codecForMerchantPayResponse,
- ContractTerms,
-} from "../types/talerTypes";
-import {
- ConfirmPayResult,
- TalerErrorDetails,
- PreparePayResult,
- RefreshReason,
- PreparePayResultType,
- ConfirmPayResultType,
-} from "../types/walletTypes";
-import { Amounts } from "../util/amounts";
-import { AmountJson } from "../util/amounts";
-import { Logger } from "../util/logging";
-import { parsePayUri } from "../util/taleruri";
-import {
- guardOperationException,
- makeErrorDetails,
- OperationFailedAndReportedError,
- OperationFailedError,
-} from "./errors";
-import { createRefreshGroup, getTotalRefreshCost } from "./refresh";
-import { InternalWalletState, EXCHANGE_COINS_LOCK } from "./state";
-import {
- getTimestampNow,
- timestampAddDuration,
- Duration,
- durationMax,
- durationMin,
- isTimestampExpired,
- durationMul,
- Timestamp,
- timestampIsBetween,
-} from "../util/time";
-import { strcmp, canonicalJson } from "../util/helpers";
-import {
- readSuccessResponseJsonOrThrow,
- throwUnexpectedRequestError,
- getHttpResponseErrorDetails,
- readSuccessResponseJsonOrErrorCode,
- HttpResponseStatus,
- readTalerErrorResponse,
-} from "../util/http";
-import { TalerErrorCode } from "../TalerErrorCode";
-import { URL } from "../util/url";
-import {
- initRetryInfo,
- updateRetryInfoTimeout,
- getRetryDuration,
-} from "../util/retries";
-import { TransactionHandle } from "../util/query";
-import { PayCoinSelection, CoinCandidateSelection, AvailableCoinInfo, selectPayCoins } from "../util/coinSelection";
+import { AbortStatus, AllowedAuditorInfo, AllowedExchangeInfo, CoinRecord, CoinStatus, DenominationRecord, getHttpResponseErrorDetails, guardOperationException, HttpResponseStatus, Logger, makeErrorDetails, OperationFailedAndReportedError, OperationFailedError, ProposalRecord, ProposalStatus, PurchaseRecord, readSuccessResponseJsonOrErrorCode, readSuccessResponseJsonOrThrow, readTalerErrorResponse, Stores, throwUnexpectedRequestError, TransactionHandle, URL, WalletContractData } from "../index.js";
+import { PayCoinSelection, CoinCandidateSelection, AvailableCoinInfo, selectPayCoins } from "../util/coinSelection.js";
+import { canonicalJson } from "../util/helpers.js";
+import { initRetryInfo, updateRetryInfoTimeout, getRetryDuration } from "../util/retries.js";
+import { getTotalRefreshCost, createRefreshGroup } from "./refresh.js";
+import { InternalWalletState, EXCHANGE_COINS_LOCK } from "./state.js";
/**
* Logger.
diff --git a/packages/taler-wallet-core/src/operations/pending.ts b/packages/taler-wallet-core/src/operations/pending.ts
index bae281937..01920a85b 100644
--- a/packages/taler-wallet-core/src/operations/pending.ts
+++ b/packages/taler-wallet-core/src/operations/pending.ts
@@ -23,20 +23,20 @@ import {
ReserveRecordStatus,
Stores,
AbortStatus,
-} from "../types/dbTypes";
+} from "../db.js";
import {
PendingOperationsResponse,
PendingOperationType,
ExchangeUpdateOperationStage,
ReserveType,
-} from "../types/pendingTypes";
+} from "../pending-types";
import {
Duration,
getTimestampNow,
Timestamp,
getDurationRemaining,
durationMin,
-} from "../util/time";
+} from "@gnu-taler/taler-util";
import { Store, TransactionHandle } from "../util/query";
import { InternalWalletState } from "./state";
import { getBalancesInsideTransaction } from "./balance";
diff --git a/packages/taler-wallet-core/src/operations/recoup.ts b/packages/taler-wallet-core/src/operations/recoup.ts
index a2c7cb6f5..337892f77 100644
--- a/packages/taler-wallet-core/src/operations/recoup.ts
+++ b/packages/taler-wallet-core/src/operations/recoup.ts
@@ -24,26 +24,14 @@
/**
* Imports.
*/
+import { Amounts, codecForRecoupConfirmation, getTimestampNow, NotificationType, RefreshReason, TalerErrorDetails } from "@gnu-taler/taler-util";
import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto";
-import {
- CoinRecord,
- CoinSourceType,
- CoinStatus,
- RecoupGroupRecord,
- RefreshCoinSource,
- ReserveRecordStatus,
- Stores,
- WithdrawCoinSource,
-} from "../types/dbTypes";
-import { NotificationType } from "../types/notifications";
-import { codecForRecoupConfirmation } from "../types/talerTypes";
-import { RefreshReason, TalerErrorDetails } from "../types/walletTypes";
-import { Amounts } from "../util/amounts";
+import { CoinRecord, CoinSourceType, CoinStatus, RecoupGroupRecord, RefreshCoinSource, ReserveRecordStatus, Stores, WithdrawCoinSource } from "../db.js";
+
import { readSuccessResponseJsonOrThrow } from "../util/http";
import { Logger } from "../util/logging";
import { TransactionHandle } from "../util/query";
import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries";
-import { getTimestampNow } from "../util/time";
import { URL } from "../util/url";
import { guardOperationException } from "./errors";
import { createRefreshGroup, processRefreshGroup } from "./refresh";
diff --git a/packages/taler-wallet-core/src/operations/refresh.ts b/packages/taler-wallet-core/src/operations/refresh.ts
index 621e9a108..d82ff946e 100644
--- a/packages/taler-wallet-core/src/operations/refresh.ts
+++ b/packages/taler-wallet-core/src/operations/refresh.ts
@@ -15,7 +15,6 @@
*/
import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto";
-import { RefreshNewDenomInfo } from "../types/cryptoTypes";
import {
CoinRecord,
CoinSourceType,
@@ -24,19 +23,17 @@ import {
RefreshGroupRecord,
RefreshPlanchet,
Stores,
-} from "../types/dbTypes";
-import { NotificationType } from "../types/notifications";
+} from "../db.js";
import {
codecForExchangeMeltResponse,
codecForExchangeRevealResponse,
-} from "../types/talerTypes";
-import {
CoinPublicKey,
+ NotificationType,
RefreshGroupId,
RefreshReason,
TalerErrorDetails,
-} from "../types/walletTypes";
-import { AmountJson, Amounts } from "../util/amounts";
+} from "@gnu-taler/taler-util";
+import { AmountJson, Amounts } from "@gnu-taler/taler-util";
import { amountToPretty } from "../util/helpers";
import { readSuccessResponseJsonOrThrow } from "../util/http";
import { checkDbInvariant } from "../util/invariants";
@@ -53,12 +50,13 @@ import {
timestampAddDuration,
timestampDifference,
timestampMin,
-} from "../util/time";
+} from "@gnu-taler/taler-util";
import { URL } from "../util/url";
import { guardOperationException } from "./errors";
import { updateExchangeFromUrl } from "./exchanges";
import { EXCHANGE_COINS_LOCK, InternalWalletState } from "./state";
import { isWithdrawableDenom, selectWithdrawalDenominations } from "./withdraw";
+import { RefreshNewDenomInfo } from "../crypto/cryptoTypes.js";
const logger = new Logger("refresh.ts");
diff --git a/packages/taler-wallet-core/src/operations/refund.ts b/packages/taler-wallet-core/src/operations/refund.ts
index 28d48d5ba..b9341e571 100644
--- a/packages/taler-wallet-core/src/operations/refund.ts
+++ b/packages/taler-wallet-core/src/operations/refund.ts
@@ -24,48 +24,37 @@
* Imports.
*/
import { InternalWalletState } from "./state";
-import {
- TalerErrorDetails,
- RefreshReason,
- CoinPublicKey,
- ApplyRefundResponse,
-} from "../types/walletTypes";
-import {
- Stores,
- CoinStatus,
- RefundReason,
- RefundState,
- PurchaseRecord,
- AbortStatus,
-} from "../types/dbTypes";
-import { NotificationType } from "../types/notifications";
-import { parseRefundUri } from "../util/taleruri";
-import { createRefreshGroup, getTotalRefreshCost } from "./refresh";
-import { Amounts, AmountJson } from "../util/amounts";
-import {
- MerchantCoinRefundStatus,
- MerchantCoinRefundSuccessStatus,
- MerchantCoinRefundFailureStatus,
- codecForMerchantOrderRefundPickupResponse,
- AbortRequest,
- AbortingCoin,
- codecForMerchantAbortPayRefundStatus,
- codecForAbortResponse,
-} from "../types/talerTypes";
import { guardOperationException } from "./errors";
import {
getTimestampNow,
Timestamp,
durationAdd,
timestampAddDuration,
-} from "../util/time";
+ TalerErrorDetails,
+ AbortingCoin,
+ AbortRequest,
+ AmountJson,
+ Amounts,
+ ApplyRefundResponse,
+ codecForAbortResponse,
+ codecForMerchantOrderRefundPickupResponse,
+ CoinPublicKey,
+ MerchantCoinRefundFailureStatus,
+ MerchantCoinRefundStatus,
+ MerchantCoinRefundSuccessStatus,
+ NotificationType,
+ parseRefundUri,
+ RefreshReason,
+} from "@gnu-taler/taler-util";
import { Logger } from "../util/logging";
import { readSuccessResponseJsonOrThrow } from "../util/http";
import { TransactionHandle } from "../util/query";
import { URL } from "../util/url";
import { updateRetryInfoTimeout, initRetryInfo } from "../util/retries";
import { checkDbInvariant } from "../util/invariants";
-import { TalerErrorCode } from "../TalerErrorCode";
+import { TalerErrorCode } from "@gnu-taler/taler-util";
+import { Stores, PurchaseRecord, CoinStatus, RefundState, AbortStatus, RefundReason } from "../db.js";
+import { getTotalRefreshCost, createRefreshGroup } from "./refresh.js";
const logger = new Logger("refund.ts");
diff --git a/packages/taler-wallet-core/src/operations/reserves.ts b/packages/taler-wallet-core/src/operations/reserves.ts
index 2be992bf2..fe6f323c8 100644
--- a/packages/taler-wallet-core/src/operations/reserves.ts
+++ b/packages/taler-wallet-core/src/operations/reserves.ts
@@ -19,69 +19,29 @@ import {
CreateReserveResponse,
TalerErrorDetails,
AcceptWithdrawalResponse,
-} from "../types/walletTypes";
-import { canonicalizeBaseUrl } from "../util/helpers";
-import { InternalWalletState } from "./state";
-import {
- ReserveRecordStatus,
- ReserveRecord,
- CurrencyRecord,
- Stores,
- WithdrawalGroupRecord,
- ReserveBankInfo,
-} from "../types/dbTypes";
-import { Logger } from "../util/logging";
-import { Amounts } from "../util/amounts";
-import {
- updateExchangeFromUrl,
- getExchangeTrust,
- getExchangePaytoUri,
-} from "./exchanges";
-import {
- codecForWithdrawOperationStatusResponse,
+ Amounts,
codecForBankWithdrawalOperationPostResponse,
-} from "../types/talerTypes";
-import { assertUnreachable } from "../util/assertUnreachable";
-import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto";
-import { randomBytes } from "../crypto/primitives/nacl-fast";
-import {
- processWithdrawGroup,
- getBankWithdrawalInfo,
- denomSelectionInfoToState,
- updateWithdrawalDenoms,
- selectWithdrawalDenominations,
- getCandidateWithdrawalDenoms,
-} from "./withdraw";
-import {
- guardOperationException,
- OperationFailedAndReportedError,
- makeErrorDetails,
- OperationFailedError,
-} from "./errors";
-import { NotificationType } from "../types/notifications";
-import { codecForReserveStatus } from "../types/ReserveStatus";
-import {
- getTimestampNow,
+ codecForReserveStatus,
+ codecForWithdrawOperationStatusResponse,
Duration,
- durationMin,
durationMax,
-} from "../util/time";
-import { TransactionHandle } from "../util/query";
-import { addPaytoQueryParams } from "../util/payto";
-import { TalerErrorCode } from "../TalerErrorCode";
-import {
- readSuccessResponseJsonOrErrorCode,
- throwUnexpectedRequestError,
- readSuccessResponseJsonOrThrow,
-} from "../util/http";
-import { codecForAny } from "../util/codec";
-import { URL } from "../util/url";
-import {
- initRetryInfo,
- getRetryDuration,
- updateRetryInfoTimeout,
-} from "../util/retries";
-import { ReserveTransactionType } from "../types/ReserveTransaction";
+ durationMin,
+ getTimestampNow,
+ NotificationType,
+ ReserveTransactionType,
+ TalerErrorCode,
+ addPaytoQueryParams,
+} from "@gnu-taler/taler-util";
+import { randomBytes } from "../crypto/primitives/nacl-fast.js";
+import { Stores, ReserveRecordStatus, ReserveBankInfo, ReserveRecord, CurrencyRecord, WithdrawalGroupRecord } from "../db.js";
+import { Logger, encodeCrock, getRandomBytes, readSuccessResponseJsonOrThrow, URL, readSuccessResponseJsonOrErrorCode, throwUnexpectedRequestError, TransactionHandle } from "../index.js";
+import { assertUnreachable } from "../util/assertUnreachable.js";
+import { canonicalizeBaseUrl } from "../util/helpers.js";
+import { initRetryInfo, getRetryDuration, updateRetryInfoTimeout } from "../util/retries.js";
+import { guardOperationException, OperationFailedError } from "./errors.js";
+import { updateExchangeFromUrl, getExchangeTrust, getExchangePaytoUri } from "./exchanges.js";
+import { InternalWalletState } from "./state.js";
+import { updateWithdrawalDenoms, getCandidateWithdrawalDenoms, selectWithdrawalDenominations, denomSelectionInfoToState, processWithdrawGroup, getBankWithdrawalInfo } from "./withdraw.js";
const logger = new Logger("reserves.ts");
diff --git a/packages/taler-wallet-core/src/operations/state.ts b/packages/taler-wallet-core/src/operations/state.ts
index ce52affe4..752a57ffb 100644
--- a/packages/taler-wallet-core/src/operations/state.ts
+++ b/packages/taler-wallet-core/src/operations/state.ts
@@ -14,16 +14,15 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
+/**
+ * Imports.
+ */
+import { WalletNotification, BalancesResponse } from "@gnu-taler/taler-util";
+import { Stores } from "../db.js";
+import { Logger, CryptoApi, OpenedPromise, Database, CryptoWorkerFactory, openPromise } from "../index.js";
+import { PendingOperationsResponse } from "../pending-types.js";
+import { AsyncOpMemoMap, AsyncOpMemoSingle } from "../util/asyncMemo.js";
import { HttpRequestLibrary } from "../util/http";
-import { BalancesResponse } from "../types/walletTypes";
-import { CryptoApi, CryptoWorkerFactory } from "../crypto/workers/cryptoApi";
-import { AsyncOpMemoMap, AsyncOpMemoSingle } from "../util/asyncMemo";
-import { Logger } from "../util/logging";
-import { PendingOperationsResponse } from "../types/pendingTypes";
-import { WalletNotification } from "../types/notifications";
-import { Database } from "../util/query";
-import { openPromise, OpenedPromise } from "../util/promiseUtils";
-import { Stores } from "../types/dbTypes";
type NotificationListener = (n: WalletNotification) => void;
diff --git a/packages/taler-wallet-core/src/operations/testing.ts b/packages/taler-wallet-core/src/operations/testing.ts
index 162e23b31..aa9afc50d 100644
--- a/packages/taler-wallet-core/src/operations/testing.ts
+++ b/packages/taler-wallet-core/src/operations/testing.ts
@@ -14,28 +14,20 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
+/**
+ * Imports.
+ */
import { Logger } from "../util/logging";
import {
HttpRequestLibrary,
readSuccessResponseJsonOrThrow,
checkSuccessResponseOrThrow,
} from "../util/http";
-import { codecForAny } from "../util/codec";
-import {
- AmountString,
- CheckPaymentResponse,
- codecForCheckPaymentResponse,
-} from "../types/talerTypes";
-import { InternalWalletState } from "./state";
-import { createTalerWithdrawReserve } from "./reserves";
-import { URL } from "../util/url";
-import { Wallet } from "../wallet";
-import { Amounts } from "../util/amounts";
-import {
- TestPayArgs,
- PreparePayResultType,
- IntegrationTestArgs,
-} from "../types/walletTypes";
+import { AmountString, codecForAny, CheckPaymentResponse, codecForCheckPaymentResponse, IntegrationTestArgs, Amounts, TestPayArgs, PreparePayResultType } from "@gnu-taler/taler-util";
+import { URL } from "../index.js";
+import { Wallet } from "../wallet.js";
+import { createTalerWithdrawReserve } from "./reserves.js";
+import { InternalWalletState } from "./state.js";
const logger = new Logger("operations/testing.ts");
diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts
index 9242d70d5..5ea92912b 100644
--- a/packages/taler-wallet-core/src/operations/tip.ts
+++ b/packages/taler-wallet-core/src/operations/tip.ts
@@ -14,45 +14,50 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { InternalWalletState } from "./state";
-import { parseTipUri } from "../util/taleruri";
-import { PrepareTipResult, TalerErrorDetails } from "../types/walletTypes";
+/**
+ * Imports.
+ */
import {
- TipPlanchetDetail,
+ PrepareTipResult,
+ parseTipUri,
codecForTipPickupGetResponse,
+ Amounts,
+ getTimestampNow,
+ TalerErrorDetails,
+ NotificationType,
+ TipPlanchetDetail,
+ TalerErrorCode,
codecForTipResponse,
-} from "../types/talerTypes";
-import * as Amounts from "../util/amounts";
+} from "@gnu-taler/taler-util";
+import { DerivedTipPlanchet } from "../crypto/cryptoTypes.js";
import {
Stores,
+ DenominationRecord,
CoinRecord,
CoinSourceType,
CoinStatus,
- DenominationRecord,
-} from "../types/dbTypes";
+} from "../db.js";
+import {
+ Logger,
+ URL,
+ readSuccessResponseJsonOrThrow,
+ encodeCrock,
+ getRandomBytes,
+ getHttpResponseErrorDetails,
+} from "../index.js";
+import { j2s } from "../util/helpers.js";
+import { checkDbInvariant, checkLogicInvariant } from "../util/invariants.js";
+import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries.js";
+import { guardOperationException, makeErrorDetails } from "./errors.js";
+import { updateExchangeFromUrl } from "./exchanges.js";
+import { InternalWalletState } from "./state";
import {
getExchangeWithdrawalInfo,
- denomSelectionInfoToState,
updateWithdrawalDenoms,
getCandidateWithdrawalDenoms,
selectWithdrawalDenominations,
-} from "./withdraw";
-import { updateExchangeFromUrl } from "./exchanges";
-import { getRandomBytes, encodeCrock } from "../crypto/talerCrypto";
-import { guardOperationException, makeErrorDetails } from "./errors";
-import { NotificationType } from "../types/notifications";
-import { getTimestampNow } from "../util/time";
-import {
- getHttpResponseErrorDetails,
- readSuccessResponseJsonOrThrow,
-} from "../util/http";
-import { URL } from "../util/url";
-import { Logger } from "../util/logging";
-import { checkDbInvariant, checkLogicInvariant } from "../util/invariants";
-import { TalerErrorCode } from "../TalerErrorCode";
-import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries";
-import { j2s } from "../util/helpers";
-import { DerivedTipPlanchet } from "../types/cryptoTypes";
+ denomSelectionInfoToState,
+} from "./withdraw.js";
const logger = new Logger("operations/tip.ts");
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts
index d49031551..94925da16 100644
--- a/packages/taler-wallet-core/src/operations/transactions.ts
+++ b/packages/taler-wallet-core/src/operations/transactions.ts
@@ -24,9 +24,8 @@ import {
RefundState,
ReserveRecordStatus,
AbortStatus,
-} from "../types/dbTypes";
-import { Amounts, AmountJson } from "../util/amounts";
-import { timestampCmp } from "../util/time";
+} from "../db.js";
+import { AmountJson, Amounts, timestampCmp } from "@gnu-taler/taler-util";
import {
TransactionsRequest,
TransactionsResponse,
@@ -36,9 +35,8 @@ import {
WithdrawalType,
WithdrawalDetails,
OrderShortInfo,
-} from "../types/transactionsTypes";
+} from "@gnu-taler/taler-util";
import { getFundingPaytoUris } from "./reserves";
-import { TipResponse } from "../types/talerTypes";
/**
* Create an event ID from the type and the primary key for the event.
diff --git a/packages/taler-wallet-core/src/operations/withdraw-test.ts b/packages/taler-wallet-core/src/operations/withdraw-test.ts
index 806d8e82d..ad52a5f0c 100644
--- a/packages/taler-wallet-core/src/operations/withdraw-test.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw-test.ts
@@ -14,10 +14,10 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
+import { Amounts } from "@gnu-taler/taler-util";
import test from "ava";
+import { DenominationRecord, DenominationStatus } from "../db.js";
import { selectWithdrawalDenominations } from "./withdraw";
-import { Amounts } from "../util/amounts";
-import { DenominationRecord, DenominationStatus } from "../types/dbTypes";
test("withdrawal selection bug repro", (t) => {
const amount = {
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts
index f8748142f..0c1acf8ec 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -14,7 +14,7 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { AmountJson, Amounts } from "../util/amounts";
+import { AmountJson, Amounts, parseWithdrawUri, Timestamp } from "@gnu-taler/taler-util";
import {
DenominationRecord,
Stores,
@@ -25,22 +25,22 @@ import {
DenominationSelectionInfo,
PlanchetRecord,
DenomSelectionState,
-} from "../types/dbTypes";
+ ExchangeRecord,
+ ExchangeWireInfo,
+} from "../db";
import {
BankWithdrawDetails,
- ExchangeWithdrawDetails,
TalerErrorDetails,
ExchangeListItem,
WithdrawUriInfoResponse,
-} from "../types/walletTypes";
+} from "@gnu-taler/taler-util";
import {
codecForWithdrawOperationStatusResponse,
codecForWithdrawResponse,
WithdrawResponse,
codecForTalerConfigResponse,
-} from "../types/talerTypes";
+} from "@gnu-taler/taler-util";
import { InternalWalletState } from "./state";
-import { parseWithdrawUri } from "../util/taleruri";
import { Logger } from "../util/logging";
import { updateExchangeFromUrl, getExchangeTrust } from "./exchanges";
import {
@@ -48,29 +48,115 @@ import {
WALLET_BANK_INTEGRATION_PROTOCOL_VERSION,
} from "./versions";
-import * as LibtoolVersion from "../util/libtoolVersion";
+import * as LibtoolVersion from "@gnu-taler/taler-util";
import {
guardOperationException,
makeErrorDetails,
OperationFailedError,
} from "./errors";
-import { NotificationType } from "../types/notifications";
+import { NotificationType } from "@gnu-taler/taler-util";
import {
getTimestampNow,
getDurationRemaining,
timestampCmp,
timestampSubtractDuraction,
-} from "../util/time";
+} from "@gnu-taler/taler-util";
import { readSuccessResponseJsonOrThrow } from "../util/http";
import { URL } from "../util/url";
-import { TalerErrorCode } from "../TalerErrorCode";
-import { encodeCrock } from "../crypto/talerCrypto";
+import { TalerErrorCode } from "@gnu-taler/taler-util";
import { updateRetryInfoTimeout, initRetryInfo } from "../util/retries";
-import { compare } from "../util/libtoolVersion";
-import { j2s } from "../util/helpers";
+import { compare } from "@gnu-taler/taler-util";
const logger = new Logger("withdraw.ts");
+
+/**
+ * Information about what will happen when creating a reserve.
+ *
+ * Sent to the wallet frontend to be rendered and shown to the user.
+ */
+ interface ExchangeWithdrawDetails {
+ /**
+ * Exchange that the reserve will be created at.
+ */
+ exchangeInfo: ExchangeRecord;
+
+ /**
+ * Filtered wire info to send to the bank.
+ */
+ exchangeWireAccounts: string[];
+
+ /**
+ * Selected denominations for withdraw.
+ */
+ selectedDenoms: DenominationSelectionInfo;
+
+ /**
+ * Fees for withdraw.
+ */
+ withdrawFee: AmountJson;
+
+ /**
+ * Remaining balance that is too small to be withdrawn.
+ */
+ overhead: AmountJson;
+
+ /**
+ * Wire fees from the exchange.
+ */
+ wireFees: ExchangeWireInfo;
+
+ /**
+ * Does the wallet know about an auditor for
+ * the exchange that the reserve.
+ */
+ isAudited: boolean;
+
+ /**
+ * Did the user already accept the current terms of service for the exchange?
+ */
+ termsOfServiceAccepted: boolean;
+
+ /**
+ * The exchange is trusted directly.
+ */
+ isTrusted: boolean;
+
+ /**
+ * The earliest deposit expiration of the selected coins.
+ */
+ earliestDepositExpiration: Timestamp;
+
+ /**
+ * Number of currently offered denominations.
+ */
+ numOfferedDenoms: number;
+
+ /**
+ * Public keys of trusted auditors for the currency we're withdrawing.
+ */
+ trustedAuditorPubs: string[];
+
+ /**
+ * Result of checking the wallet's version
+ * against the exchange's version.
+ *
+ * Older exchanges don't return version information.
+ */
+ versionMatch: LibtoolVersion.VersionMatchResult | undefined;
+
+ /**
+ * Libtool-style version string for the exchange or "unknown"
+ * for older exchanges.
+ */
+ exchangeVersion: string;
+
+ /**
+ * Libtool-style version string for the wallet.
+ */
+ walletVersion: string;
+}
+
/**
* Check if a denom is withdrawable based on the expiration time
* and revocation state.
diff --git a/packages/taler-wallet-core/src/types/pendingTypes.ts b/packages/taler-wallet-core/src/pending-types.ts
index d41d2a977..cefaa23ec 100644
--- a/packages/taler-wallet-core/src/types/pendingTypes.ts
+++ b/packages/taler-wallet-core/src/pending-types.ts
@@ -16,15 +16,17 @@
/**
* Type and schema definitions for pending operations in the wallet.
+ *
+ * These are only used internally, and are not part of the public
+ * interface to the wallet.
*/
/**
* Imports.
*/
-import { TalerErrorDetails, BalancesResponse } from "./walletTypes";
-import { ReserveRecordStatus } from "./dbTypes";
-import { Timestamp, Duration } from "../util/time";
-import { RetryInfo } from "../util/retries";
+import { TalerErrorDetails, BalancesResponse, Duration, Timestamp } from "@gnu-taler/taler-util";
+import { ReserveRecordStatus } from "./db.js";
+import { RetryInfo } from "./util/retries.js";
export enum PendingOperationType {
Bug = "bug",
diff --git a/packages/taler-wallet-core/src/types/dbTypes.ts b/packages/taler-wallet-core/src/types/dbTypes.ts
deleted file mode 100644
index 689055df8..000000000
--- a/packages/taler-wallet-core/src/types/dbTypes.ts
+++ /dev/null
@@ -1,1775 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2018-2020 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * Types for records stored in the wallet's database.
- *
- * Types for the objects in the database should end in "-Record".
- */
-
-/**
- * Imports.
- */
-import { AmountJson } from "../util/amounts";
-import {
- Auditor,
- CoinDepositPermission,
- ExchangeSignKeyJson,
- MerchantInfo,
- Product,
- InternationalizedString,
- AmountString,
- ContractTerms,
-} from "./talerTypes";
-
-import { Index, Store } from "../util/query";
-import { TalerErrorDetails, RefreshReason } from "./walletTypes";
-import { ReserveTransaction } from "./ReserveTransaction";
-import { Timestamp, Duration } from "../util/time";
-import { IDBKeyPath } from "@gnu-taler/idb-bridge";
-import { RetryInfo } from "../util/retries";
-import { PayCoinSelection } from "../util/coinSelection";
-
-export enum ReserveRecordStatus {
- /**
- * Reserve must be registered with the bank.
- */
- REGISTERING_BANK = "registering-bank",
-
- /**
- * We've registered reserve's information with the bank
- * and are now waiting for the user to confirm the withdraw
- * with the bank (typically 2nd factor auth).
- */
- WAIT_CONFIRM_BANK = "wait-confirm-bank",
-
- /**
- * Querying reserve status with the exchange.
- */
- QUERYING_STATUS = "querying-status",
-
- /**
- * The corresponding withdraw record has been created.
- * No further processing is done, unless explicitly requested
- * by the user.
- */
- DORMANT = "dormant",
-
- /**
- * The bank aborted the withdrawal.
- */
- BANK_ABORTED = "bank-aborted",
-}
-
-export interface ReserveBankInfo {
- /**
- * Status URL that the wallet will use to query the status
- * of the Taler withdrawal operation on the bank's side.
- */
- statusUrl: string;
-
- confirmUrl?: string;
-
- /**
- * Exchange payto URI that the bank will use to fund the reserve.
- */
- exchangePaytoUri: string;
-}
-
-/**
- * A reserve record as stored in the wallet's database.
- */
-export interface ReserveRecord {
- /**
- * The reserve public key.
- */
- reservePub: string;
-
- /**
- * The reserve private key.
- */
- reservePriv: string;
-
- /**
- * The exchange base URL.
- */
- exchangeBaseUrl: string;
-
- /**
- * Currency of the reserve.
- */
- currency: string;
-
- /**
- * Time when the reserve was created.
- */
- timestampCreated: Timestamp;
-
- /**
- * Time when the information about this reserve was posted to the bank.
- *
- * Only applies if bankWithdrawStatusUrl is defined.
- *
- * Set to 0 if that hasn't happened yet.
- */
- timestampReserveInfoPosted: Timestamp | undefined;
-
- /**
- * Time when the reserve was confirmed by the bank.
- *
- * Set to undefined if not confirmed yet.
- */
- timestampBankConfirmed: Timestamp | undefined;
-
- /**
- * Wire information (as payto URI) for the bank account that
- * transfered funds for this reserve.
- */
- senderWire?: string;
-
- /**
- * Amount that was sent by the user to fund the reserve.
- */
- instructedAmount: AmountJson;
-
- /**
- * Extra state for when this is a withdrawal involving
- * a Taler-integrated bank.
- */
- bankInfo?: ReserveBankInfo;
-
- initialWithdrawalGroupId: string;
-
- /**
- * Did we start the first withdrawal for this reserve?
- *
- * We only report a pending withdrawal for the reserve before
- * the first withdrawal has started.
- */
- initialWithdrawalStarted: boolean;
-
- /**
- * Initial denomination selection, stored here so that
- * we can show this information in the transactions/balances
- * before we have a withdrawal group.
- */
- initialDenomSel: DenomSelectionState;
-
- reserveStatus: ReserveRecordStatus;
-
- /**
- * Was a reserve query requested? If so, query again instead
- * of going into dormant status.
- */
- requestedQuery: boolean;
-
- /**
- * Time of the last successful status query.
- */
- lastSuccessfulStatusQuery: Timestamp | undefined;
-
- /**
- * Retry info. This field is present even if no retry is scheduled,
- * because we need it to be present for the index on the object store
- * to work.
- */
- retryInfo: RetryInfo;
-
- /**
- * Last error that happened in a reserve operation
- * (either talking to the bank or the exchange).
- */
- lastError: TalerErrorDetails | undefined;
-}
-
-/**
- * Auditor record as stored with currencies in the exchange database.
- */
-export interface AuditorRecord {
- /**
- * Base url of the auditor.
- */
- baseUrl: string;
-
- /**
- * Public signing key of the auditor.
- */
- auditorPub: string;
-
- /**
- * Time when the auditing expires.
- */
- expirationStamp: number;
-}
-
-/**
- * Exchange for currencies as stored in the wallet's currency
- * information database.
- */
-export interface ExchangeForCurrencyRecord {
- /**
- * FIXME: unused?
- */
- exchangeMasterPub: string;
-
- /**
- * Base URL of the exchange.
- */
- exchangeBaseUrl: string;
-}
-
-/**
- * Information about a currency as displayed in the wallet's database.
- */
-export interface CurrencyRecord {
- /**
- * Name of the currency.
- */
- name: string;
-
- /**
- * Number of fractional digits to show when rendering the currency.
- */
- fractionalDigits: number;
-
- /**
- * Auditors that the wallet trusts for this currency.
- */
- auditors: AuditorRecord[];
-
- /**
- * Exchanges that the wallet trusts for this currency.
- */
- exchanges: ExchangeForCurrencyRecord[];
-}
-
-/**
- * Status of a denomination.
- */
-export enum DenominationStatus {
- /**
- * Verification was delayed.
- */
- Unverified = "unverified",
- /**
- * Verified as valid.
- */
- VerifiedGood = "verified-good",
- /**
- * Verified as invalid.
- */
- VerifiedBad = "verified-bad",
-}
-
-/**
- * Denomination record as stored in the wallet's database.
- */
-export interface DenominationRecord {
- /**
- * Value of one coin of the denomination.
- */
- value: AmountJson;
-
- /**
- * The denomination public key.
- */
- denomPub: string;
-
- /**
- * Hash of the denomination public key.
- * Stored in the database for faster lookups.
- */
- denomPubHash: string;
-
- /**
- * Fee for withdrawing.
- */
- feeWithdraw: AmountJson;
-
- /**
- * Fee for depositing.
- */
- feeDeposit: AmountJson;
-
- /**
- * Fee for refreshing.
- */
- feeRefresh: AmountJson;
-
- /**
- * Fee for refunding.
- */
- feeRefund: AmountJson;
-
- /**
- * Validity start date of the denomination.
- */
- stampStart: Timestamp;
-
- /**
- * Date after which the currency can't be withdrawn anymore.
- */
- stampExpireWithdraw: Timestamp;
-
- /**
- * Date after the denomination officially doesn't exist anymore.
- */
- stampExpireLegal: Timestamp;
-
- /**
- * Data after which coins of this denomination can't be deposited anymore.
- */
- stampExpireDeposit: Timestamp;
-
- /**
- * Signature by the exchange's master key over the denomination
- * information.
- */
- masterSig: string;
-
- /**
- * Did we verify the signature on the denomination?
- *
- * FIXME: Rename to "verificationStatus"?
- */
- status: DenominationStatus;
-
- /**
- * Was this denomination still offered by the exchange the last time
- * we checked?
- * Only false when the exchange redacts a previously published denomination.
- */
- isOffered: boolean;
-
- /**
- * Did the exchange revoke the denomination?
- * When this field is set to true in the database, the same transaction
- * should also mark all affected coins as revoked.
- */
- isRevoked: boolean;
-
- /**
- * Base URL of the exchange.
- */
- exchangeBaseUrl: string;
-}
-
-/**
- * Details about the exchange that we only know after
- * querying /keys and /wire.
- */
-export interface ExchangeDetails {
- /**
- * Master public key of the exchange.
- */
- masterPublicKey: string;
-
- /**
- * Auditors (partially) auditing the exchange.
- */
- auditors: Auditor[];
-
- /**
- * Currency that the exchange offers.
- */
- currency: string;
-
- /**
- * Last observed protocol version.
- */
- protocolVersion: string;
-
- reserveClosingDelay: Duration;
-
- /**
- * Signing keys we got from the exchange, can also contain
- * older signing keys that are not returned by /keys anymore.
- */
- signingKeys: ExchangeSignKeyJson[];
-
- /**
- * Timestamp for last update.
- */
- lastUpdateTime: Timestamp;
-
- /**
- * When should we next update the information about the exchange?
- */
- nextUpdateTime: Timestamp;
-}
-
-export enum ExchangeUpdateStatus {
- FetchKeys = "fetch-keys",
- FetchWire = "fetch-wire",
- FetchTerms = "fetch-terms",
- FinalizeUpdate = "finalize-update",
- Finished = "finished",
-}
-
-export interface ExchangeBankAccount {
- payto_uri: string;
- master_sig: string;
-}
-
-export interface ExchangeWireInfo {
- feesForType: { [wireMethod: string]: WireFee[] };
- accounts: ExchangeBankAccount[];
-}
-
-export enum ExchangeUpdateReason {
- Initial = "initial",
- Forced = "forced",
- Scheduled = "scheduled",
-}
-
-/**
- * Exchange record as stored in the wallet's database.
- */
-export interface ExchangeRecord {
- /**
- * Base url of the exchange.
- */
- baseUrl: string;
-
- /**
- * Did we finish adding the exchange?
- */
- addComplete: boolean;
-
- /**
- * Is this a permanent or temporary exchange record?
- */
- permanent: boolean;
-
- /**
- * Was the exchange added as a built-in exchange?
- */
- builtIn: boolean;
-
- /**
- * Details, once known.
- */
- details: ExchangeDetails | undefined;
-
- /**
- * Mapping from wire method type to the wire fee.
- */
- wireInfo: ExchangeWireInfo | undefined;
-
- /**
- * Terms of service text or undefined if not downloaded yet.
- *
- * This is just used as a cache of the last downloaded ToS.
- */
- termsOfServiceText: string | undefined;
-
- /**
- * ETag for last terms of service download.
- */
- termsOfServiceLastEtag: string | undefined;
-
- /**
- * ETag for last terms of service download.
- */
- termsOfServiceAcceptedEtag: string | undefined;
-
- /**
- * Time when the update to the exchange has been started or
- * undefined if no update is in progress.
- */
- updateStarted: Timestamp | undefined;
-
- /**
- * Status of updating the info about the exchange.
- */
- updateStatus: ExchangeUpdateStatus;
-
- updateReason?: ExchangeUpdateReason;
-
- lastError?: TalerErrorDetails;
-
- /**
- * Retry status for fetching updated information about the exchange.
- */
- retryInfo: RetryInfo;
-
- /**
- * Next time that we should check if coins need to be refreshed.
- *
- * Updated whenever the exchange's denominations are updated or when
- * the refresh check has been done.
- */
- nextRefreshCheck?: Timestamp;
-}
-
-/**
- * A coin that isn't yet signed by an exchange.
- */
-export interface PlanchetRecord {
- /**
- * Public key of the coin.
- */
- coinPub: string;
-
- /**
- * Private key of the coin.
- */
- coinPriv: string;
-
- /**
- * Withdrawal group that this planchet belongs to
- * (or the empty string).
- */
- withdrawalGroupId: string;
-
- /**
- * Index within the withdrawal group (or -1).
- */
- coinIdx: number;
-
- withdrawalDone: boolean;
-
- lastError: TalerErrorDetails | undefined;
-
- /**
- * Public key of the reserve that this planchet
- * is being withdrawn from.
- *
- * Can be the empty string (non-null/undefined for DB indexing)
- * if this is a tipping reserve.
- */
- reservePub: string;
-
- denomPubHash: string;
-
- denomPub: string;
-
- blindingKey: string;
-
- withdrawSig: string;
-
- coinEv: string;
-
- coinEvHash: string;
-
- coinValue: AmountJson;
-
- isFromTip: boolean;
-}
-
-/**
- * Planchet for a coin during refrehs.
- */
-export interface RefreshPlanchet {
- /**
- * Public key for the coin.
- */
- publicKey: string;
-
- /**
- * Private key for the coin.
- */
- privateKey: string;
-
- /**
- * Blinded public key.
- */
- coinEv: string;
-
- coinEvHash: string;
-
- /**
- * Blinding key used.
- */
- blindingKey: string;
-}
-
-/**
- * Status of a coin.
- */
-export enum CoinStatus {
- /**
- * Withdrawn and never shown to anybody.
- */
- Fresh = "fresh",
- /**
- * A coin that has been spent and refreshed.
- */
- Dormant = "dormant",
-}
-
-export enum CoinSourceType {
- Withdraw = "withdraw",
- Refresh = "refresh",
- Tip = "tip",
-}
-
-export interface WithdrawCoinSource {
- type: CoinSourceType.Withdraw;
-
- /**
- * Can be the empty string for orphaned coins.
- */
- withdrawalGroupId: string;
-
- /**
- * Index of the coin in the withdrawal session.
- */
- coinIndex: number;
-
- /**
- * Reserve public key for the reserve we got this coin from.
- */
- reservePub: string;
-}
-
-export interface RefreshCoinSource {
- type: CoinSourceType.Refresh;
- oldCoinPub: string;
-}
-
-export interface TipCoinSource {
- type: CoinSourceType.Tip;
- walletTipId: string;
- coinIndex: number;
-}
-
-export type CoinSource = WithdrawCoinSource | RefreshCoinSource | TipCoinSource;
-
-/**
- * CoinRecord as stored in the "coins" data store
- * of the wallet database.
- */
-export interface CoinRecord {
- /**
- * Where did the coin come from? Used for recouping coins.
- */
- coinSource: CoinSource;
-
- /**
- * Public key of the coin.
- */
- coinPub: string;
-
- /**
- * Private key to authorize operations on the coin.
- */
- coinPriv: string;
-
- /**
- * Key used by the exchange used to sign the coin.
- */
- denomPub: string;
-
- /**
- * Hash of the public key that signs the coin.
- */
- denomPubHash: string;
-
- /**
- * Unblinded signature by the exchange.
- */
- denomSig: string;
-
- /**
- * Amount that's left on the coin.
- */
- currentAmount: AmountJson;
-
- /**
- * Base URL that identifies the exchange from which we got the
- * coin.
- */
- exchangeBaseUrl: string;
-
- /**
- * The coin is currently suspended, and will not be used for payments.
- */
- suspended: boolean;
-
- /**
- * Blinding key used when withdrawing the coin.
- * Potentionally used again during payback.
- */
- blindingKey: string;
-
- /**
- * Hash of the coin envelope.
- *
- * Stored here for indexing purposes, so that when looking at a
- * reserve history, we can quickly find the coin for a withdrawal transaction.
- */
- coinEvHash: string;
-
- /**
- * Status of the coin.
- */
- status: CoinStatus;
-}
-
-export enum ProposalStatus {
- /**
- * Not downloaded yet.
- */
- DOWNLOADING = "downloading",
- /**
- * Proposal downloaded, but the user needs to accept/reject it.
- */
- PROPOSED = "proposed",
- /**
- * The user has accepted the proposal.
- */
- ACCEPTED = "accepted",
- /**
- * The user has rejected the proposal.
- */
- REFUSED = "refused",
- /**
- * Downloading or processing the proposal has failed permanently.
- */
- PERMANENTLY_FAILED = "permanently-failed",
- /**
- * Downloaded proposal was detected as a re-purchase.
- */
- REPURCHASE = "repurchase",
-}
-
-export interface ProposalDownload {
- /**
- * The contract that was offered by the merchant.
- */
- contractTermsRaw: any;
-
- contractData: WalletContractData;
-}
-
-/**
- * Record for a downloaded order, stored in the wallet's database.
- */
-export interface ProposalRecord {
- orderId: string;
-
- merchantBaseUrl: string;
-
- /**
- * Downloaded data from the merchant.
- */
- download: ProposalDownload | undefined;
-
- /**
- * Unique ID when the order is stored in the wallet DB.
- */
- proposalId: string;
-
- /**
- * Timestamp (in ms) of when the record
- * was created.
- */
- timestamp: Timestamp;
-
- /**
- * Private key for the nonce.
- */
- noncePriv: string;
-
- /**
- * Public key for the nonce.
- */
- noncePub: string;
-
- claimToken: string | undefined;
-
- proposalStatus: ProposalStatus;
-
- repurchaseProposalId: string | undefined;
-
- /**
- * Session ID we got when downloading the contract.
- */
- downloadSessionId?: string;
-
- /**
- * Retry info, even present when the operation isn't active to allow indexing
- * on the next retry timestamp.
- */
- retryInfo: RetryInfo;
-
- lastError: TalerErrorDetails | undefined;
-}
-
-/**
- * Status of a tip we got from a merchant.
- */
-export interface TipRecord {
- lastError: TalerErrorDetails | undefined;
-
- /**
- * Has the user accepted the tip? Only after the tip has been accepted coins
- * withdrawn from the tip may be used.
- */
- acceptedTimestamp: Timestamp | undefined;
-
- /**
- * The tipped amount.
- */
- tipAmountRaw: AmountJson;
-
- tipAmountEffective: AmountJson;
-
- /**
- * Timestamp, the tip can't be picked up anymore after this deadline.
- */
- tipExpiration: Timestamp;
-
- /**
- * The exchange that will sign our coins, chosen by the merchant.
- */
- exchangeBaseUrl: string;
-
- /**
- * Base URL of the merchant that is giving us the tip.
- */
- merchantBaseUrl: string;
-
- /**
- * Denomination selection made by the wallet for picking up
- * this tip.
- */
- denomsSel: DenomSelectionState;
-
- /**
- * Tip ID chosen by the wallet.
- */
- walletTipId: string;
-
- /**
- * Secret seed used to derive planchets for this tip.
- */
- secretSeed: string;
-
- /**
- * The merchant's identifier for this tip.
- */
- merchantTipId: string;
-
- createdTimestamp: Timestamp;
-
- /**
- * Timestamp for when the wallet finished picking up the tip
- * from the merchant.
- */
- pickedUpTimestamp: Timestamp | undefined;
-
- /**
- * Retry info, even present when the operation isn't active to allow indexing
- * on the next retry timestamp.
- */
- retryInfo: RetryInfo;
-}
-
-export interface RefreshGroupRecord {
- /**
- * Retry info, even present when the operation isn't active to allow indexing
- * on the next retry timestamp.
- */
- retryInfo: RetryInfo;
-
- lastError: TalerErrorDetails | undefined;
-
- lastErrorPerCoin: { [coinIndex: number]: TalerErrorDetails };
-
- refreshGroupId: string;
-
- reason: RefreshReason;
-
- oldCoinPubs: string[];
-
- refreshSessionPerCoin: (RefreshSessionRecord | undefined)[];
-
- inputPerCoin: AmountJson[];
-
- estimatedOutputPerCoin: AmountJson[];
-
- /**
- * Flag for each coin whether refreshing finished.
- * If a coin can't be refreshed (remaining value too small),
- * it will be marked as finished, but no refresh session will
- * be created.
- */
- finishedPerCoin: boolean[];
-
- timestampCreated: Timestamp;
-
- /**
- * Timestamp when the refresh session finished.
- */
- timestampFinished: Timestamp | undefined;
-}
-
-/**
- * Ongoing refresh
- */
-export interface RefreshSessionRecord {
- /**
- * 512-bit secret that can be used to derive
- * the other cryptographic material for the refresh session.
- *
- * FIXME: We currently store the derived material, but
- * should always derive it.
- */
- sessionSecretSeed: string;
-
- /**
- * Sum of the value of denominations we want
- * to withdraw in this session, without fees.
- */
- amountRefreshOutput: AmountJson;
-
- /**
- * Hashed denominations of the newly requested coins.
- */
- newDenoms: {
- denomPubHash: string;
- count: number;
- }[];
-
- /**
- * The no-reveal-index after we've done the melting.
- */
- norevealIndex?: number;
-}
-
-/**
- * Wire fee for one wire method as stored in the
- * wallet's database.
- */
-export interface WireFee {
- /**
- * Fee for wire transfers.
- */
- wireFee: AmountJson;
-
- /**
- * Fees to close and refund a reserve.
- */
- closingFee: AmountJson;
-
- /**
- * Start date of the fee.
- */
- startStamp: Timestamp;
-
- /**
- * End date of the fee.
- */
- endStamp: Timestamp;
-
- /**
- * Signature made by the exchange master key.
- */
- sig: string;
-}
-
-/**
- * Record to store information about a refund event.
- *
- * All information about a refund is stored with the purchase,
- * this event is just for the history.
- *
- * The event is only present for completed refunds.
- */
-export interface RefundEventRecord {
- timestamp: Timestamp;
- merchantExecutionTimestamp: Timestamp;
- refundGroupId: string;
- proposalId: string;
-}
-
-export enum RefundState {
- Failed = "failed",
- Applied = "applied",
- Pending = "pending",
-}
-
-/**
- * State of one refund from the merchant, maintained by the wallet.
- */
-export type WalletRefundItem =
- | WalletRefundFailedItem
- | WalletRefundPendingItem
- | WalletRefundAppliedItem;
-
-export interface WalletRefundItemCommon {
- // Execution time as claimed by the merchant
- executionTime: Timestamp;
-
- /**
- * Time when the wallet became aware of the refund.
- */
- obtainedTime: Timestamp;
-
- refundAmount: AmountJson;
-
- refundFee: AmountJson;
-
- /**
- * Upper bound on the refresh cost incurred by
- * applying this refund.
- *
- * Might be lower in practice when two refunds on the same
- * coin are refreshed in the same refresh operation.
- */
- totalRefreshCostBound: AmountJson;
-
- coinPub: string;
-
- rtransactionId: number;
-}
-
-/**
- * Failed refund, either because the merchant did
- * something wrong or it expired.
- */
-export interface WalletRefundFailedItem extends WalletRefundItemCommon {
- type: RefundState.Failed;
-}
-
-export interface WalletRefundPendingItem extends WalletRefundItemCommon {
- type: RefundState.Pending;
-}
-
-export interface WalletRefundAppliedItem extends WalletRefundItemCommon {
- type: RefundState.Applied;
-}
-
-export enum RefundReason {
- /**
- * Normal refund given by the merchant.
- */
- NormalRefund = "normal-refund",
- /**
- * Refund from an aborted payment.
- */
- AbortRefund = "abort-pay-refund",
-}
-
-/**
- * Record stored for every time we successfully submitted
- * a payment to the merchant (both first time and re-play).
- */
-export interface PayEventRecord {
- proposalId: string;
- sessionId: string | undefined;
- isReplay: boolean;
- timestamp: Timestamp;
-}
-
-export interface ExchangeUpdatedEventRecord {
- exchangeBaseUrl: string;
- timestamp: Timestamp;
-}
-
-export interface ReserveUpdatedEventRecord {
- amountReserveBalance: string;
- amountExpected: string;
- reservePub: string;
- timestamp: Timestamp;
- reserveUpdateId: string;
- newHistoryTransactions: ReserveTransaction[];
-}
-
-export interface AllowedAuditorInfo {
- auditorBaseUrl: string;
- auditorPub: string;
-}
-
-export interface AllowedExchangeInfo {
- exchangeBaseUrl: string;
- exchangePub: string;
-}
-
-/**
- * Data extracted from the contract terms that is relevant for payment
- * processing in the wallet.
- */
-export interface WalletContractData {
- products?: Product[];
- summaryI18n: { [lang_tag: string]: string } | undefined;
-
- /**
- * Fulfillment URL, or the empty string if the order has no fulfillment URL.
- *
- * Stored as a non-nullable string as we use this field for IndexedDB indexing.
- */
- fulfillmentUrl: string;
-
- contractTermsHash: string;
- fulfillmentMessage?: string;
- fulfillmentMessageI18n?: InternationalizedString;
- merchantSig: string;
- merchantPub: string;
- merchant: MerchantInfo;
- amount: AmountJson;
- orderId: string;
- merchantBaseUrl: string;
- summary: string;
- autoRefund: Duration | undefined;
- maxWireFee: AmountJson;
- wireFeeAmortization: number;
- payDeadline: Timestamp;
- refundDeadline: Timestamp;
- allowedAuditors: AllowedAuditorInfo[];
- allowedExchanges: AllowedExchangeInfo[];
- timestamp: Timestamp;
- wireMethod: string;
- wireInfoHash: string;
- maxDepositFee: AmountJson;
-}
-
-
-export enum AbortStatus {
- None = "none",
- AbortRefund = "abort-refund",
- AbortFinished = "abort-finished",
-}
-
-/**
- * Record that stores status information about one purchase, starting from when
- * the customer accepts a proposal. Includes refund status if applicable.
- */
-export interface PurchaseRecord {
- /**
- * Proposal ID for this purchase. Uniquely identifies the
- * purchase and the proposal.
- */
- proposalId: string;
-
- /**
- * Private key for the nonce.
- */
- noncePriv: string;
-
- /**
- * Public key for the nonce.
- */
- noncePub: string;
-
- /**
- * Downloaded and parsed proposal data.
- */
- download: ProposalDownload;
-
- /**
- * Deposit permissions, available once the user has accepted the payment.
- *
- * This value is cached and derived from payCoinSelection.
- */
- coinDepositPermissions: CoinDepositPermission[] | undefined;
-
- payCoinSelection: PayCoinSelection;
-
- /**
- * Pending removals from pay coin selection.
- *
- * Used when a the pay coin selection needs to be changed
- * because a coin became known as double-spent or invalid,
- * but a new coin selection can't immediately be done, as
- * there is not enough balance (e.g. when waiting for a refresh).
- */
- pendingRemovedCoinPubs?: string[];
-
- totalPayCost: AmountJson;
-
- /**
- * Timestamp of the first time that sending a payment to the merchant
- * for this purchase was successful.
- */
- timestampFirstSuccessfulPay: Timestamp | undefined;
-
- merchantPaySig: string | undefined;
-
- /**
- * When was the purchase made?
- * Refers to the time that the user accepted.
- */
- timestampAccept: Timestamp;
-
- /**
- * Pending refunds for the purchase. A refund is pending
- * when the merchant reports a transient error from the exchange.
- */
- refunds: { [refundKey: string]: WalletRefundItem };
-
- /**
- * When was the last refund made?
- * Set to 0 if no refund was made on the purchase.
- */
- timestampLastRefundStatus: Timestamp | undefined;
-
- /**
- * Last session signature that we submitted to /pay (if any).
- */
- lastSessionId: string | undefined;
-
- /**
- * Set for the first payment, or on re-plays.
- */
- paymentSubmitPending: boolean;
-
- /**
- * Do we need to query the merchant for the refund status
- * of the payment?
- */
- refundQueryRequested: boolean;
-
- abortStatus: AbortStatus;
-
- payRetryInfo: RetryInfo;
-
- lastPayError: TalerErrorDetails | undefined;
-
- /**
- * Retry information for querying the refund status with the merchant.
- */
- refundStatusRetryInfo: RetryInfo;
-
- /**
- * Last error (or undefined) for querying the refund status with the merchant.
- */
- lastRefundStatusError: TalerErrorDetails | undefined;
-
- /**
- * Continue querying the refund status until this deadline has expired.
- */
- autoRefundDeadline: Timestamp | undefined;
-}
-
-/**
- * Configuration key/value entries to configure
- * the wallet.
- */
-export interface ConfigRecord<T> {
- key: string;
- value: T;
-}
-
-/**
- * FIXME: Eliminate this in favor of DenomSelectionState.
- */
-export interface DenominationSelectionInfo {
- totalCoinValue: AmountJson;
- totalWithdrawCost: AmountJson;
- selectedDenoms: {
- /**
- * How many times do we withdraw this denomination?
- */
- count: number;
- denom: DenominationRecord;
- }[];
-}
-
-/**
- * Selected denominations withn some extra info.
- */
-export interface DenomSelectionState {
- totalCoinValue: AmountJson;
- totalWithdrawCost: AmountJson;
- selectedDenoms: {
- denomPubHash: string;
- count: number;
- }[];
-}
-
-/**
- * Group of withdrawal operations that need to be executed.
- * (Either for a normal withdrawal or from a tip.)
- *
- * The withdrawal group record is only created after we know
- * the coin selection we want to withdraw.
- */
-export interface WithdrawalGroupRecord {
- withdrawalGroupId: string;
-
- /**
- * Secret seed used to derive planchets.
- */
- secretSeed: string;
-
- reservePub: string;
-
- exchangeBaseUrl: string;
-
- /**
- * When was the withdrawal operation started started?
- * Timestamp in milliseconds.
- */
- timestampStart: Timestamp;
-
- /**
- * When was the withdrawal operation completed?
- */
- timestampFinish?: Timestamp;
-
- /**
- * Amount including fees (i.e. the amount subtracted from the
- * reserve to withdraw all coins in this withdrawal session).
- */
- rawWithdrawalAmount: AmountJson;
-
- denomsSel: DenomSelectionState;
-
- /**
- * Retry info, always present even on completed operations so that indexing works.
- */
- retryInfo: RetryInfo;
-
- lastError: TalerErrorDetails | undefined;
-}
-
-export interface BankWithdrawUriRecord {
- /**
- * The withdraw URI we got from the bank.
- */
- talerWithdrawUri: string;
-
- /**
- * Reserve that was created for the withdraw URI.
- */
- reservePub: string;
-}
-
-/**
- * Status of recoup operations that were grouped together.
- *
- * The remaining amount of involved coins should be set to zero
- * in the same transaction that inserts the RecoupGroupRecord.
- */
-export interface RecoupGroupRecord {
- /**
- * Unique identifier for the recoup group record.
- */
- recoupGroupId: string;
-
- timestampStarted: Timestamp;
-
- timestampFinished: Timestamp | undefined;
-
- /**
- * Public keys that identify the coins being recouped
- * as part of this session.
- *
- * (Structured like this to enable multiEntry indexing in IndexedDB.)
- */
- coinPubs: string[];
-
- /**
- * Array of flags to indicate whether the recoup finished on each individual coin.
- */
- recoupFinishedPerCoin: boolean[];
-
- /**
- * We store old amount (i.e. before recoup) of recouped coins here,
- * as the balance of a recouped coin is set to zero when the
- * recoup group is created.
- */
- oldAmountPerCoin: AmountJson[];
-
- /**
- * Public keys of coins that should be scheduled for refreshing
- * after all individual recoups are done.
- */
- scheduleRefreshCoins: string[];
-
- /**
- * Retry info.
- */
- retryInfo: RetryInfo;
-
- /**
- * Last error that occured, if any.
- */
- lastError: TalerErrorDetails | undefined;
-}
-
-export enum ImportPayloadType {
- CoreSchema = "core-schema",
-}
-
-export enum BackupProviderStatus {
- PaymentRequired = "payment-required",
- Ready = "ready",
-}
-
-export interface BackupProviderRecord {
- baseUrl: string;
-
- /**
- * Terms of service of the provider.
- * Might be unavailable in the DB in certain situations
- * (such as loading a recovery document).
- */
- terms?: {
- supportedProtocolVersion: string;
- annualFee: AmountString;
- storageLimitInMegabytes: number;
- };
-
- active: boolean;
-
- /**
- * Hash of the last encrypted backup that we already merged
- * or successfully uploaded ourselves.
- */
- lastBackupHash?: string;
-
- /**
- * Clock of the last backup that we already
- * merged.
- */
- lastBackupClock?: number;
-
- lastBackupTimestamp?: Timestamp;
-
- /**
- * Proposal that we're currently trying to pay for.
- *
- * (Also included in paymentProposalIds.)
- */
- currentPaymentProposalId?: string;
-
- /**
- * Proposals that were used to pay (or attempt to pay) the provider.
- *
- * Stored to display a history of payments to the provider, and
- * to make sure that the wallet isn't overpaying.
- */
- paymentProposalIds: string[];
-
- /**
- * Next scheduled backup.
- */
- nextBackupTimestamp?: Timestamp;
-
- /**
- * Retry info.
- */
- retryInfo: RetryInfo;
-
- /**
- * Last error that occured, if any.
- */
- lastError: TalerErrorDetails | undefined;
-}
-
-/**
- * Group of deposits made by the wallet.
- */
-export interface DepositGroupRecord {
- depositGroupId: string;
-
- merchantPub: string;
- merchantPriv: string;
-
- noncePriv: string;
- noncePub: string;
-
- /**
- * Wire information used by all deposits in this
- * deposit group.
- */
- wire: {
- payto_uri: string;
- salt: string;
- };
-
- /**
- * Verbatim contract terms.
- */
- contractTermsRaw: ContractTerms;
-
- contractTermsHash: string;
-
- payCoinSelection: PayCoinSelection;
-
- totalPayCost: AmountJson;
-
- effectiveDepositAmount: AmountJson;
-
- depositedPerCoin: boolean[];
-
- timestampCreated: Timestamp;
-
- timestampFinished: Timestamp | undefined;
-
- lastError: TalerErrorDetails | undefined;
-
- /**
- * Retry info.
- */
- retryInfo: RetryInfo;
-}
-
-/**
- * Record for a deposits that the wallet observed
- * as a result of double spending, but which is not
- * present in the wallet's own database otherwise.
- */
-export interface GhostDepositGroupRecord {
- /**
- * When multiple deposits for the same contract terms hash
- * have a different timestamp, we choose the earliest one.
- */
- timestamp: Timestamp;
-
- contractTermsHash: string;
-
- deposits: {
- coinPub: string;
- amount: AmountString;
- timestamp: Timestamp;
- depositFee: AmountString;
- merchantPub: string;
- coinSig: string;
- wireHash: string;
- }[];
-}
-
-class ExchangesStore extends Store<"exchanges", ExchangeRecord> {
- constructor() {
- super("exchanges", { keyPath: "baseUrl" });
- }
-}
-
-class CoinsStore extends Store<"coins", CoinRecord> {
- constructor() {
- super("coins", { keyPath: "coinPub" });
- }
-
- exchangeBaseUrlIndex = new Index<
- "coins",
- "exchangeBaseUrl",
- string,
- CoinRecord
- >(this, "exchangeBaseUrl", "exchangeBaseUrl");
-
- denomPubHashIndex = new Index<
- "coins",
- "denomPubHashIndex",
- string,
- CoinRecord
- >(this, "denomPubHashIndex", "denomPubHash");
-
- coinEvHashIndex = new Index<"coins", "coinEvHashIndex", string, CoinRecord>(
- this,
- "coinEvHashIndex",
- "coinEvHash",
- );
-}
-
-class ProposalsStore extends Store<"proposals", ProposalRecord> {
- constructor() {
- super("proposals", { keyPath: "proposalId" });
- }
- urlAndOrderIdIndex = new Index<
- "proposals",
- "urlIndex",
- string,
- ProposalRecord
- >(this, "urlIndex", ["merchantBaseUrl", "orderId"]);
-}
-
-class PurchasesStore extends Store<"purchases", PurchaseRecord> {
- constructor() {
- super("purchases", { keyPath: "proposalId" });
- }
-
- fulfillmentUrlIndex = new Index<
- "purchases",
- "fulfillmentUrlIndex",
- string,
- PurchaseRecord
- >(this, "fulfillmentUrlIndex", "download.contractData.fulfillmentUrl");
-
- orderIdIndex = new Index<"purchases", "orderIdIndex", string, PurchaseRecord>(
- this,
- "orderIdIndex",
- ["download.contractData.merchantBaseUrl", "download.contractData.orderId"],
- );
-}
-
-class DenominationsStore extends Store<"denominations", DenominationRecord> {
- constructor() {
- // cast needed because of bug in type annotations
- super("denominations", {
- keyPath: (["exchangeBaseUrl", "denomPubHash"] as any) as IDBKeyPath,
- });
- }
- exchangeBaseUrlIndex = new Index<
- "denominations",
- "exchangeBaseUrlIndex",
- string,
- DenominationRecord
- >(this, "exchangeBaseUrlIndex", "exchangeBaseUrl");
-}
-
-class CurrenciesStore extends Store<"currencies", CurrencyRecord> {
- constructor() {
- super("currencies", { keyPath: "name" });
- }
-}
-
-class ConfigStore extends Store<"config", ConfigRecord<any>> {
- constructor() {
- super("config", { keyPath: "key" });
- }
-}
-
-class ReservesStore extends Store<"reserves", ReserveRecord> {
- constructor() {
- super("reserves", { keyPath: "reservePub" });
- }
-}
-
-class TipsStore extends Store<"tips", TipRecord> {
- constructor() {
- super("tips", { keyPath: "walletTipId" });
- }
- // Added in version 2
- byMerchantTipIdAndBaseUrl = new Index<
- "tips",
- "tipsByMerchantTipIdAndOriginIndex",
- [string, string],
- TipRecord
- >(this, "tipsByMerchantTipIdAndOriginIndex", [
- "merchantTipId",
- "merchantBaseUrl",
- ]);
-}
-
-class WithdrawalGroupsStore extends Store<
- "withdrawals",
- WithdrawalGroupRecord
-> {
- constructor() {
- super("withdrawals", { keyPath: "withdrawalGroupId" });
- }
- byReservePub = new Index<
- "withdrawals",
- "withdrawalsByReserveIndex",
- string,
- WithdrawalGroupRecord
- >(this, "withdrawalsByReserveIndex", "reservePub");
-}
-
-class PlanchetsStore extends Store<"planchets", PlanchetRecord> {
- constructor() {
- super("planchets", { keyPath: "coinPub" });
- }
- byGroupAndIndex = new Index<
- "planchets",
- "withdrawalGroupAndCoinIdxIndex",
- string,
- PlanchetRecord
- >(this, "withdrawalGroupAndCoinIdxIndex", ["withdrawalGroupId", "coinIdx"]);
- byGroup = new Index<
- "planchets",
- "withdrawalGroupIndex",
- string,
- PlanchetRecord
- >(this, "withdrawalGroupIndex", "withdrawalGroupId");
-
- coinEvHashIndex = new Index<
- "planchets",
- "coinEvHashIndex",
- string,
- PlanchetRecord
- >(this, "coinEvHashIndex", "coinEvHash");
-}
-
-/**
- * This store is effectively a materialized index for
- * reserve records that are for a bank-integrated withdrawal.
- */
-class BankWithdrawUrisStore extends Store<
- "bankWithdrawUris",
- BankWithdrawUriRecord
-> {
- constructor() {
- super("bankWithdrawUris", { keyPath: "talerWithdrawUri" });
- }
-}
-
-/**
- */
-class BackupProvidersStore extends Store<
- "backupProviders",
- BackupProviderRecord
-> {
- constructor() {
- super("backupProviders", { keyPath: "baseUrl" });
- }
-}
-
-class DepositGroupsStore extends Store<"depositGroups", DepositGroupRecord> {
- constructor() {
- super("depositGroups", { keyPath: "depositGroupId" });
- }
-}
-
-/**
- * The stores and indices for the wallet database.
- */
-export const Stores = {
- coins: new CoinsStore(),
- config: new ConfigStore(),
- currencies: new CurrenciesStore(),
- denominations: new DenominationsStore(),
- exchanges: new ExchangesStore(),
- proposals: new ProposalsStore(),
- refreshGroups: new Store<"refreshGroups", RefreshGroupRecord>(
- "refreshGroups",
- {
- keyPath: "refreshGroupId",
- },
- ),
- recoupGroups: new Store<"recoupGroups", RecoupGroupRecord>("recoupGroups", {
- keyPath: "recoupGroupId",
- }),
- reserves: new ReservesStore(),
- purchases: new PurchasesStore(),
- tips: new TipsStore(),
- withdrawalGroups: new WithdrawalGroupsStore(),
- planchets: new PlanchetsStore(),
- bankWithdrawUris: new BankWithdrawUrisStore(),
- backupProviders: new BackupProvidersStore(),
- depositGroups: new DepositGroupsStore(),
- ghostDepositGroups: new Store<"ghostDepositGroups", GhostDepositGroupRecord>(
- "ghostDepositGroups",
- {
- keyPath: "contractTermsHash",
- },
- ),
-};
-
-export class MetaConfigStore extends Store<"metaConfig", ConfigRecord<any>> {
- constructor() {
- super("metaConfig", { keyPath: "key" });
- }
-}
-
-export const MetaStores = {
- metaConfig: new MetaConfigStore(),
-};
diff --git a/packages/taler-wallet-core/src/util/RequestThrottler.ts b/packages/taler-wallet-core/src/util/RequestThrottler.ts
index 0bdd7cab7..b38e948fe 100644
--- a/packages/taler-wallet-core/src/util/RequestThrottler.ts
+++ b/packages/taler-wallet-core/src/util/RequestThrottler.ts
@@ -25,7 +25,7 @@ import {
getTimestampNow,
timestampDifference,
timestampCmp,
-} from "../util/time";
+} from "@gnu-taler/taler-util";
import { URL } from "./url";
import { Logger } from "./logging";
diff --git a/packages/taler-wallet-core/src/util/coinSelection-test.ts b/packages/taler-wallet-core/src/util/coinSelection-test.ts
index 3ac718aaf..962a14835 100644
--- a/packages/taler-wallet-core/src/util/coinSelection-test.ts
+++ b/packages/taler-wallet-core/src/util/coinSelection-test.ts
@@ -17,8 +17,8 @@
/**
* Imports.
*/
+import { AmountJson, Amounts } from "@gnu-taler/taler-util";
import test from "ava";
-import { AmountJson, Amounts } from "..";
import { AvailableCoinInfo, selectPayCoins } from "./coinSelection";
function a(x: string): AmountJson {
diff --git a/packages/taler-wallet-core/src/util/coinSelection.ts b/packages/taler-wallet-core/src/util/coinSelection.ts
index d32ab6f3c..e9cec6144 100644
--- a/packages/taler-wallet-core/src/util/coinSelection.ts
+++ b/packages/taler-wallet-core/src/util/coinSelection.ts
@@ -23,7 +23,7 @@
/**
* Imports.
*/
-import { AmountJson, Amounts } from "./amounts";
+import { AmountJson, Amounts } from "@gnu-taler/taler-util";
import { strcmp } from "./helpers";
/**
diff --git a/packages/taler-wallet-core/src/util/helpers.ts b/packages/taler-wallet-core/src/util/helpers.ts
index f5c204310..36ecc83fe 100644
--- a/packages/taler-wallet-core/src/util/helpers.ts
+++ b/packages/taler-wallet-core/src/util/helpers.ts
@@ -21,8 +21,7 @@
/**
* Imports.
*/
-import { AmountJson } from "./amounts";
-import * as Amounts from "./amounts";
+import { AmountJson, Amounts } from "@gnu-taler/taler-util";
import { URL } from "./url";
/**
diff --git a/packages/taler-wallet-core/src/util/http.ts b/packages/taler-wallet-core/src/util/http.ts
index 73f08d407..ee6ff80a2 100644
--- a/packages/taler-wallet-core/src/util/http.ts
+++ b/packages/taler-wallet-core/src/util/http.ts
@@ -24,19 +24,18 @@
/**
* Imports
*/
-import { Codec } from "./codec";
import { OperationFailedError, makeErrorDetails } from "../operations/errors";
-import { TalerErrorCode } from "../TalerErrorCode";
import { Logger } from "./logging";
import {
Duration,
Timestamp,
getTimestampNow,
timestampAddDuration,
- timestampMin,
timestampMax,
-} from "./time";
-import { TalerErrorDetails } from "..";
+ TalerErrorDetails,
+ Codec,
+} from "@gnu-taler/taler-util";
+import { TalerErrorCode } from "@gnu-taler/taler-util";
const logger = new Logger("http.ts");
diff --git a/packages/taler-wallet-core/src/util/retries.ts b/packages/taler-wallet-core/src/util/retries.ts
index 8be78cfc8..54bb0b2ee 100644
--- a/packages/taler-wallet-core/src/util/retries.ts
+++ b/packages/taler-wallet-core/src/util/retries.ts
@@ -21,7 +21,7 @@
/**
* Imports.
*/
-import { Timestamp, Duration, getTimestampNow } from "./time";
+import { Timestamp, Duration, getTimestampNow } from "@gnu-taler/taler-util";
export interface RetryInfo {
firstTry: Timestamp;
diff --git a/packages/taler-wallet-core/src/util/testvectors.ts b/packages/taler-wallet-core/src/util/testvectors.ts
deleted file mode 100644
index 57ac6e992..000000000
--- a/packages/taler-wallet-core/src/util/testvectors.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2020 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * Imports
- */
-import {
- setupRefreshPlanchet,
- encodeCrock,
- getRandomBytes,
-} from "../crypto/talerCrypto";
-
-export function printTestVectors() {
- const secretSeed = getRandomBytes(64);
- const coinIndex = Math.ceil(Math.random() * 100);
- const p = setupRefreshPlanchet(secretSeed, coinIndex);
- console.log("setupRefreshPlanchet");
- console.log(` (in) secret seed: ${encodeCrock(secretSeed)}`);
- console.log(` (in) coin index: ${coinIndex}`);
- console.log(` (out) blinding secret: ${encodeCrock(p.bks)}`);
- console.log(` (out) coin priv: ${encodeCrock(p.coinPriv)}`);
- console.log(` (out) coin pub: ${encodeCrock(p.coinPub)}`);
-}
diff --git a/packages/taler-wallet-core/src/util/timer.ts b/packages/taler-wallet-core/src/util/timer.ts
index 75fb5c9c0..9133bd572 100644
--- a/packages/taler-wallet-core/src/util/timer.ts
+++ b/packages/taler-wallet-core/src/util/timer.ts
@@ -24,7 +24,7 @@
/**
* Imports.
*/
-import { Duration } from "./time";
+import { Duration } from "@gnu-taler/taler-util";
import { Logger } from "./logging";
const logger = new Logger("timer.ts");
diff --git a/packages/taler-wallet-core/src/util/wire.ts b/packages/taler-wallet-core/src/util/wire.ts
deleted file mode 100644
index 95e324f3c..000000000
--- a/packages/taler-wallet-core/src/util/wire.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- This file is part of TALER
- (C) 2017 GNUnet e.V.
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * Display and manipulate wire information.
- *
- * Right now, all types are hard-coded. In the future, there might be plugins / configurable
- * methods or support for the "payto://" URI scheme.
- */
-
-/**
- * Imports.
- */
-import * as i18n from "../i18n";
-
-/**
- * Short summary of the wire information.
- *
- * Might abbreviate and return the same summary for different
- * wire details.
- */
-export function summarizeWire(w: any): string {
- if (!w.type) {
- return i18n.str`Invalid Wire`;
- }
- switch (w.type.toLowerCase()) {
- case "test":
- if (!w.account_number && w.account_number !== 0) {
- return i18n.str`Invalid Test Wire Detail`;
- }
- if (!w.bank_uri) {
- return i18n.str`Invalid Test Wire Detail`;
- }
- return i18n.str`Test Wire Acct #${w.account_number} on ${w.bank_uri}`;
- default:
- return i18n.str`Unknown Wire Detail`;
- }
-}
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts
index 26f10600c..3e34efe94 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -22,13 +22,12 @@
/**
* Imports.
*/
-import { codecForAny, TalerErrorCode } from ".";
+import { BackupRecovery, codecForAny, TalerErrorCode } from "@gnu-taler/taler-util";
import { CryptoWorkerFactory } from "./crypto/workers/cryptoApi";
import {
addBackupProvider,
AddBackupProviderRequest,
BackupInfo,
- BackupRecovery,
codecForAddBackupProviderRequest,
exportBackupEncrypted,
getBackupInfo,
@@ -106,19 +105,19 @@ import {
ReserveRecord,
ReserveRecordStatus,
Stores,
-} from "./types/dbTypes";
-import { NotificationType, WalletNotification } from "./types/notifications";
+} from "./db.js";
+import { NotificationType, WalletNotification } from "@gnu-taler/taler-util";
import {
PendingOperationInfo,
PendingOperationsResponse,
PendingOperationType,
-} from "./types/pendingTypes";
-import { CoinDumpJson } from "./types/talerTypes";
+} from "./pending-types.js";
+import { CoinDumpJson } from "@gnu-taler/taler-util";
import {
codecForTransactionsRequest,
TransactionsRequest,
TransactionsResponse,
-} from "./types/transactionsTypes";
+} from "@gnu-taler/taler-util";
import {
AcceptManualWithdrawalResult,
AcceptWithdrawalResponse,
@@ -166,15 +165,15 @@ import {
TrackDepositGroupResponse,
WithdrawTestBalanceRequest,
WithdrawUriInfoResponse,
-} from "./types/walletTypes";
-import { AmountJson, Amounts } from "./util/amounts";
+} from "@gnu-taler/taler-util";
+import { AmountJson, Amounts } from "@gnu-taler/taler-util";
import { assertUnreachable } from "./util/assertUnreachable";
import { AsyncOpMemoSingle } from "./util/asyncMemo";
import { HttpRequestLibrary } from "./util/http";
import { Logger } from "./util/logging";
import { AsyncCondition } from "./util/promiseUtils";
import { Database } from "./util/query";
-import { Duration, durationMin } from "./util/time";
+import { Duration, durationMin } from "@gnu-taler/taler-util";
import { TimerGroup } from "./util/timer";
const builtinCurrencies: CurrencyRecord[] = [
diff --git a/packages/taler-wallet-core/tsconfig.json b/packages/taler-wallet-core/tsconfig.json
index e3bfd31a7..c8f5c23b2 100644
--- a/packages/taler-wallet-core/tsconfig.json
+++ b/packages/taler-wallet-core/tsconfig.json
@@ -26,7 +26,10 @@
"references": [
{
"path": "../idb-bridge/"
+ },
+ {
+ "path": "../taler-util/"
}
],
- "include": ["src/**/*"],
+ "include": ["src/**/*"]
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index d9f3e62e2..7a8b9804c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -35,6 +35,24 @@ importers:
specifiers:
'@types/node': ^14.14.22
typescript: ^4.1.3
+ packages/taler-util:
+ dependencies:
+ tslib: 2.1.0
+ devDependencies:
+ '@types/node': 14.14.34
+ ava: 3.15.0
+ esbuild: 0.9.2
+ prettier: 2.2.1
+ rimraf: 3.0.2
+ typescript: 4.2.3
+ specifiers:
+ '@types/node': ^14.14.22
+ ava: ^3.15.0
+ esbuild: ^0.9.2
+ prettier: ^2.2.1
+ rimraf: ^3.0.2
+ tslib: ^2.1.0
+ typescript: ^4.2.3
packages/taler-wallet-android:
dependencies:
'@gnu-taler/taler-wallet-core': link:../taler-wallet-core
@@ -67,6 +85,7 @@ importers:
typescript: ^4.1.3
packages/taler-wallet-cli:
dependencies:
+ '@gnu-taler/taler-util': link:../taler-util
'@gnu-taler/taler-wallet-core': link:../taler-wallet-core
'@types/minimatch': 3.0.3
axios: 0.21.1
@@ -88,6 +107,7 @@ importers:
typedoc: 0.20.16_typescript@4.1.3
typescript: 4.1.3
specifiers:
+ '@gnu-taler/taler-util': workspace:*
'@gnu-taler/taler-wallet-core': workspace:*
'@rollup/plugin-commonjs': ^17.0.0
'@rollup/plugin-json': ^4.1.0
@@ -110,6 +130,7 @@ importers:
packages/taler-wallet-core:
dependencies:
'@gnu-taler/idb-bridge': link:../idb-bridge
+ '@gnu-taler/taler-util': link:../taler-util
'@types/node': 14.14.22
axios: 0.21.1
big-integer: 1.6.48
@@ -144,6 +165,7 @@ importers:
'@ava/typescript': ^1.1.1
'@gnu-taler/idb-bridge': workspace:*
'@gnu-taler/pogen': workspace:*
+ '@gnu-taler/taler-util': workspace:*
'@microsoft/api-extractor': ^7.13.0
'@types/node': ^14.14.22
'@typescript-eslint/eslint-plugin': ^4.14.0
@@ -243,6 +265,12 @@ packages:
dev: true
resolution:
integrity: sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==
+ /@babel/code-frame/7.12.13:
+ dependencies:
+ '@babel/highlight': 7.13.10
+ dev: true
+ resolution:
+ integrity: sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==
/@babel/core/7.12.10:
dependencies:
'@babel/code-frame': 7.12.11
@@ -360,6 +388,14 @@ packages:
dev: true
resolution:
integrity: sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==
+ /@babel/highlight/7.13.10:
+ dependencies:
+ '@babel/helper-validator-identifier': 7.12.11
+ chalk: 2.4.2
+ js-tokens: 4.0.0
+ dev: true
+ resolution:
+ integrity: sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==
/@babel/parser/7.12.11:
dev: true
engines:
@@ -484,7 +520,7 @@ packages:
/@nodelib/fs.scandir/2.1.4:
dependencies:
'@nodelib/fs.stat': 2.0.4
- run-parallel: 1.1.10
+ run-parallel: 1.2.0
dev: true
engines:
node: '>= 8'
@@ -499,7 +535,7 @@ packages:
/@nodelib/fs.walk/1.2.6:
dependencies:
'@nodelib/fs.scandir': 2.1.4
- fastq: 1.10.0
+ fastq: 1.11.0
dev: true
engines:
node: '>= 8'
@@ -719,10 +755,10 @@ packages:
/@types/node/14.14.22:
resolution:
integrity: sha512-g+f/qj/cNcqKkc3tFqlXOYjrmZA+jNBiDzbP3kH+B+otKFqAdPgVTGP1IeKRdMml/aE69as5S4FqtxAbl+LaMw==
- /@types/node/14.14.31:
+ /@types/node/14.14.34:
dev: true
resolution:
- integrity: sha512-vFHy/ezP5qI0rFgJ7aQnjDXwAMrG0KqqIH7tQG5PPv3BWBayOPIQNBjVc/P6hhdZfMx51REc6tfDNXHUio893g==
+ integrity: sha512-dBPaxocOK6UVyvhbnpFIj2W+S+1cBTkHQbFQfeeJhoKFbzYcVUGHvddeWPSucKATb3F0+pgDq0i6ghEaZjsugA==
/@types/normalize-package-data/2.4.0:
dev: true
resolution:
@@ -746,7 +782,7 @@ packages:
integrity: sha512-aj/L7RIMsRlWML3YB6KZiXB3fV2t41+5RBGYF8z+tAKU43Px8C3cYUZsDvf1/+Bm4FK21QWBrDutu8ZJ/70qOw==
/@types/resolve/1.17.1:
dependencies:
- '@types/node': 14.14.31
+ '@types/node': 14.14.34
dev: true
resolution:
integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==
@@ -928,12 +964,12 @@ packages:
acorn: ^6.0.0 || ^7.0.0 || ^8.0.0
resolution:
integrity: sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==
- /acorn-walk/8.0.1:
+ /acorn-walk/8.0.2:
dev: true
engines:
node: '>=0.4.0'
resolution:
- integrity: sha512-zn/7dYtoTVkG4EoMU55QlQU4F+m+T7Kren6Vj3C2DapWPnakG/DL9Ns5aPAPW5Ixd3uxXrV/BoMKKVFIazPcdg==
+ integrity: sha512-+bpA9MJsHdZ4bgfDcpk0ozQyhhVct7rzOmO0s1IIr0AGGgKBljss8n2zp11rRP2wid5VGeh04CgeKzgat5/25A==
/acorn/7.4.1:
dev: true
engines:
@@ -941,13 +977,13 @@ packages:
hasBin: true
resolution:
integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==
- /acorn/8.0.4:
+ /acorn/8.1.0:
dev: true
engines:
node: '>=0.4.0'
hasBin: true
resolution:
- integrity: sha512-XNP0PqF1XD19ZlLKvB7cMmnZswW4C/03pRHgirB30uSJTaS3A3V1/P4sS3HPvFmjoriPCJQs+JDSbm4bL1TxGQ==
+ integrity: sha512-LWCF/Wn0nfHOmJ9rzQApGnxnvgfROzGilS8936rqN/lfcYkY9MYZzdMqN+2NJ4SlTc+m5HiSa+kNfDtI64dwUA==
/aggregate-error/3.1.0:
dependencies:
clean-stack: 2.2.0
@@ -1156,8 +1192,8 @@ packages:
/ava/3.15.0:
dependencies:
'@concordance/react': 2.0.0
- acorn: 8.0.4
- acorn-walk: 8.0.1
+ acorn: 8.1.0
+ acorn-walk: 8.0.2
ansi-styles: 5.1.0
arrgv: 1.0.2
arrify: 2.0.1
@@ -1172,7 +1208,7 @@ packages:
cli-truncate: 2.1.0
code-excerpt: 3.0.0
common-path-prefix: 3.0.0
- concordance: 5.0.1
+ concordance: 5.0.4
convert-source-map: 1.7.0
currently-unhandled: 0.4.1
debug: 4.3.1
@@ -1187,7 +1223,7 @@ packages:
is-error: 2.2.2
is-plain-object: 5.0.0
is-promise: 4.0.0
- lodash: 4.17.20
+ lodash: 4.17.21
matcher: 3.0.0
md5-hex: 3.0.1
mem: 8.0.0
@@ -1208,7 +1244,7 @@ packages:
supertap: 2.0.0
temp-dir: 2.0.0
trim-off-newlines: 1.0.1
- update-notifier: 5.0.1
+ update-notifier: 5.1.0
write-file-atomic: 3.0.3
yargs: 16.2.0
dev: true
@@ -1252,14 +1288,14 @@ packages:
node: '>=8'
resolution:
integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==
- /bl/4.0.3:
+ /bl/4.1.0:
dependencies:
buffer: 5.7.1
inherits: 2.0.4
readable-stream: 3.6.0
dev: true
resolution:
- integrity: sha512-fs4G6/Hu4/EE+F75J8DuN/0IpQqNjAdC7aEQv7Qt8MHGUH7Ckv2MwTEEeN9QehD0pfIDkMI1bkHYkKy7xHyKIg==
+ integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==
/blueimp-md5/2.18.0:
dev: true
resolution:
@@ -1268,21 +1304,21 @@ packages:
dev: true
resolution:
integrity: sha1-aN/1++YMUes3cl6p4+0xDcwed24=
- /boxen/4.2.0:
+ /boxen/5.0.0:
dependencies:
ansi-align: 3.0.0
- camelcase: 5.3.1
- chalk: 3.0.0
+ camelcase: 6.2.0
+ chalk: 4.1.0
cli-boxes: 2.2.1
- string-width: 4.2.0
- term-size: 2.2.1
- type-fest: 0.8.1
+ string-width: 4.2.2
+ type-fest: 0.20.2
widest-line: 3.1.0
+ wrap-ansi: 7.0.0
dev: true
engines:
- node: '>=8'
+ node: '>=10'
resolution:
- integrity: sha512-eB4uT9RGzg2odpER62bBwSLvUeGC+WbRjjyyFhGsKnc8wp/m0+hQsMUvUe3H2V0D5vw0nBdO1hCJoZo5mKeuIQ==
+ integrity: sha512-5bvsqw+hhgUi3oYGK0Vf4WpIkyemp60WBInn7+WNfoISzAqk/HX4L7WNROq38E6UR/y3YADpv6pEm4BfkeEAdA==
/brace-expansion/1.1.11:
dependencies:
balanced-match: 1.0.0
@@ -1357,6 +1393,12 @@ packages:
node: '>=6'
resolution:
integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
+ /camelcase/6.2.0:
+ dev: true
+ engines:
+ node: '>=10'
+ resolution:
+ integrity: sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==
/cancellationtoken/2.2.0:
dev: false
resolution:
@@ -1381,15 +1423,6 @@ packages:
node: '>=4'
resolution:
integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
- /chalk/3.0.0:
- dependencies:
- ansi-styles: 4.3.0
- supports-color: 7.2.0
- dev: true
- engines:
- node: '>=8'
- resolution:
- integrity: sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==
/chalk/4.1.0:
dependencies:
ansi-styles: 4.3.0
@@ -1428,7 +1461,7 @@ packages:
dependencies:
anymatch: 3.1.1
braces: 3.0.2
- glob-parent: 5.1.1
+ glob-parent: 5.1.2
is-binary-path: 2.1.0
is-glob: 4.0.1
normalize-path: 3.0.0
@@ -1437,7 +1470,7 @@ packages:
engines:
node: '>= 8.10.0'
optionalDependencies:
- fsevents: 2.3.1
+ fsevents: 2.3.2
resolution:
integrity: sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==
/chunkd/2.0.1:
@@ -1487,7 +1520,7 @@ packages:
/cli-truncate/2.1.0:
dependencies:
slice-ansi: 3.0.0
- string-width: 4.2.0
+ string-width: 4.2.2
dev: true
engines:
node: '>=8'
@@ -1503,7 +1536,7 @@ packages:
integrity: sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==
/cliui/7.0.4:
dependencies:
- string-width: 4.2.0
+ string-width: 4.2.2
strip-ansi: 6.0.0
wrap-ansi: 7.0.0
dev: true
@@ -1578,13 +1611,13 @@ packages:
/concat-map/0.0.1:
resolution:
integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
- /concordance/5.0.1:
+ /concordance/5.0.4:
dependencies:
date-time: 3.1.0
esutils: 2.0.3
fast-diff: 1.2.0
js-string-escape: 1.0.1
- lodash: 4.17.20
+ lodash: 4.17.21
md5-hex: 3.0.1
semver: 7.3.4
well-known-symbols: 2.0.0
@@ -1592,11 +1625,11 @@ packages:
engines:
node: '>=10.18.0 <11 || >=12.14.0 <13 || >=14'
resolution:
- integrity: sha512-TbNtInKVElgEBnJ1v2Xg+MFX2lvFLbmlv3EuSC5wTfCwpB8kC3w3mffF6cKuUhkn475Ym1f1I4qmuXzx2+uXpw==
+ integrity: sha512-OAcsnTEYu1ARJqWVGwf4zh4JDfHZEaSNlNccFmt8YjB2l/n19/PF2viLINHc57vO4FKIAFl2FWASIGZZWZ2Kxw==
/configstore/5.0.1:
dependencies:
dot-prop: 5.3.0
- graceful-fs: 4.2.4
+ graceful-fs: 4.2.6
make-dir: 3.1.0
unique-string: 2.0.0
write-file-atomic: 3.0.3
@@ -1773,10 +1806,10 @@ packages:
/del/6.0.0:
dependencies:
globby: 11.0.2
- graceful-fs: 4.2.4
+ graceful-fs: 4.2.6
is-glob: 4.0.1
is-path-cwd: 2.2.0
- is-path-inside: 3.0.2
+ is-path-inside: 3.0.3
p-map: 4.0.0
rimraf: 3.0.2
slash: 3.0.0
@@ -2003,6 +2036,12 @@ packages:
dev: true
resolution:
integrity: sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==
+ /esbuild/0.9.2:
+ dev: true
+ hasBin: true
+ requiresBuild: true
+ resolution:
+ integrity: sha512-xE3oOILjnmN8PSjkG3lT9NBbd1DbxNqolJ5qNyrLhDWsFef3yTp/KTQz1C/x7BYFKbtrr9foYtKA6KA1zuNAUQ==
/escalade/3.1.1:
dev: true
engines:
@@ -2328,7 +2367,7 @@ packages:
dependencies:
'@nodelib/fs.stat': 2.0.4
'@nodelib/fs.walk': 1.2.6
- glob-parent: 5.1.1
+ glob-parent: 5.1.2
merge2: 1.4.1
micromatch: 4.0.2
picomatch: 2.2.2
@@ -2345,12 +2384,12 @@ packages:
dev: true
resolution:
integrity: sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=
- /fastq/1.10.0:
+ /fastq/1.11.0:
dependencies:
reusify: 1.0.4
dev: true
resolution:
- integrity: sha512-NL2Qc5L3iQEsyYzweq7qfgy5OtXCmGzGvhElGEd/SoFWEMOEczNh5s5ocaF01HDetxz+p8ecjNPA6cZxxIHmzA==
+ integrity: sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==
/fflate/0.6.0:
dev: false
resolution:
@@ -2486,7 +2525,7 @@ packages:
- darwin
resolution:
integrity: sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==
- /fsevents/2.3.1:
+ /fsevents/2.3.2:
dev: true
engines:
node: ^8.16.0 || ^10.6.0 || >=11.0.0
@@ -2494,7 +2533,7 @@ packages:
os:
- darwin
resolution:
- integrity: sha512-YR47Eg4hChJGAB1O3yEAOkGO+rlzutoICGqGo9EZ4lKWokzZRSyIW1QmTzqjtw8MJdj9srP869CuWw/hyzSiBw==
+ integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
/function-bind/1.1.1:
dev: true
resolution:
@@ -2574,6 +2613,14 @@ packages:
node: '>= 6'
resolution:
integrity: sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==
+ /glob-parent/5.1.2:
+ dependencies:
+ is-glob: 4.0.1
+ dev: true
+ engines:
+ node: '>= 6'
+ resolution:
+ integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
/glob/7.1.6:
dependencies:
fs.realpath: 1.0.0
@@ -2585,14 +2632,14 @@ packages:
dev: true
resolution:
integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
- /global-dirs/2.1.0:
+ /global-dirs/3.0.0:
dependencies:
- ini: 1.3.7
+ ini: 2.0.0
dev: true
engines:
- node: '>=8'
+ node: '>=10'
resolution:
- integrity: sha512-MG6kdOUh/xBnyo9cJFeIKkLEc1AyFq42QTU4XiX51i2NEdxLxLWXIjEjmqKeSuKR7pAZjTqUVoT2b2huxVLgYQ==
+ integrity: sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==
/globals/11.12.0:
dev: true
engines:
@@ -2642,6 +2689,10 @@ packages:
dev: true
resolution:
integrity: sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==
+ /graceful-fs/4.2.6:
+ dev: true
+ resolution:
+ integrity: sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==
/handlebars/4.7.6:
dependencies:
minimist: 1.2.5
@@ -2814,14 +2865,16 @@ packages:
dev: true
resolution:
integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
- /ini/1.3.7:
- dev: true
- resolution:
- integrity: sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ==
/ini/1.3.8:
dev: true
resolution:
integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==
+ /ini/2.0.0:
+ dev: true
+ engines:
+ node: '>=10'
+ resolution:
+ integrity: sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==
/internal-slot/1.0.2:
dependencies:
es-abstract: 1.17.7
@@ -2919,15 +2972,15 @@ packages:
node: '>=0.10.0'
resolution:
integrity: sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==
- /is-installed-globally/0.3.2:
+ /is-installed-globally/0.4.0:
dependencies:
- global-dirs: 2.1.0
- is-path-inside: 3.0.2
+ global-dirs: 3.0.0
+ is-path-inside: 3.0.3
dev: true
engines:
- node: '>=8'
+ node: '>=10'
resolution:
- integrity: sha512-wZ8x1js7Ia0kecP/CHM/3ABkAmujX7WPvQk6uu3Fly/Mk44pySulQpnHG46OMjHGXApINnV4QhY3SWnECO2z5g==
+ integrity: sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==
/is-interactive/1.0.0:
dev: true
engines:
@@ -2974,12 +3027,12 @@ packages:
node: '>=6'
resolution:
integrity: sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==
- /is-path-inside/3.0.2:
+ /is-path-inside/3.0.3:
dev: true
engines:
node: '>=8'
resolution:
- integrity: sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg==
+ integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==
/is-plain-object/5.0.0:
dev: true
engines:
@@ -3274,7 +3327,7 @@ packages:
integrity: sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=
/load-json-file/5.3.0:
dependencies:
- graceful-fs: 4.2.4
+ graceful-fs: 4.2.6
parse-json: 4.0.0
pify: 4.0.1
strip-bom: 3.0.0
@@ -3330,6 +3383,10 @@ packages:
dev: true
resolution:
integrity: sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
+ /lodash/4.17.21:
+ dev: true
+ resolution:
+ integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
/log-symbols/4.0.0:
dependencies:
chalk: 4.1.0
@@ -3532,7 +3589,7 @@ packages:
/normalize-package-data/2.5.0:
dependencies:
hosted-git-info: 2.8.8
- resolve: 1.19.0
+ resolve: 1.20.0
semver: 5.7.1
validate-npm-package-license: 3.0.4
dev: true
@@ -3695,7 +3752,7 @@ packages:
integrity: sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==
/ora/5.3.0:
dependencies:
- bl: 4.0.3
+ bl: 4.1.0
chalk: 4.1.0
cli-cursor: 3.1.0
cli-spinners: 2.5.0
@@ -3859,7 +3916,7 @@ packages:
integrity: sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=
/parse-json/5.2.0:
dependencies:
- '@babel/code-frame': 7.12.11
+ '@babel/code-frame': 7.12.13
error-ex: 1.3.2
json-parse-even-better-errors: 2.3.1
lines-and-columns: 1.1.6
@@ -4061,6 +4118,10 @@ packages:
node: '>=8'
resolution:
integrity: sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==
+ /queue-microtask/1.2.2:
+ dev: true
+ resolution:
+ integrity: sha512-dB15eXv3p2jDlbOiNLyMabYg1/sXvppd8DP2J3EOCQ0AkuSXCW2tP7mnVouVLJKgUMY6yP0kcQDVpLCN13h4Xg==
/raf/3.4.1:
dependencies:
performance-now: 2.1.0
@@ -4359,10 +4420,12 @@ packages:
dev: true
resolution:
integrity: sha1-gbIw6i/MYGbInjRy3nlChdmwPZE=
- /run-parallel/1.1.10:
+ /run-parallel/1.2.0:
+ dependencies:
+ queue-microtask: 1.2.2
dev: true
resolution:
- integrity: sha512-zb/1OuZ6flOlH6tQyMPUrE3x3Ulxjlo9WIVXR4yVYi4H9UXQaeIsPbLn2R3O3vQCnDKkAl2qHiuocKKX4Tz/Sw==
+ integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==
/safe-buffer/5.1.2:
dev: true
resolution:
@@ -4619,6 +4682,16 @@ packages:
node: '>=8'
resolution:
integrity: sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==
+ /string-width/4.2.2:
+ dependencies:
+ emoji-regex: 8.0.0
+ is-fullwidth-code-point: 3.0.0
+ strip-ansi: 6.0.0
+ dev: true
+ engines:
+ node: '>=8'
+ resolution:
+ integrity: sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==
/string.prototype.matchall/4.0.3:
dependencies:
call-bind: 1.0.2
@@ -4753,12 +4826,6 @@ packages:
node: '>=8'
resolution:
integrity: sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg==
- /term-size/2.2.1:
- dev: true
- engines:
- node: '>=8'
- resolution:
- integrity: sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==
/terser/5.4.0:
dependencies:
commander: 2.20.3
@@ -4862,6 +4929,12 @@ packages:
node: '>=10'
resolution:
integrity: sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==
+ /type-fest/0.20.2:
+ dev: true
+ engines:
+ node: '>=10'
+ resolution:
+ integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==
/type-fest/0.3.1:
dev: true
engines:
@@ -4921,6 +4994,13 @@ packages:
hasBin: true
resolution:
integrity: sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg==
+ /typescript/4.2.3:
+ dev: true
+ engines:
+ node: '>=4.2.0'
+ hasBin: true
+ resolution:
+ integrity: sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==
/uglify-js/3.12.5:
dev: true
engines:
@@ -4953,15 +5033,15 @@ packages:
node: '>= 10.0.0'
resolution:
integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==
- /update-notifier/5.0.1:
+ /update-notifier/5.1.0:
dependencies:
- boxen: 4.2.0
+ boxen: 5.0.0
chalk: 4.1.0
configstore: 5.0.1
has-yarn: 2.1.0
import-lazy: 2.1.0
is-ci: 2.0.0
- is-installed-globally: 0.3.2
+ is-installed-globally: 0.4.0
is-npm: 5.0.0
is-yarn-global: 0.3.0
latest-version: 5.1.0
@@ -4973,7 +5053,7 @@ packages:
engines:
node: '>=10'
resolution:
- integrity: sha512-BuVpRdlwxeIOvmc32AGYvO1KVdPlsmqSh8KDDBxS6kDE5VR7R8OMP1d8MdhaVBvxl4H3551k9akXr0Y1iIB2Wg==
+ integrity: sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==
/uri-js/4.4.1:
dependencies:
punycode: 2.1.1
@@ -5045,7 +5125,7 @@ packages:
integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==
/widest-line/3.1.0:
dependencies:
- string-width: 4.2.0
+ string-width: 4.2.2
dev: true
engines:
node: '>=8'
@@ -5074,7 +5154,7 @@ packages:
/wrap-ansi/7.0.0:
dependencies:
ansi-styles: 4.3.0
- string-width: 4.2.0
+ string-width: 4.2.2
strip-ansi: 6.0.0
dev: true
engines:
@@ -5127,12 +5207,12 @@ packages:
node: '>=6'
resolution:
integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==
- /yargs-parser/20.2.4:
+ /yargs-parser/20.2.7:
dev: true
engines:
node: '>=10'
resolution:
- integrity: sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==
+ integrity: sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==
/yargs/15.4.1:
dependencies:
cliui: 6.0.0
@@ -5157,9 +5237,9 @@ packages:
escalade: 3.1.1
get-caller-file: 2.0.5
require-directory: 2.1.1
- string-width: 4.2.0
+ string-width: 4.2.2
y18n: 5.0.5
- yargs-parser: 20.2.4
+ yargs-parser: 20.2.7
dev: true
engines:
node: '>=10'