From 0e33e540f32aa90ef8bd6ee19c239ae7f5bd7db9 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 7 Dec 2020 23:32:20 +0100 Subject: CRDT-style tombstones --- .../taler-wallet-core/src/types/backupTypes.ts | 39 +++++++++++++++++----- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'packages/taler-wallet-core') diff --git a/packages/taler-wallet-core/src/types/backupTypes.ts b/packages/taler-wallet-core/src/types/backupTypes.ts index 6bdf26992..d6062b92d 100644 --- a/packages/taler-wallet-core/src/types/backupTypes.ts +++ b/packages/taler-wallet-core/src/types/backupTypes.ts @@ -21,8 +21,7 @@ * as the backup schema must remain very stable and should be self-contained. * * Current limitations: - * 1. Deletion tomb stones aren't supported yet - * 2. Exchange/auditor trust isn't exported yet + * 1. Exchange/auditor trust isn't exported yet * (see https://bugs.gnunet.org/view.php?id=6448) * * General considerations / decisions: @@ -69,12 +68,6 @@ export interface WalletBackupContentV1 { */ schema_version: 1; - /** - * Monotonically increasing clock of the wallet, - * used to determine causality when merging backups. - */ - clock: number; - /** * Root public key of the wallet. This field is present as * a sanity check if the backup content JSON is loaded from file. @@ -89,6 +82,16 @@ export interface WalletBackupContentV1 { */ current_device_id: string; + /** + * Monotonically increasing clock of the wallet, + * used to determine causality when merging backups. + * + * Information about other clocks, used to delete + * tombstones in the hopefully rare case that multiple wallets + * are connected to the same sync server. + */ + clocks: { [device_id: string]: number }; + /** * Per-exchange data sorted by exchange master public key. * @@ -137,6 +140,21 @@ export interface WalletBackupContentV1 { * Recoup groups. */ recoup_groups: BackupRecoupGroup[]; + + /** + * Tombstones for deleting purchases. + */ + purchase_tombstones: { + /** + * Clock when the purchase was deleted + */ + clock_deleted: number; + + /** + * Proposal ID identifying the purchase. + */ + proposal_id: string; + }[]; } /** @@ -645,6 +663,11 @@ export interface BackupPurchase { */ proposal_id: string; + /** + * Clock when this purchase was created. + */ + clock_created: number; + /** * Contract terms we got from the merchant. */ -- cgit v1.2.3