u2f: show generic icon if specific is not found

pull/25/head
Pavol Rusnak 7 years ago
parent 879a3e85bd
commit 4379f0d031
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -413,10 +413,13 @@ class ConfirmContent(ui.Widget):
icon = ui.ICON_RESET # TODO: warning icon
elif app_id in knownapps.knownapps:
name = knownapps.knownapps[app_id]
icon = res.load('apps/fido_u2f/res/u2f_%s.toif' % name.lower().replace(' ', '_'))
try:
icon = res.load('apps/fido_u2f/res/u2f_%s.toif' % name.lower().replace(' ', '_'))
except:
icon = res.load('apps/fido_u2f/res/u2f_generic.toif')
else:
name = '%s...%s' % (ubinascii.hexlify(app_id[:4]), ubinascii.hexlify(app_id[-4:]))
icon = res.load('apps/fido_u2f/res/u2f_unknown.toif')
icon = res.load('apps/fido_u2f/res/u2f_generic.toif')
self.app_name = name
self.app_icon = icon

@ -10,6 +10,7 @@ knownapps = {
hashlib.sha256(b'https://gitlab.com').digest(): 'GitLab',
hashlib.sha256(b'https://keepersecurity.com').digest(): 'Keeper',
hashlib.sha256(b'https://slushpool.com/static/security/u2f.json').digest(): 'Slush Pool',
hashlib.sha256(b'https://u2f.bin.coffee').digest(): 'u2f.bin.coffee checker',
hashlib.sha256(b'https://vault.bitwarden.com/app-id.json').digest(): 'bitwarden',
hashlib.sha256(b'https://www.bitfinex.com').digest(): 'Bitfinex',
hashlib.sha256(b'https://www.dropbox.com/u2f-app-id.json').digest(): 'Dropbox',

Loading…
Cancel
Save