Skip to content

Commit 84239e1

Browse files
committed
trezor/keepkey separation: init device
1 parent 414b6e8 commit 84239e1

2 files changed

Lines changed: 10 additions & 21 deletions

File tree

plugins/keepkey/plugin.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -169,26 +169,14 @@ def f(method):
169169
def _initialize_device(self, settings, method, device_id, wizard, handler):
170170
item, label, pin_protection, passphrase_protection = settings
171171

172-
if method == TIM_RECOVER and self.device == 'TREZOR':
173-
# Warn user about firmware lameness
174-
handler.show_error(_(
175-
"You will be asked to enter 24 words regardless of your "
176-
"seed's actual length. If you enter a word incorrectly or "
177-
"misspell it, you cannot change it or go back - you will need "
178-
"to start again from the beginning.\n\nSo please enter "
179-
"the words carefully!"))
180-
181172
language = 'english'
182173
devmgr = self.device_manager()
183174
client = devmgr.client_by_id(device_id)
184175

185176
if method == TIM_NEW:
186177
strength = 64 * (item + 2) # 128, 192 or 256
187-
args = [True, strength, passphrase_protection,
188-
pin_protection, label, language]
189-
if self.device == 'TREZOR':
190-
args.extend([0, False]) # u2f_counter, skip_backup
191-
client.reset_device(*args)
178+
client.reset_device(True, strength, passphrase_protection,
179+
pin_protection, label, language)
192180
elif method == TIM_RECOVER:
193181
word_count = 6 * (item + 2) # 12, 18 or 24
194182
client.step = 0

plugins/trezor/plugin.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,9 @@ def f(method):
168168
def _initialize_device(self, settings, method, device_id, wizard, handler):
169169
item, label, pin_protection, passphrase_protection = settings
170170

171-
if method == TIM_RECOVER and self.device == 'TREZOR':
172-
# Warn user about firmware lameness
171+
if method == TIM_RECOVER:
172+
# FIXME the PIN prompt will appear over this message
173+
# which makes this unreadable
173174
handler.show_error(_(
174175
"You will be asked to enter 24 words regardless of your "
175176
"seed's actual length. If you enter a word incorrectly or "
@@ -183,11 +184,11 @@ def _initialize_device(self, settings, method, device_id, wizard, handler):
183184

184185
if method == TIM_NEW:
185186
strength = 64 * (item + 2) # 128, 192 or 256
186-
args = [True, strength, passphrase_protection,
187-
pin_protection, label, language]
188-
if self.device == 'TREZOR':
189-
args.extend([0, False]) # u2f_counter, skip_backup
190-
client.reset_device(*args)
187+
u2f_counter = 0
188+
skip_backup = False
189+
client.reset_device(True, strength, passphrase_protection,
190+
pin_protection, label, language,
191+
u2f_counter, skip_backup)
191192
elif method == TIM_RECOVER:
192193
word_count = 6 * (item + 2) # 12, 18 or 24
193194
client.step = 0

0 commit comments

Comments
 (0)