summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/db.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-05-20 13:14:47 +0200
committerFlorian Dold <florian@dold.me>2021-05-20 13:15:11 +0200
commit851ac5602cea0beb7b3e29dc9a95c2093a0ed906 (patch)
tree294e00a40e752c52706b65c86807028ffc450938 /packages/taler-wallet-core/src/db.ts
parent0299e719ce4c97748090fa238cb5f68303fb4abf (diff)
downloadwallet-core-851ac5602cea0beb7b3e29dc9a95c2093a0ed906.tar.gz
wallet-core-851ac5602cea0beb7b3e29dc9a95c2093a0ed906.tar.bz2
wallet-core-851ac5602cea0beb7b3e29dc9a95c2093a0ed906.zip
add UIDs for deletion tombstones to auditor/exchange trust management
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r--packages/taler-wallet-core/src/db.ts80
1 files changed, 50 insertions, 30 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index b0da0733b..52fe5c3dc 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -357,7 +357,12 @@ export interface AuditorRecord {
expirationStamp: number;
}
-export interface AuditorTrustInfo {
+export interface AuditorTrustRecord {
+ /**
+ * Currency that we trust this auditor for.
+ */
+ currency: string;
+
/**
* Base URL of the auditor.
*/
@@ -375,7 +380,12 @@ export interface AuditorTrustInfo {
uids: string[];
}
-export interface ExchangeTrustInfo {
+export interface ExchangeTrustRecord {
+ /**
+ * Currency that we trust this exchange for.
+ */
+ currency: string;
+
/**
* Canonicalized exchange base URL.
*/
@@ -394,31 +404,6 @@ export interface ExchangeTrustInfo {
}
/**
- * 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: AuditorTrustInfo[];
-
- /**
- * Exchanges that the wallet trusts for this currency.
- */
- exchanges: ExchangeTrustInfo[];
-}
-
-/**
* Status of a denomination.
*/
export enum DenominationStatus {
@@ -1775,10 +1760,44 @@ class DenominationsStore extends Store<"denominations", DenominationRecord> {
>(this, "exchangeBaseUrlIndex", "exchangeBaseUrl");
}
-class CurrenciesStore extends Store<"currencies", CurrencyRecord> {
+class AuditorTrustStore extends Store<"auditorTrust", AuditorTrustRecord> {
constructor() {
- super("currencies", { keyPath: "name" });
+ super("auditorTrust", {
+ keyPath: ["currency", "auditorBaseUrl", "auditorPub"],
+ });
}
+ auditorPubIndex = new Index<
+ "auditorTrust",
+ "auditorPubIndex",
+ string,
+ AuditorTrustRecord
+ >(this, "auditorPubIndex", "auditorPub");
+ uidIndex = new Index<"auditorTrust", "uidIndex", string, AuditorTrustRecord>(
+ this,
+ "uidIndex",
+ "uids",
+ { multiEntry: true },
+ );
+}
+
+class ExchangeTrustStore extends Store<"exchangeTrust", ExchangeTrustRecord> {
+ constructor() {
+ super("exchangeTrust", {
+ keyPath: ["currency", "exchangeBaseUrl", "exchangePub"],
+ });
+ }
+ exchangeMasterPubIndex = new Index<
+ "exchangeTrust",
+ "exchangeMasterPubIndex",
+ string,
+ ExchangeTrustRecord
+ >(this, "exchangeMasterPubIndex", "exchangePub");
+ uidIndex = new Index<
+ "exchangeTrust",
+ "uidIndex",
+ string,
+ ExchangeTrustRecord
+ >(this, "uidIndex", "uids", { multiEntry: true });
}
class ConfigStore extends Store<"config", ConfigRecord<any>> {
@@ -1891,7 +1910,8 @@ class TombstonesStore extends Store<"tombstones", TombstoneRecord> {
export const Stores = {
coins: new CoinsStore(),
config: new ConfigStore(),
- currencies: new CurrenciesStore(),
+ auditorTrustStore: new AuditorTrustStore(),
+ exchangeTrustStore: new ExchangeTrustStore(),
denominations: new DenominationsStore(),
exchanges: new ExchangesStore(),
proposals: new ProposalsStore(),