Show "Not Initialized" for unintialized devices

This commit is contained in:
Andrew Chow 2018-12-29 00:10:51 -05:00
parent 88349f2717
commit 176e808fcc
3 changed files with 18 additions and 6 deletions

View File

@ -424,8 +424,14 @@ def enumerate(password=''):
try:
client = DigitalbitboxClient(path, password)
master_xpub = client.get_pubkey_at_path('m/0h')['xpub']
d_data['fingerprint'] = get_xpub_fingerprint_hex(master_xpub)
# Check initialized
reply = send_encrypt('{"device" : "info"}', password, client.device)
if 'error' in reply and reply['error']['code'] == 101:
d_data['error'] = 'Not initialized'
else:
master_xpub = client.get_pubkey_at_path('m/0h')['xpub']
d_data['fingerprint'] = get_xpub_fingerprint_hex(master_xpub)
client.close()
except Exception as e:
d_data['error'] = "Could not open client or get fingerprint information: " + str(e)

View File

@ -219,8 +219,11 @@ def enumerate(password=''):
try:
client = KeepkeyClient(path, password)
master_xpub = client.get_pubkey_at_path('m/0h')['xpub']
d_data['fingerprint'] = get_xpub_fingerprint_hex(master_xpub)
if client.client.features.initialized:
master_xpub = client.get_pubkey_at_path('m/0h')['xpub']
d_data['fingerprint'] = get_xpub_fingerprint_hex(master_xpub)
else:
d_data['error'] = 'Not initialized'
client.close()
except Exception as e:
d_data['error'] = "Could not open client or get fingerprint information: " + str(e)

View File

@ -230,8 +230,11 @@ def enumerate(password=''):
try:
client = TrezorClient(d_data['path'], password)
master_xpub = client.get_pubkey_at_path('m/0h')['xpub']
d_data['fingerprint'] = get_xpub_fingerprint_hex(master_xpub)
if client.client.features.initialized:
master_xpub = client.get_pubkey_at_path('m/0h')['xpub']
d_data['fingerprint'] = get_xpub_fingerprint_hex(master_xpub)
else:
d_data['error'] = 'Not initialized'
client.close()
except Exception as e:
d_data['error'] = "Could not open client or get fingerprint information: " + str(e)