aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/db.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-10-15 16:03:48 +0200
committerFlorian Dold <florian@dold.me>2022-10-15 16:03:48 +0200
commita41d1ee53e1dc6af0b54f085053278e039cda8dc (patch)
tree5b6200a0cfa067c0d27743b9c6c94ceaa2efcd10 /packages/taler-wallet-core/src/db.ts
parentbd88dcebbcf90414c790a86ee13740eaf20e3334 (diff)
downloadwallet-core-a41d1ee53e1dc6af0b54f085053278e039cda8dc.tar.xz
wallet-core: put signing keys in separate object store
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r--packages/taler-wallet-core/src/db.ts49
1 files changed, 39 insertions, 10 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index b785efed8..dd21aa037 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -51,6 +51,8 @@ import {
TransactionIdStr,
CoinRefreshRequest,
CoinStatus,
+ EddsaPublicKeyString,
+ EddsaSignatureString,
} from "@gnu-taler/taler-util";
import { RetryInfo, RetryTags } from "./util/retries.js";
import { Event, IDBDatabase } from "@gnu-taler/idb-bridge";
@@ -409,11 +411,26 @@ export namespace DenominationRecord {
}
}
+export interface ExchangeSignkeysRecord {
+ stampStart: TalerProtocolTimestamp;
+ stampExpire: TalerProtocolTimestamp;
+ stampEnd: TalerProtocolTimestamp;
+ signkeyPub: EddsaPublicKeyString;
+ masterSig: EddsaSignatureString;
+
+ /**
+ * Exchange details that thiis signkeys record belongs to.
+ */
+ exchangeDetailsRowId: number;
+}
+
/**
* Exchange details for a particular
* (exchangeBaseUrl, masterPublicKey, currency) tuple.
*/
export interface ExchangeDetailsRecord {
+ rowId?: number;
+
/**
* Master public key of the exchange.
*/
@@ -446,14 +463,6 @@ export interface ExchangeDetailsRecord {
globalFees: ExchangeGlobalFees[];
/**
- * Signing keys we got from the exchange, can also contain
- * older signing keys that are not returned by /keys anymore.
- *
- * FIXME: Should this be put into a separate object store?
- */
- signingKeys: ExchangeSignKeyJson[];
-
- /**
* Etag of the current ToS of the exchange.
*/
tosCurrentEtag: string;
@@ -1892,9 +1901,29 @@ export const WalletStoresV1 = {
exchangeDetails: describeStore(
"exchangeDetails",
describeContents<ExchangeDetailsRecord>({
- keyPath: ["exchangeBaseUrl", "currency", "masterPublicKey"],
+ keyPath: "rowId",
+ autoIncrement: true,
}),
- {},
+ {
+ byPointer: describeIndex(
+ "byDetailsPointer",
+ ["exchangeBaseUrl", "currency", "masterPublicKey"],
+ {
+ unique: true,
+ },
+ ),
+ },
+ ),
+ exchangeSignkeys: describeStore(
+ "exchangeSignKeys",
+ describeContents<ExchangeSignkeysRecord>({
+ keyPath: ["exchangeDetailsRowId", "signkeyPub"],
+ }),
+ {
+ byExchangeDetailsRowId: describeIndex("byExchangeDetailsRowId", [
+ "exchangeDetailsRowId",
+ ]),
+ },
),
refreshGroups: describeStore(
"refreshGroups",