diff options
author | Florian Dold <florian@dold.me> | 2021-01-08 13:30:29 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-01-08 13:30:29 +0100 |
commit | 8921a5e8f2f47c113eeeaa1bf14937c5b6cfb0ac (patch) | |
tree | 956d493e976b9316b23332cab6e3057933db2a3a /packages/taler-wallet-core/src/types | |
parent | 324f44ae6954ef7a75a67838a7f0cbf2a6dc6d76 (diff) | |
download | wallet-core-8921a5e8f2f47c113eeeaa1bf14937c5b6cfb0ac.tar.xz |
implement import of backup recovery document
Diffstat (limited to 'packages/taler-wallet-core/src/types')
-rw-r--r-- | packages/taler-wallet-core/src/types/backupTypes.ts | 57 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/types/dbTypes.ts | 30 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/types/walletTypes.ts | 24 |
3 files changed, 77 insertions, 34 deletions
diff --git a/packages/taler-wallet-core/src/types/backupTypes.ts b/packages/taler-wallet-core/src/types/backupTypes.ts index caab92cf8..56b50d71c 100644 --- a/packages/taler-wallet-core/src/types/backupTypes.ts +++ b/packages/taler-wallet-core/src/types/backupTypes.ts @@ -21,27 +21,22 @@ * as the backup schema must remain very stable and should be self-contained. * * Current limitations: - * 1. Exchange/auditor trust isn't exported yet - * (see https://bugs.gnunet.org/view.php?id=6448) - * 2. Reports to the auditor (cryptographic proofs and/or diagnostics) aren't exported yet - * 3. "Ghost spends", where a coin is spent unexpectedly by another wallet + * 1. "Ghost spends", where a coin is spent unexpectedly by another wallet * and a corresponding transaction (that is missing some details!) should * be added to the transaction history, aren't implemented yet. - * 4. Clocks for denom/coin selections aren't properly modeled yet. + * 2. Clocks for denom/coin selections aren't properly modeled yet. * (Needed for re-denomination of withdrawal / re-selection of coins) - * 5. Preferences about how currencies are to be displayed + * 3. Preferences about how currencies are to be displayed * 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. - * 9. Coin/denom selections should be forgettable once that information + * 4. Returning money to own bank account isn't supported/exported yet. + * 5. Peer-to-peer payments aren't supported yet. + * 6. Next update time / next auto-refresh time isn't backed up yet. + * 7. Coin/denom selections should be forgettable once that information * becomes irrelevant. - * 10. Re-denominated payments/refreshes are not shown properly in the total - * payment cost. - * 11. Failed refunds do not have any information about why they failed. - * => This should go into the general "error reports" - * 12. Tombstones for removed backup providers - * 13. Do we somehow need to model the mechanism for first only withdrawing + * 8. Re-denominated payments/refreshes are not shown properly in the total + * payment cost. + * 9. Permanently failed operations aren't properly modeled yet + * 10. Do we somehow need to model the mechanism for first only withdrawing * the amount to pay the backup provider? * * Questions: @@ -299,15 +294,7 @@ export interface BackupTrustExchange { clock_removed?: ClockValue; } -/** - * Backup information about one backup storage provider. - */ -export class BackupBackupProvider { - /** - * Canonicalized base URL of the provider. - */ - base_url: string; - +export class BackupBackupProviderTerms { /** * Last known supported protocol version. */ @@ -322,6 +309,22 @@ export class BackupBackupProvider { * Last known storage limit. */ storage_limit_in_megabytes: number; +} + +/** + * Backup information about one backup storage provider. + */ +export class BackupBackupProvider { + /** + * Canonicalized base URL of the provider. + */ + base_url: string; + + /** + * Last known terms. Might be unavailable in some situations, such + * as directly after restoring form a backup recovery document. + */ + terms?: BackupBackupProviderTerms; /** * Proposal IDs for payments to this provider. @@ -790,11 +793,11 @@ export interface BackupPurchase { /** * Total cost initially shown to the user. - * + * * This includes the amount taken by the merchant, fees (wire/deposit) contributed * by the customer, refreshing fees, fees for withdraw-after-refresh and "trimmings" * of coins that are too small to spend. - * + * * Note that in rare situations, this cost might not be accurate (e.g. * when the payment or refresh gets re-denominated). * We might show adjustments to this later, but currently we don't do so. diff --git a/packages/taler-wallet-core/src/types/dbTypes.ts b/packages/taler-wallet-core/src/types/dbTypes.ts index 1c9f546d9..551495a68 100644 --- a/packages/taler-wallet-core/src/types/dbTypes.ts +++ b/packages/taler-wallet-core/src/types/dbTypes.ts @@ -1426,20 +1426,30 @@ export enum ImportPayloadType { CoreSchema = "core-schema", } +export enum BackupProviderStatus { + PaymentRequired = "payment-required", + Ready = "ready", +} + export interface BackupProviderRecord { baseUrl: string; - supportedProtocolVersion: string; - - annualFee: AmountString; - - storageLimitInMegabytes: number; + /** + * Terms of service of the provider. + * Might be unavailable in the DB in certain situations + * (such as loading a recovery document). + */ + terms?: { + supportedProtocolVersion: string; + annualFee: AmountString; + storageLimitInMegabytes: number; + }; active: boolean; /** - * Hash of the last backup that we already - * merged. + * Hash of the last encrypted backup that we already merged + * or successfully uploaded ourselves. */ lastBackupHash?: string; @@ -1448,6 +1458,12 @@ export interface BackupProviderRecord { * merged. */ lastBackupClock?: number; + + lastBackupTimestamp?: Timestamp; + + currentPaymentProposalId?: string; + + paymentProposalIds: string[]; } class ExchangesStore extends Store<"exchanges", ExchangeRecord> { diff --git a/packages/taler-wallet-core/src/types/walletTypes.ts b/packages/taler-wallet-core/src/types/walletTypes.ts index 1b962e1c4..235ea11f1 100644 --- a/packages/taler-wallet-core/src/types/walletTypes.ts +++ b/packages/taler-wallet-core/src/types/walletTypes.ts @@ -56,6 +56,7 @@ import { ContractTerms, } from "./talerTypes"; import { OrderShortInfo, codecForOrderShortInfo } from "./transactionsTypes"; +import { BackupRecovery } from "../operations/backup"; /** * Response for the create reserve request to the wallet. @@ -896,6 +897,29 @@ export interface MakeSyncSignatureRequest { newHash: string; } +/** + * Strategy for loading recovery information. + */ +export enum RecoveryMergeStrategy { + /** + * Keep the local wallet root key, import and take over providers. + */ + Ours = "ours", + + /** + * Migrate to the wallet root key from the recovery information. + */ + Theirs = "theirs", +} + +/** + * Load recovery information into the wallet. + */ +export interface RecoveryLoadRequest { + recovery: BackupRecovery; + strategy?: RecoveryMergeStrategy; +} + export const codecForWithdrawTestBalance = (): Codec< WithdrawTestBalanceRequest > => |