1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

common/fido: change FIDO icon checking logic

This commit is contained in:
matejcik 2019-12-09 15:23:06 +01:00 committed by matejcik
parent ac6e23fb87
commit 6225fa6193
7 changed files with 26 additions and 18 deletions

View File

@ -7,12 +7,14 @@ This directory hosts JSON definitions of recognized coins, tokens, and FIDO/U2F
The [`fido/`](fido) subdirectory contains definitons of apps whose logos and
names are shown on Trezor T screen for FIDO/U2F authentication.
Each app must have a single JSON file in the `fido/` subdirectory, and a corresponding
PNG image with the same name. The PNG must be 128x128 pixels RGBA.
Each app must have a single JSON file in the `fido/` subdirectory. Every app must have
its `label` set to the user-recognizable application name. The `u2f` field is a list of
U2F origin hashes, and the `webauthn` field is a list of FIDO2/WebAuthn hostnames for
the app. At least one must be present.
Every app must have its `label` set to the user-recognizable application name. The `u2f`
field is a list of U2F origin hashes, and the `webauthn` field is a list of
FIDO2/WebAuthn hostnames for the app. At least one must be present.
Each app can have an icon. If present, it must be a 128x128 pixels RGBA PNG of the same
name as the corresponding JSON name. If the app does not have an icon, it must instead
have a field `no_icon` set to `true` in the JSON.
## Coins

View File

@ -1,5 +1,5 @@
{
"label": "u2f.bin.coffee",
"u2f": ["1b3c16dd2f7c46e2b4c289dc16746bcc60dfcf0fb818e13215526e1408e7f468"],
"demo": true
"no_icon": true
}

View File

@ -1,5 +1,5 @@
{
"label": "webauthn.bin.coffee",
"webauthn": ["webauthn.bin.coffee"],
"demo": true
"no_icon": true
}

View File

@ -1,5 +1,5 @@
{
"label": "WebAuthn.io",
"webauthn": ["webauthn.io"],
"demo": true
"no_icon": true
}

View File

@ -1,5 +1,5 @@
{
"label": "WebAuthn.me",
"webauthn": ["webauthn.me"],
"demo": true
"no_icon": true
}

View File

@ -1,5 +1,5 @@
{
"label": "demo.yubico.com",
"webauthn": ["demo.yubico.com"],
"demo": true
"no_icon": true
}

View File

@ -477,7 +477,7 @@ def check_segwit(coins):
FIDO_KNOWN_KEYS = frozenset(
("key", "u2f", "webauthn", "label", "use_sign_count", "demo", "icon")
("key", "u2f", "webauthn", "label", "use_sign_count", "no_icon", "icon")
)
@ -514,18 +514,23 @@ def check_fido(apps):
# check icons
if app["icon"] is None:
if app.get("demo"):
log_level = logging.WARNING
else:
log_level = logging.ERROR
check_passed = False
print_log(log_level, app["key"], ": missing icon")
if app.get("no_icon"):
continue
print_log(logging.ERROR, app["key"], ": missing icon")
check_passed = False
continue
elif app.get("no_icon"):
print_log(logging.ERROR, app["key"], ": icon present for 'no_icon' app")
check_passed = False
try:
icon = Image.open(app["icon"])
except Exception:
print_log(log_level, app["key"], ": failed to open icon file", app["icon"])
print_log(
logging.ERROR, app["key"], ": failed to open icon file", app["icon"]
)
check_passed = False
continue
@ -534,6 +539,7 @@ def check_fido(apps):
logging.ERROR, app["key"], ": bad icon format (must be RGBA 128x128)"
)
check_passed = False
return check_passed