aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/db.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-10-14 22:10:03 +0200
committerFlorian Dold <florian@dold.me>2022-10-14 22:10:10 +0200
commita57fcb144d8de40fe50b825d34a27e415ef3fec3 (patch)
tree1883a8eefb9f7914d661a854c0098154cb5cd215 /packages/taler-wallet-core/src/db.ts
parentf1cba79c656875af0c6a09fd8e03b2c94fb2ac44 (diff)
downloadwallet-core-a57fcb144d8de40fe50b825d34a27e415ef3fec3.tar.xz
wallet-core: pull out ToS into separate object store
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r--packages/taler-wallet-core/src/db.ts63
1 files changed, 33 insertions, 30 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index 6dfb06c15..304efd852 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -80,7 +80,7 @@ import { Event, IDBDatabase } from "@gnu-taler/idb-bridge";
* for all previous versions must be written, which should be
* avoided.
*/
-export const TALER_DB_NAME = "taler-wallet-main-v6";
+export const TALER_DB_NAME = "taler-wallet-main-v7";
/**
* Name of the metadata database. This database is used
@@ -99,7 +99,7 @@ export const CURRENT_DB_CONFIG_KEY = "currentMainDbName";
* backwards-compatible way or object stores and indices
* are added.
*/
-export const WALLET_DB_MINOR_VERSION = 2;
+export const WALLET_DB_MINOR_VERSION = 1;
/**
* Ranges for operation status fields.
@@ -451,39 +451,40 @@ export interface ExchangeDetailsRecord {
signingKeys: ExchangeSignKeyJson[];
/**
- * Terms of service text or undefined if not downloaded yet.
- *
- * This is just used as a cache of the last downloaded ToS.
- *
- * FIXME: Put in separate object store!
+ * Etag of the current ToS of the exchange.
*/
- termsOfServiceText: string | undefined;
+ tosCurrentEtag: string;
/**
- * content-type of the last downloaded termsOfServiceText.
- *
- * * FIXME: Put in separate object store!
+ * Information about ToS acceptance from the user.
*/
- termsOfServiceContentType: string | undefined;
+ tosAccepted:
+ | {
+ etag: string;
+ timestamp: TalerProtocolTimestamp;
+ }
+ | undefined;
- /**
- * ETag for last terms of service download.
- */
- termsOfServiceLastEtag: string | undefined;
+ wireInfo: WireInfo;
+}
- /**
- * ETag for last terms of service accepted.
- */
- termsOfServiceAcceptedEtag: string | undefined;
+export interface ExchangeTosRecord {
+ exchangeBaseUrl: string;
+
+ etag: string;
/**
- * Timestamp when the ToS was accepted.
+ * Terms of service text or undefined if not downloaded yet.
+ *
+ * This is just used as a cache of the last downloaded ToS.
*
- * Used during backup merging.
*/
- termsOfServiceAcceptedTimestamp: TalerProtocolTimestamp | undefined;
+ termsOfServiceText: string | undefined;
- wireInfo: WireInfo;
+ /**
+ * Content-type of the last downloaded termsOfServiceText.
+ */
+ termsOfServiceContentType: string | undefined;
}
export interface ExchangeDetailsPointer {
@@ -492,11 +493,6 @@ export interface ExchangeDetailsPointer {
currency: string;
/**
- * Last observed protocol version range offered by the exchange.
- */
- protocolVersionRange: string;
-
- /**
* Timestamp when the (masterPublicKey, currency) pointer
* has been updated.
*/
@@ -1899,6 +1895,14 @@ export const WalletStoresV1 = {
byReservePub: describeIndex("byReservePub", "reservePub", {}),
},
),
+ exchangeTos: describeStore(
+ "exchangeTos",
+ describeContents<ExchangeTosRecord>({
+ keyPath: ["exchangeBaseUrl", "etag"],
+ autoIncrement: true,
+ }),
+ {},
+ ),
config: describeStore(
"config",
describeContents<ConfigRecord>({ keyPath: "key" }),
@@ -2116,7 +2120,6 @@ export const WalletStoresV1 = {
"bankAccounts",
describeContents<BankAccountsRecord>({
keyPath: "uri",
- versionAdded: 2,
}),
{},
),