taler-docs

Documentation for GNU Taler components, APIs and protocols
Log | Files | Refs | README | LICENSE

009-backup.rst (7509B)


      1 XX 09: Wallet Backup
      2 ####################
      3 
      4 .. warning::
      5 
      6   This design document is deprecated.  The incremental backup and sync
      7   protocol described in `DD 92`_ supersedes it.
      8 
      9 .. _DD 92: https://docs.taler.net/design-documents/092-incremental-backup-sync.html
     10 
     11 Summary
     12 =======
     13 
     14 This document describes the backup system used by Taler wallets.
     15 This is the second, simplified iteration of the proposal, which leaves
     16 out multi-device synchronization.
     17 
     18 
     19 Requirements
     20 ============
     21 
     22 * Backup must work both with and without Anastasis.
     23 
     24   * When not using Anastasis, the user is responsible for keeping
     25     their wallet's **root secret** safe.
     26 
     27 * Arbitrary number of backup providers must be supported.
     28 * Minimize information leaks / timing side channels.
     29 
     30   * User might be able to change some setting to allow more frequent
     31     backup with less potential data loss but more leakage.
     32 
     33 * Minimize potential to lose money or important information.
     34 * Since real-time sync is not supported yet, wallets should have a feature
     35   where their whole content is "emptied" to another wallet, and the wallet is
     36   reset.
     37 
     38   .. Note::
     39      CG: This boils down to the existing 'reset' button (developer mode).
     40      Very dangerous. Could be OK if we had some way to notice the number of wallets
     41      using the same backup and then allow this 'reset' as longa as # wallets > 1.
     42      Still, doing so will require a handshake with the other wallets to ensure
     43      that the user doesn't accidentally reset on both wallets at the same time,
     44      each believing the other wallet is still sync'ed. So we would need like
     45      a 2-phase commit "planning to remove", "acknowledged" (by other wallet), "remove".
     46      Very bad UX without real-time sync.
     47 
     48 * Even without real-time sync, the backup data must support merging with old, existing wallet
     49   state, as the device that the wallet runs on may  be restored from backup or be offline
     50   for a long time.
     51 
     52 
     53 Solution Overview
     54 =================
     55 
     56 Each wallet has a 64 (CG: 32 should be enough, AND better for URLs/QR codes/printing/writing down)
     57 byte wallet **root secret**, which is used to derive all other secrets
     58 used during backup, which are currently:
     59 
     60 1. The private **account key** for a sync provider, derived using the sync provider's base URL as salt.
     61    The base URL must be normalized to end with a "/". The schema ("http://" or "https://") is part of the
     62    base URL, thus different account keys would be used for "http://" vs. "https://" (reduces linkability).
     63 2. The **symmetric key** used to encrypt/decrypt the backup blob. FIXME: document exact KDF salt here
     64    once implemented.
     65 
     66 If the user chooses to use Anastasis, the following information is backed up in Anastasis
     67 (as the **core secret** in Anastasis terminology):
     68 
     69 * Taler Wallet core secret tag (new GANA registry) and format version
     70 * List of used backup providers (sync)
     71 * Wallet root secret
     72 * **Tor constraint** (boolean) advising wallets that the backup should only be accessed via
     73   Tor and that users must be warned before attempting to restore the backup without Tor.
     74 
     75 
     76 Supported Operations
     77 --------------------
     78 
     79 * **restore-from-anastasis**:  Start Anastasis recovery process.
     80   This requires the wallet backup state to be uninitialized.
     81   FIXME: The last sentence makes no sense, as the user may have to pay for recovery!
     82 * **restore-from-recovery-secret**:  This requires the wallet backup state to be uninitialized.
     83   FIXME: Again, I do not think we can require this. User could make backup,
     84   then loose device. Create new wallet. Use new wallet (including making
     85   yet another backup). THEN user remembers that he
     86   had a backup (or find root key) and now want to restore backup. This should
     87   MERGE the two states (you can consider it a 'poor' version of 'sync'). Note
     88   that the lost device cannot 'abandon' the backed up state here!
     89 * **add-provider** / **remove-provider**:  Add/remove a sync provider from the
     90   list of providers.  Adding a provider will cause payment(s) to the provider
     91   to be scheduled according to the provider's terms.  If the wallet backup
     92   state is "uninitialized", adding a provider will set the backup state to
     93   "initialized" with a fresh wallet root key.  Changing the provider list will
     94   also update the sync provider URL list in the  Anastasis core secret (forcing
     95   a new policy to be uploaded).
     96 * **abandon** / **takeover**: When the user wants to stop using a wallet on a particular
     97   device, another wallet can "take over" by reading the recovery secret of the abandoned wallet.
     98   The abandoned wallet marks explicitly in its backup blob that it is abandoned.
     99   Abandoning a wallet will set the backup state to "uninitialized".
    100 * **backup**: Do a backup cycle.  Uploads the latest wallet state to all
    101   sync providers.  If sync provider state has changed unexpectedly, downloads
    102   backup, merges, and then uploads the reconciled state.
    103 * **rekey**:  Change to a new wallet root secret, in case the old one has been
    104   compromised.  Only protectes future funds of the wallet from being
    105   compromised.  Requires a new payment to all configured sync providers.
    106 * **backup-to-anastasis** is missing.
    107 
    108 
    109 
    110 Backup Format
    111 -------------
    112 
    113 TBD.  Considerations from :doc:`005-wallet-backup-sync` still apply,
    114 especially regarding the CRDT.
    115 
    116 
    117 Initial User Experience
    118 -----------------------
    119 
    120 The user will be asked to set up backup&sync (by selecting a provider)
    121 after the first withdrawal operation has been confirmed.  After selecting
    122 the backup&sync providers, the user will be presented with a "checklist" that
    123 contains an option to (1) show/print the recovery secret and (2) set up Anastasis.
    124 
    125 The wallet will initially only withdraw enough money to pay the
    126 backup&sync/anastasis providers.  Only after successful backup of the wallet's
    127 signed planchets, the full withdrawal will be completed.
    128 
    129 
    130 Open Questions
    131 ==============
    132 
    133 * Should the exchange tell the wallet about available sync/Anastasis providers?
    134   Otherwise, what do we do if the wallet does not know any providers for the
    135   currency of the user?
    136 * Should the wallet root secret and wallet database be locally encrypted
    137   and protected via a passphrase?
    138 * What happens if the same Anastasis user has multiple wallets?  Can Anastasis somehow
    139   support multiple "instances" per application?
    140 
    141   .. Note::
    142      CG would definitively solve this using a more complex format for the **master secret**,
    143      basically serializing multiple **root secret** values with meta data
    144      (which wallet/device/name).
    145 
    146 
    147 Future Work / Ideas
    148 ===================
    149 
    150 * Incremental backups?
    151 
    152   * Instead of one big blob that always needs to be read/written, we could have (1) a
    153     limited length append-only journal and (2) a merkle tree so that the backup blob can
    154     be updated incrementally once the journal is full.
    155   * Leaks more information and is more complex.
    156 
    157 * Mult-device synchronization, with synchronous communication either over some signaling server
    158   or P2P connectivity (WebRTC, etc.)
    159 
    160   * Destroys the "wallet" metaphor, now the wallet is more like an account.
    161   * We should first agree on the requirements from the perspective of end users
    162   * P2P payments in Taler might also make sync less important
    163   * Maybe only parts of the state (purchases / contracts, but not coins) should be synchronized?
    164   * WhatsApp web model:  The wallet runs only on one devices, but other devices
    165     can connect to it as clients.  (Allows my browser wallet to temporarily access
    166     money from my phone wallet and vice versa.)