aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-util/src/notifications.ts2
-rw-r--r--packages/taler-wallet-cli/src/index.ts13
-rw-r--r--packages/taler-wallet-core/src/db.ts41
-rw-r--r--packages/taler-wallet-core/src/operations/reserves.ts1
-rw-r--r--packages/taler-wallet-core/src/wallet.ts11
5 files changed, 54 insertions, 14 deletions
diff --git a/packages/taler-util/src/notifications.ts b/packages/taler-util/src/notifications.ts
index edfb377b9..ade538d04 100644
--- a/packages/taler-util/src/notifications.ts
+++ b/packages/taler-util/src/notifications.ts
@@ -22,7 +22,7 @@
/**
* Imports.
*/
-import { TalerErrorDetails } from "./walletTypes";
+import { TalerErrorDetails } from "./walletTypes.js";
export enum NotificationType {
CoinWithdrawn = "coin-withdrawn",
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts
index 8b203a4cd..8a9e28d32 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -604,6 +604,19 @@ advancedCli
});
});
+const currenciesCli = walletCli.subcommand("currencies", "currencies", {
+ help: "Manage currencies.",
+});
+
+currenciesCli
+ .subcommand("show", "show", { help: "Show currencies."})
+ .action(async (args) => {
+ await withWallet(args, async (wallet) => {
+ const currencies = await wallet.getCurrencies();
+ console.log(JSON.stringify(currencies, undefined, 2));
+ });
+ })
+
const reservesCli = advancedCli.subcommand("reserves", "reserves", {
help: "Manage reserves.",
});
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index 7a7c36561..2c009b4c5 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -357,20 +357,41 @@ export interface AuditorRecord {
expirationStamp: number;
}
-/**
- * Exchange for currencies as stored in the wallet's currency
- * information database.
- */
-export interface ExchangeForCurrencyRecord {
+
+export interface AuditorTrustInfo {
/**
- * FIXME: unused?
+ * Base URL of the auditor.
*/
- exchangeMasterPub: string;
+ auditorBaseUrl: string;
/**
- * Base URL of the exchange.
+ * Public key of the auditor.
+ */
+ auditorPub: string;
+
+ /**
+ * UIDs for the operation of adding this auditor
+ * as a trusted auditor.
+ */
+ uids: string[];
+}
+
+export interface ExchangeTrustInfo {
+ /**
+ * Canonicalized exchange base URL.
*/
exchangeBaseUrl: string;
+
+ /**
+ * Master public key of the exchange.
+ */
+ exchangeMasterPub: string;
+
+ /**
+ * UIDs for the operation of adding this exchange
+ * as trusted.
+ */
+ uids: string[];
}
/**
@@ -390,12 +411,12 @@ export interface CurrencyRecord {
/**
* Auditors that the wallet trusts for this currency.
*/
- auditors: AuditorRecord[];
+ auditors: AuditorTrustInfo[];
/**
* Exchanges that the wallet trusts for this currency.
*/
- exchanges: ExchangeForCurrencyRecord[];
+ exchanges: ExchangeTrustInfo[];
}
/**
diff --git a/packages/taler-wallet-core/src/operations/reserves.ts b/packages/taler-wallet-core/src/operations/reserves.ts
index 855ee82ee..9a479427e 100644
--- a/packages/taler-wallet-core/src/operations/reserves.ts
+++ b/packages/taler-wallet-core/src/operations/reserves.ts
@@ -175,6 +175,7 @@ export async function createReserve(
currencyRecord.exchanges.push({
exchangeBaseUrl: req.exchange,
exchangeMasterPub: exchangeDetails.masterPublicKey,
+ uids: [encodeCrock(getRandomBytes(32))],
});
}
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts
index bf277659e..f69d26e84 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -22,7 +22,11 @@
/**
* Imports.
*/
-import { BackupRecovery, codecForAny, TalerErrorCode } from "@gnu-taler/taler-util";
+import {
+ BackupRecovery,
+ codecForAny,
+ TalerErrorCode,
+} from "@gnu-taler/taler-util";
import { CryptoWorkerFactory } from "./crypto/workers/cryptoApi";
import {
addBackupProvider,
@@ -181,8 +185,8 @@ const builtinCurrencies: CurrencyRecord[] = [
auditors: [
{
auditorPub: "BW9DC48PHQY4NH011SHHX36DZZ3Q22Y6X7FZ1VD1CMZ2PTFZ6PN0",
- baseUrl: "https://auditor.demo.taler.net/",
- expirationStamp: new Date(2027, 1).getTime(),
+ auditorBaseUrl: "https://auditor.demo.taler.net/",
+ uids: ["5P25XF8TVQP9AW6VYGY2KV47WT5Y3ZXFSJAA570GJPX5SVJXKBVG"],
},
],
exchanges: [],
@@ -672,6 +676,7 @@ export class Wallet {
return await this.db.iter(Stores.exchanges).toArray();
}
+
async getExchanges(): Promise<ExchangesListRespose> {
const exchanges: (ExchangeListItem | undefined)[] = await this.db
.iter(Stores.exchanges)