|
@ -220,19 +220,32 @@ class TrezorCompatiblePlugin(BasePlugin): |
|
|
self.print_error("clear session:", client) |
|
|
self.print_error("clear session:", client) |
|
|
client.clear_session() |
|
|
client.clear_session() |
|
|
|
|
|
|
|
|
|
|
|
def initialize_device(self, wallet, wizard): |
|
|
|
|
|
(strength, label, pin_protection, passphrase_protection) \ |
|
|
|
|
|
= wizard.request_trezor_reset_settings(self.device) |
|
|
|
|
|
|
|
|
|
|
|
assert strength in range(0, 3) |
|
|
|
|
|
strength = 64 * (strength + 2) # 128, 192 or 256 |
|
|
|
|
|
language = '' |
|
|
|
|
|
|
|
|
|
|
|
client = self.client(wallet) |
|
|
|
|
|
client.reset_device(True, strength, passphrase_protection, |
|
|
|
|
|
pin_protection, label, language) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def select_device(self, wallet, wizard): |
|
|
def select_device(self, wallet, wizard): |
|
|
'''Called when creating a new wallet. Select the device |
|
|
'''Called when creating a new wallet. Select the device to use. If |
|
|
to use.''' |
|
|
the device is uninitialized, go through the intialization |
|
|
|
|
|
process.''' |
|
|
clients = list(self.clients) |
|
|
clients = list(self.clients) |
|
|
if not len(clients): |
|
|
suffixes = [_("An unnamed device (wiped)"), _(" (initialized)")] |
|
|
return |
|
|
labels = [client.label() + suffixes[client.is_initialized()] |
|
|
if len(clients) > 1: |
|
|
for client in clients] |
|
|
labels = [client.label() for client in clients] |
|
|
msg = _("Please select which %s device to use:") % self.device |
|
|
msg = _("Please select which %s device to use:") % self.device |
|
|
client = clients[wizard.query_choice(msg, labels)] |
|
|
client = clients[wizard.query_choice(msg, labels)] |
|
|
|
|
|
else: |
|
|
|
|
|
client = clients[0] |
|
|
|
|
|
self.pair_wallet(wallet, client) |
|
|
self.pair_wallet(wallet, client) |
|
|
|
|
|
if not client.is_initialized(): |
|
|
|
|
|
self.initialize_device(wallet, wizard) |
|
|
|
|
|
|
|
|
def pair_wallet(self, wallet, client): |
|
|
def pair_wallet(self, wallet, client): |
|
|
self.print_error("pairing wallet %s to device %s" % (wallet, client)) |
|
|
self.print_error("pairing wallet %s to device %s" % (wallet, client)) |
|
|