diff options
author | Florian Dold <florian@dold.me> | 2020-12-10 17:50:17 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2020-12-10 17:50:17 +0100 |
commit | 80a0fab1261fc06f79db4c32fd7a1a6d0cb0db0f (patch) | |
tree | 87ed5e6f69414d5bdb9639fd529096988bf867e7 /packages/taler-wallet-core/src/operations/backup.ts | |
parent | c27a7abfba9223d93d4603dc2284e26908b1bf38 (diff) | |
download | wallet-core-80a0fab1261fc06f79db4c32fd7a1a6d0cb0db0f.tar.xz |
backup schema
Diffstat (limited to 'packages/taler-wallet-core/src/operations/backup.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/backup.ts | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/packages/taler-wallet-core/src/operations/backup.ts b/packages/taler-wallet-core/src/operations/backup.ts index cf73de62d..6c497b305 100644 --- a/packages/taler-wallet-core/src/operations/backup.ts +++ b/packages/taler-wallet-core/src/operations/backup.ts @@ -54,7 +54,7 @@ import { stringToBytes, } from "../crypto/talerCrypto"; import { canonicalizeBaseUrl, canonicalJson, j2s } from "../util/helpers"; -import { Timestamp } from "../util/time"; +import { getTimestampNow, Timestamp } from "../util/time"; import { URL } from "../util/url"; import { AmountString } from "../types/talerTypes"; import { @@ -77,6 +77,16 @@ interface WalletBackupConfState { walletRootPriv: string; clocks: { [device_id: string]: number }; lastBackupHash?: string; + + /** + * Timestamp stored in the last backup. + */ + lastBackupTimestamp?: Timestamp; + + /** + * Last time we tried to do a backup. + */ + lastBackupCheckTimestamp?: Timestamp; lastBackupNonce?: string; } @@ -237,6 +247,7 @@ export async function exportBackup( base_url: ex.baseUrl, accounts: ex.wireInfo.accounts.map((x) => ({ payto_uri: x.payto_uri, + master_sig: x.master_sig, })), auditors: ex.details.auditors.map((x) => ({ auditor_pub: x.auditor_pub, @@ -261,6 +272,10 @@ export async function exportBackup( }); }); + if (!bs.lastBackupTimestamp) { + bs.lastBackupTimestamp = getTimestampNow(); + } + const backupBlob: WalletBackupContentV1 = { schema_id: "gnu-taler-wallet-backup-content", schema_version: 1, @@ -275,6 +290,10 @@ export async function exportBackup( recoup_groups: [], refresh_groups: [], tips: [], + timestamp: bs.lastBackupTimestamp, + trusted_auditors: {}, + trusted_exchanges: {}, + intern_table: {}, }; // If the backup changed, we increment our clock. |