From 95568395ce5817028046a96d95bd3399995154d5 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 21 Dec 2020 13:23:07 +0100 Subject: backup import WIP --- .../taler-wallet-core/src/types/backupTypes.ts | 61 +++++++++++++++------- 1 file changed, 43 insertions(+), 18 deletions(-) (limited to 'packages/taler-wallet-core/src/types/backupTypes.ts') diff --git a/packages/taler-wallet-core/src/types/backupTypes.ts b/packages/taler-wallet-core/src/types/backupTypes.ts index d40d4fa6c..0b7f93c69 100644 --- a/packages/taler-wallet-core/src/types/backupTypes.ts +++ b/packages/taler-wallet-core/src/types/backupTypes.ts @@ -33,11 +33,15 @@ * aren't exported yet (and not even implemented in wallet-core). * 6. Returning money to own bank account isn't supported/exported yet. * 7. Peer-to-peer payments aren't supported yet. + * 8. Next update time / next refresh time isn't backed up yet. * * Questions: * 1. What happens when two backups are merged that have * the same coin in different refresh groups? * => Both are added, one will eventually fail + * 2. Should we make more information forgettable? I.e. is + * the coin selection still relevant for a purchase after the coins + * are legally expired? * * General considerations / decisions: * 1. Information about previously occurring errors and @@ -74,6 +78,8 @@ type DeviceIdString = string; */ type ClockValue = number; +type RawContractTerms = any; + /** * Content of the backup. * @@ -544,10 +550,7 @@ export interface BackupRefreshSession { /** * Hased denominations of the newly requested coins. */ - new_denoms: { - count: number; - denom_pub_hash: string; - }[]; + new_denoms: BackupDenomSel; /** * Seed used to derive the planchets and @@ -654,10 +657,7 @@ export interface BackupWithdrawalGroup { /** * Multiset of denominations selected for withdrawal. */ - selected_denoms: { - denom_pub_hash: string; - count: number; - }[]; + selected_denoms: BackupDenomSel; } export enum BackupRefundState { @@ -747,7 +747,14 @@ export interface BackupPurchase { /** * Contract terms we got from the merchant. */ - contract_terms_raw: string; + contract_terms_raw: RawContractTerms; + + /** + * Signature on the contract terms. + * + * Must be present if contract_terms_raw is present. + */ + merchant_sig?: string; /** * Private key for the nonce. Might eventually be used @@ -889,6 +896,14 @@ export interface BackupDenomination { coins: BackupCoin[]; } +/** + * Denomination selection. + */ +export type BackupDenomSel = { + denom_pub_hash: string; + count: number; +}[]; + export interface BackupReserve { /** * The reserve private key. @@ -961,10 +976,7 @@ export interface BackupReserve { * Denominations selected for the initial withdrawal. * Stored here to show costs before withdrawal has begun. */ - initial_selected_denoms: { - denom_pub_hash: string; - count: number; - }[]; + initial_selected_denoms: BackupDenomSel; /** * Groups of withdrawal operations for this reserve. Typically just one. @@ -1126,10 +1138,6 @@ export enum BackupProposalStatus { * but the user needs to accept/reject it. */ Proposed = "proposed", - /** - * The user has accepted the proposal. - */ - Accepted = "accepted", /** * The user has rejected the proposal. */ @@ -1150,16 +1158,33 @@ export enum BackupProposalStatus { * Proposal by a merchant. */ export interface BackupProposal { + /** + * Base URL of the merchant that proposed the purchase. + */ + merchant_base_url: string; + /** * Downloaded data from the merchant. */ - contract_terms_raw?: string; + contract_terms_raw?: RawContractTerms; + + /** + * Signature on the contract terms. + * + * Must be present if contract_terms_raw is present. + */ + merchant_sig?: string; /** * Unique ID when the order is stored in the wallet DB. */ proposal_id: string; + /** + * Merchant-assigned order ID of the proposal. + */ + order_id: string; + /** * Timestamp of when the record * was created. -- cgit v1.2.3