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))
def do_auth(self, wizard, short_id, otp, xpub3): try: server.auth(short_id, otp) except: wizard.show_message(_('Incorrect password')) return 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')
def on_restore_pw(self, wizard, seed, passphrase, password, encrypt): 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(signing_xpub, long_user_id) k3 = keystore.from_xpub(xpub3) storage.put('x3/', k3.dump()) storage.set_password(password, encrypt) wizard.wallet = Wallet_2fa(storage) wizard.create_addresses()