Add needs_pin_sent to indicate whether promptpin needs to be used

This commit is contained in:
Andrew Chow 2019-04-22 19:34:46 -04:00
parent d2696cfadf
commit bca85354f9
5 changed files with 9 additions and 0 deletions

View File

@ -252,6 +252,7 @@ def enumerate(password=''):
d_data['fingerprint'] = client._get_fingerprint_hex() d_data['fingerprint'] = client._get_fingerprint_hex()
d_data['type'] = 'coldcard' d_data['type'] = 'coldcard'
d_data['path'] = CC_SIMULATOR_SOCK d_data['path'] = CC_SIMULATOR_SOCK
d_data['needs_pin_sent'] = False
d_data['needs_passphrase_sent'] = False d_data['needs_passphrase_sent'] = False
results.append(d_data) results.append(d_data)
except RuntimeError as e: except RuntimeError as e:

View File

@ -603,6 +603,7 @@ def enumerate(password=''):
else: else:
master_xpub = client.get_pubkey_at_path('m/0h')['xpub'] master_xpub = client.get_pubkey_at_path('m/0h')['xpub']
d_data['fingerprint'] = get_xpub_fingerprint_hex(master_xpub) d_data['fingerprint'] = get_xpub_fingerprint_hex(master_xpub)
d_data['needs_pin_sent'] = False
d_data['needs_passphrase_sent'] = True d_data['needs_passphrase_sent'] = True
except HWWError as e: except HWWError as e:
d_data['error'] = "Could not open client or get fingerprint information: " + e.get_msg() d_data['error'] = "Could not open client or get fingerprint information: " + e.get_msg()

View File

@ -26,7 +26,10 @@ def enumerate(password=''):
client.client.init_device() client.client.init_device()
if not 'keepkey' in client.client.features.vendor: if not 'keepkey' in client.client.features.vendor:
continue continue
d_data['needs_pin_sent'] = client.client.features.pin_protection and not client.client.features.pin_cached
d_data['needs_passphrase_sent'] = client.client.features.passphrase_protection and not client.client.features.passphrase_cached d_data['needs_passphrase_sent'] = client.client.features.passphrase_protection and not client.client.features.passphrase_cached
if d_data['needs_pin_sent']:
raise DeviceNotReadyError('Keepkey is locked. Unlock by using \'promptpin\' and then \'sendpin\'.')
if d_data['needs_passphrase_sent'] and not password: if d_data['needs_passphrase_sent'] and not password:
raise DeviceNotReadyError("Passphrase needs to be specified before the fingerprint information can be retrieved") raise DeviceNotReadyError("Passphrase needs to be specified before the fingerprint information can be retrieved")
if client.client.features.initialized: if client.client.features.initialized:

View File

@ -350,6 +350,7 @@ def enumerate(password=''):
client = LedgerClient(path, password) client = LedgerClient(path, password)
master_xpub = client.get_pubkey_at_path('m/0h')['xpub'] master_xpub = client.get_pubkey_at_path('m/0h')['xpub']
d_data['fingerprint'] = get_xpub_fingerprint_hex(master_xpub) d_data['fingerprint'] = get_xpub_fingerprint_hex(master_xpub)
d_data['needs_pin_sent'] = False
d_data['needs_passphrase_sent'] = False d_data['needs_passphrase_sent'] = False
except Exception as e: except Exception as e:
d_data['error'] = "Could not open client or get fingerprint information: " + str(e) d_data['error'] = "Could not open client or get fingerprint information: " + str(e)

View File

@ -421,7 +421,10 @@ def enumerate(password=''):
client.client.init_device() client.client.init_device()
if not 'trezor' in client.client.features.vendor: if not 'trezor' in client.client.features.vendor:
continue continue
d_data['needs_pin_sent'] = client.client.features.pin_protection and not client.client.features.pin_cached
d_data['needs_passphrase_sent'] = client.client.features.passphrase_protection and not client.client.features.passphrase_cached d_data['needs_passphrase_sent'] = client.client.features.passphrase_protection and not client.client.features.passphrase_cached
if d_data['needs_pin_sent']:
raise DeviceNotReadyError('Trezor is locked. Unlock by using \'promptpin\' and then \'sendpin\'.')
if d_data['needs_passphrase_sent'] and not password: if d_data['needs_passphrase_sent'] and not password:
raise DeviceNotReadyError("Passphrase needs to be specified before the fingerprint information can be retrieved") raise DeviceNotReadyError("Passphrase needs to be specified before the fingerprint information can be retrieved")
if client.client.features.initialized: if client.client.features.initialized: