Example #1
0
 def create_keystore(self, wizard, seed, passphrase):
     # this overloads the wizard's method
     xprv1, xpub1, xprv2, xpub2 = self.xkeys_from_seed(seed, passphrase)
     k1 = keystore.from_xprv(xprv1)
     k2 = keystore.from_xpub(xpub2)
     wizard.request_password(run_next=lambda pw, encrypt: self.on_password(
         wizard, pw, encrypt, k1, k2))
Example #2
0
 def on_restore_pw(self, wizard, seed, passphrase, password, encrypt_storage):
     xprv1, xpub1, xprv2, xpub2 = self.xkeys_from_seed(seed, passphrase)
     k1 = keystore.from_xprv(xprv1)
     k2 = keystore.from_xprv(xprv2)
     k1.add_seed(seed)
     k1.update_password(None, password)
     k2.update_password(None, password)
     wizard.data['x1/'] = k1.dump()
     wizard.data['x2/'] = k2.dump()
     long_user_id, short_id = get_user_id(wizard.data)
     xtype = xpub_type(xpub1)
     xpub3 = make_xpub(get_signing_xpub(xtype), long_user_id)
     k3 = keystore.from_xpub(xpub3)
     wizard.data['x3/'] = k3.dump()
     wizard.pw_args = password, encrypt_storage, STO_EV_USER_PW
     wizard.terminate()
Example #3
0
 def do_auth(self, wizard, short_id, otp, xpub3):
     try:
         server.auth(short_id, otp)
     except TrustedCoinException as e:
         if e.status_code == 400:  # invalid OTP
             wizard.show_message(_('Invalid one-time password.'))
             # ask again for otp
             self.request_otp_dialog(wizard, short_id, None, xpub3)
         else:
             wizard.show_message(str(e))
             wizard.terminate()
     except Exception as e:
         wizard.show_message(str(e))
         wizard.terminate()
     else:
         k3 = keystore.from_xpub(xpub3)
         wizard.data['x3/'] = k3.dump()
         wizard.data['use_trustedcoin'] = True
         wizard.terminate()
Example #4
0
 def do_auth(self, wizard, short_id, otp, xpub3):
     try:
         server.auth(short_id, otp)
     except TrustedCoinException as e:
         if e.status_code == 400:  # invalid OTP
             wizard.show_message(_('Invalid one-time password.'))
             # ask again for otp
             self.request_otp_dialog(wizard, short_id, None, xpub3)
         else:
             wizard.show_message(str(e))
             wizard.terminate()
     except Exception as e:
         wizard.show_message(str(e))
         wizard.terminate()
     else:
         k3 = keystore.from_xpub(xpub3)
         wizard.storage.put('x3/', k3.dump())
         wizard.storage.put('use_trustedcoin', True)
         wizard.storage.write()
         wizard.wallet = Wallet_2fa(wizard.storage)
         wizard.run('create_addresses')
Example #5
0
    def on_restore_pw(self, wizard, seed, passphrase, password,
                      encrypt_storage):
        storage = wizard.storage
        xprv1, xpub1, xprv2, xpub2 = self.xkeys_from_seed(seed, passphrase)
        k1 = keystore.from_xprv(xprv1)
        k2 = keystore.from_xprv(xprv2)
        k1.add_seed(seed)
        k1.update_password(None, password)
        k2.update_password(None, password)
        storage.put('x1/', k1.dump())
        storage.put('x2/', k2.dump())
        long_user_id, short_id = get_user_id(storage)
        xpub3 = make_xpub(get_signing_xpub(), long_user_id)
        k3 = keystore.from_xpub(xpub3)
        storage.put('x3/', k3.dump())

        storage.set_keystore_encryption(bool(password))
        if encrypt_storage:
            storage.set_password(password, enc_version=STO_EV_USER_PW)

        wizard.wallet = Wallet_2fa(storage)
        wizard.create_addresses()