1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-24 07:18:09 +00:00

Allow testing recovery with an initialized device

This commit is contained in:
Roman Zeyde 2017-06-21 17:29:49 +03:00 committed by Pavol Rusnak
parent f50d547ce4
commit 0d76936174
2 changed files with 6 additions and 4 deletions

View File

@ -277,7 +277,7 @@ class Commands(object):
'matrix': types.RecoveryDeviceType_Matrix } 'matrix': types.RecoveryDeviceType_Matrix }
return self.client.recovery_device(args.words, args.passphrase_protection, return self.client.recovery_device(args.words, args.passphrase_protection,
args.pin_protection, args.label, 'english', args.pin_protection, args.label, 'english',
typemap[args.type], args.expand) typemap[args.type], args.expand, args.dry_run)
def load_device(self, args): def load_device(self, args):
if not args.mnemonic and not args.xprv: if not args.mnemonic and not args.xprv:
@ -474,6 +474,7 @@ class Commands(object):
(('-r', '--passphrase-protection'), {'action': 'store_true', 'default': False}), (('-r', '--passphrase-protection'), {'action': 'store_true', 'default': False}),
(('-l', '--label'), {'type': str, 'default': ''}), (('-l', '--label'), {'type': str, 'default': ''}),
(('-t', '--type'), {'type': str, 'choices': ['scrambled', 'matrix'], 'default': 'scrambled'}), (('-t', '--type'), {'type': str, 'choices': ['scrambled', 'matrix'], 'default': 'scrambled'}),
(('-d', '--dry-run'), {'action': 'store_true', 'default': False}),
) )
load_device.arguments = ( load_device.arguments = (

View File

@ -830,8 +830,8 @@ class ProtocolMixin(object):
@field('message') @field('message')
@expect(proto.Success) @expect(proto.Success)
def recovery_device(self, word_count, passphrase_protection, pin_protection, label, language, type=types.RecoveryDeviceType_ScrambledWords, expand=False): def recovery_device(self, word_count, passphrase_protection, pin_protection, label, language, type=types.RecoveryDeviceType_ScrambledWords, expand=False, dry_run=False):
if self.features.initialized: if self.features.initialized and not dry_run:
raise Exception("Device is initialized already. Call wipe_device() and try again.") raise Exception("Device is initialized already. Call wipe_device() and try again.")
if word_count not in (12, 18, 24): if word_count not in (12, 18, 24):
@ -850,7 +850,8 @@ class ProtocolMixin(object):
label=label, label=label,
language=language, language=language,
enforce_wordlist=True, enforce_wordlist=True,
type=type)) type=type,
dry_run=dry_run))
self.init_device() self.init_device()
return res return res