diff options
author | Florian Dold <florian@dold.me> | 2021-06-14 11:21:29 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-06-14 11:21:29 +0200 |
commit | 6e11b69cf5beb25fec1dfdff281877a76bf195a4 (patch) | |
tree | 6c4f36c915ab99b9cc17cb141ea72967fe8a576a /packages/taler-wallet-core/src/db.ts | |
parent | 9acd4a40602b16e230210dd508a2a8d6e86e6020 (diff) | |
download | wallet-core-6e11b69cf5beb25fec1dfdff281877a76bf195a4.tar.xz |
allow changing the wallet device ID
Diffstat (limited to 'packages/taler-wallet-core/src/db.ts')
-rw-r--r-- | packages/taler-wallet-core/src/db.ts | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index 5e2a3fefa..349a40427 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -1358,13 +1358,40 @@ export interface PurchaseRecord { autoRefundDeadline: Timestamp | undefined; } +export const WALLET_BACKUP_STATE_KEY = "walletBackupState"; + /** * Configuration key/value entries to configure * the wallet. + * */ -export interface ConfigRecord<T> { - key: string; - value: T; +export type ConfigRecord = + | { + key: typeof WALLET_BACKUP_STATE_KEY; + value: WalletBackupConfState; + } + | { key: "currencyDefaultsApplied"; value: boolean }; + +export interface WalletBackupConfState { + deviceId: string; + walletRootPub: string; + walletRootPriv: string; + + /** + * Last hash of the canonicalized plain-text backup. + */ + lastBackupPlainHash?: string; + + /** + * Timestamp stored in the last backup. + */ + lastBackupTimestamp?: Timestamp; + + /** + * Last time we tried to do a backup. + */ + lastBackupCheckTimestamp?: Timestamp; + lastBackupNonce?: string; } /** @@ -1671,7 +1698,7 @@ export const WalletStoresV1 = { }, ), config: describeStore( - describeContents<ConfigRecord<any>>("config", { keyPath: "key" }), + describeContents<ConfigRecord>("config", { keyPath: "key" }), {}, ), auditorTrust: describeStore( @@ -1817,9 +1844,14 @@ export const WalletStoresV1 = { ), }; +export interface MetaConfigRecord { + key: string; + value: any; +} + export const walletMetadataStore = { metaConfig: describeStore( - describeContents<ConfigRecord<any>>("metaConfig", { keyPath: "key" }), + describeContents<MetaConfigRecord>("metaConfig", { keyPath: "key" }), {}, ), }; |