From d865c0ea31700a1da3842979456710b2c60fddfd Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sun, 16 Jul 2017 14:53:28 +0200 Subject: [PATCH] trezorctl: load_device -s now loads SLIP-0014 mnemonic, --skip-checksum renamed to --ignore-checksum --- trezorctl | 16 ++++++++++++---- trezorlib/client.py | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/trezorctl b/trezorctl index 2aa2e5c89a..15a2dc6d1a 100755 --- a/trezorctl +++ b/trezorctl @@ -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.') diff --git a/trezorlib/client.py b/trezorlib/client.py index 50879d441f..1adae5786d 100644 --- a/trezorlib/client.py +++ b/trezorlib/client.py @@ -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)