1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00

trezorctl: load_device -s now loads SLIP-0014 mnemonic, --skip-checksum renamed to --ignore-checksum

This commit is contained in:
Pavol Rusnak 2017-07-16 14:53:28 +02:00
parent 23ab43d612
commit d865c0ea31
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 13 additions and 5 deletions

View File

@ -224,10 +224,11 @@ def wipe_device(client):
@click.option('-p', '--pin', default='')
@click.option('-r', '--passphrase-protection', is_flag=True)
@click.option('-l', '--label', default='')
@click.option('-s', '--skip-checksum', is_flag=True)
@click.option('-i', '--ignore-checksum', is_flag=True)
@click.option('-s', '--slip0014', is_flag=True)
@click.pass_obj
def load_device(client, mnemonic, expand, xprv, pin, passphrase_protection, label, skip_checksum):
if not mnemonic and not xprv:
def load_device(client, mnemonic, expand, xprv, pin, passphrase_protection, label, ignore_checksum, slip0014):
if not mnemonic and not xprv and not slip0014:
raise CallException(types.Failure_DataError, 'Please provide mnemonic or xprv')
if mnemonic:
@ -237,7 +238,7 @@ def load_device(client, mnemonic, expand, xprv, pin, passphrase_protection, labe
passphrase_protection,
label,
'english',
skip_checksum,
ignore_checksum,
expand
)
if xprv:
@ -248,6 +249,13 @@ def load_device(client, mnemonic, expand, xprv, pin, passphrase_protection, labe
label,
'english'
)
if slip0014:
return client.load_device_by_mnemonic(
' '.join(['all'] * 12),
pin,
passphrase_protection,
'SLIP-0014'
)
@cli.command(help='Start safe recovery workflow.')

View File

@ -928,7 +928,7 @@ class ProtocolMixin(object):
@field('message')
@expect(proto.Success)
def load_device_by_mnemonic(self, mnemonic, pin, passphrase_protection, label, language, skip_checksum=False, expand=False):
def load_device_by_mnemonic(self, mnemonic, pin, passphrase_protection, label, language='english', skip_checksum=False, expand=False):
# Convert mnemonic to UTF8 NKFD
mnemonic = Mnemonic.normalize_string(mnemonic)