From a41d1ee53e1dc6af0b54f085053278e039cda8dc Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sat, 15 Oct 2022 16:03:48 +0200 Subject: wallet-core: put signing keys in separate object store --- packages/taler-wallet-core/src/db.ts | 49 ++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 10 deletions(-) (limited to 'packages/taler-wallet-core/src/db.ts') 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. */ @@ -445,14 +462,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. */ @@ -1892,9 +1901,29 @@ export const WalletStoresV1 = { exchangeDetails: describeStore( "exchangeDetails", describeContents({ - keyPath: ["exchangeBaseUrl", "currency", "masterPublicKey"], + keyPath: "rowId", + autoIncrement: true, }), - {}, + { + byPointer: describeIndex( + "byDetailsPointer", + ["exchangeBaseUrl", "currency", "masterPublicKey"], + { + unique: true, + }, + ), + }, + ), + exchangeSignkeys: describeStore( + "exchangeSignKeys", + describeContents({ + keyPath: ["exchangeDetailsRowId", "signkeyPub"], + }), + { + byExchangeDetailsRowId: describeIndex("byExchangeDetailsRowId", [ + "exchangeDetailsRowId", + ]), + }, ), refreshGroups: describeStore( "refreshGroups", -- cgit v1.2.3