1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-13 17:00:59 +00:00

src/apps: rename fido_u2f app to webauthn app

add more WebAuthn facets
This commit is contained in:
Pavol Rusnak 2019-03-09 14:55:08 +01:00
parent 4c59b02d90
commit e02ab996a0
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
37 changed files with 49 additions and 40 deletions

View File

@ -1,7 +1,7 @@
with import <nixpkgs> {}; with import <nixpkgs> {};
let let
myPython = python3.withPackages(ps: [ps.trezor ps.pytest ps.flake8 ps.isort ps.black ps.Mako ps.munch ps.Pyro4]); myPython = python3.withPackages(ps: [ps.trezor ps.pytest ps.flake8 ps.isort ps.black ps.Mako ps.munch ps.Pyro4 ps.pillow]);
in in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "trezor-core-dev"; name = "trezor-core-dev";

View File

@ -1,25 +0,0 @@
from trezor.crypto import hashlib
knownapps = {
hashlib.sha256(
b"https://account.gandi.net/api/u2f/trusted_facets.json"
).digest(): "Gandi",
hashlib.sha256(b"https://api-9dcf9b83.duosecurity.com").digest(): "Duo",
hashlib.sha256(b"https://bitbucket.org").digest(): "Bitbucket",
hashlib.sha256(b"https://dashboard.stripe.com").digest(): "Stripe",
hashlib.sha256(b"https://demo.yubico.com").digest(): "Yubico U2F Demo",
hashlib.sha256(b"https://github.com/u2f/trusted_facets").digest(): "GitHub",
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",
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",
hashlib.sha256(b"https://www.fastmail.com").digest(): "FastMail",
hashlib.sha256(
b"https://www.gstatic.com/securitykey/origins.json"
).digest(): "Google",
}

Binary file not shown.

Binary file not shown.

View File

@ -379,8 +379,8 @@ class ConfirmState:
@ui.layout @ui.layout
async def confirm_layout(self) -> None: async def confirm_layout(self) -> None:
workflow.fido_u2f_stop_signal.reset() workflow.webauthn_stop_signal.reset()
await loop.spawn(self.confirm_layout_inner(), workflow.fido_u2f_stop_signal) await loop.spawn(self.confirm_layout_inner(), workflow.webauthn_stop_signal)
async def confirm_layout_inner(self) -> None: async def confirm_layout_inner(self) -> None:
from trezor.ui.confirm import ConfirmDialog, CONFIRMED from trezor.ui.confirm import ConfirmDialog, CONFIRMED
@ -413,15 +413,15 @@ class ConfirmContent(ui.Widget):
def boot(self) -> None: def boot(self) -> None:
from ubinascii import hexlify from ubinascii import hexlify
from trezor import res from trezor import res
from apps.fido_u2f import knownapps from apps.webauthn import knownapps
if self.app_id in knownapps.knownapps: if self.app_id in knownapps.knownapps:
name = knownapps.knownapps[self.app_id] name = knownapps.knownapps[self.app_id]
try: try:
namepart = name.lower().replace(" ", "_") namepart = name.lower().replace(" ", "_")
icon = res.load("apps/fido_u2f/res/u2f_%s.toif" % namepart) icon = res.load("apps/webauthn/res/icon_%s.toif" % namepart)
except Exception as e: except Exception as e:
icon = res.load("apps/fido_u2f/res/u2f_generic.toif") icon = res.load("apps/webauthn/res/icon_generic.toif")
if __debug__: if __debug__:
log.exception(__name__, e) log.exception(__name__, e)
else: else:
@ -429,7 +429,7 @@ class ConfirmContent(ui.Widget):
hexlify(self.app_id[:4]).decode(), hexlify(self.app_id[:4]).decode(),
hexlify(self.app_id[-4:]).decode(), hexlify(self.app_id[-4:]).decode(),
) )
icon = res.load("apps/fido_u2f/res/u2f_generic.toif") icon = res.load("apps/webauthn/res/icon_generic.toif")
self.app_name = name self.app_name = name
self.app_icon = icon self.app_icon = icon

View File

@ -0,0 +1,34 @@
from trezor.crypto.hashlib import sha256
# contents generated via script in
# trezor-common/defs/webauthn/gen.py
# do not edit manually
_knownapps = {
# U2F
"https://bitbucket.org": "Bitbucket",
"https://www.bitfinex.com": "Bitfinex",
"https://vault.bitwarden.com/app-id.json": "Bitwarden",
"https://www.dashlane.com": "Dashlane",
"https://www.dropbox.com/u2f-app-id.json": "Dropbox",
"https://api-9dcf9b83.duosecurity.com": "Duo",
"https://www.fastmail.com": "FastMail",
"https://id.fedoraproject.org/u2f-origins.json": "Fedora",
"https://account.gandi.net/api/u2f/trusted_facets.json": "Gandi",
"https://github.com/u2f/trusted_facets": "GitHub",
"https://gitlab.com": "GitLab",
"https://www.gstatic.com/securitykey/origins.json": "Google",
"https://keepersecurity.com": "Keeper",
"https://lastpass.com": "LastPass",
"https://slushpool.com/static/security/u2f.json": "Slush Pool",
"https://dashboard.stripe.com": "Stripe",
"https://u2f.bin.coffee": "u2f.bin.coffee",
# WebAuthn
"www.dropbox.com": "Dropbox",
"webauthn.bin.coffee": "webauthn.bin.coffee",
"webauthn.io": "WebAuthn.io",
"webauthn.me": "WebAuthn.me",
"demo.yubico.com": "demo.yubico.com",
}
knownapps = {sha256(k).digest(): v for (k, v) in _knownapps.items()}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -24,7 +24,7 @@ import apps.tezos
if __debug__: if __debug__:
import apps.debug import apps.debug
else: else:
import apps.fido_u2f import apps.webauthn
# boot applications # boot applications
apps.homescreen.boot() apps.homescreen.boot()
@ -41,7 +41,7 @@ apps.tezos.boot()
if __debug__: if __debug__:
apps.debug.boot() apps.debug.boot()
else: else:
apps.fido_u2f.boot(usb.iface_u2f) apps.webauthn.boot(usb.iface_webauthn)
# initialize the wire codec and start the USB # initialize the wire codec and start the USB
wire.setup(usb.iface_wire) wire.setup(usb.iface_wire)

View File

@ -5,8 +5,8 @@ layouts = []
default = None default = None
default_layout = None default_layout = None
# HACK: workaround way to stop the u2f layout from the outside # HACK: workaround way to stop the WebAuthn layout from the outside
fido_u2f_stop_signal = loop.signal() webauthn_stop_signal = loop.signal()
def onstart(w): def onstart(w):
@ -47,7 +47,7 @@ def restartdefault():
def onlayoutstart(l): def onlayoutstart(l):
closedefault() closedefault()
layouts.append(l) layouts.append(l)
fido_u2f_stop_signal.send(None) webauthn_stop_signal.send(None)
def onlayoutclose(l): def onlayoutclose(l):

View File

@ -12,7 +12,7 @@ iface_wire = io.WebUSB(
) )
# as the iface_vcp inteface needs 3 endpoints, we cannot use it simultaneously # as the iface_vcp inteface needs 3 endpoints, we cannot use it simultaneously
# with the iface_u2f inteface. # with the iface_webauthn inteface.
if __debug__: if __debug__:
# interface used for debug messages with trezor wire protocol # interface used for debug messages with trezor wire protocol
iface_debug = io.WebUSB( iface_debug = io.WebUSB(
@ -30,7 +30,7 @@ if __debug__:
) )
else: else:
# interface used for FIDO U2F HID transport # interface used for FIDO U2F HID transport
iface_u2f = io.HID( iface_webauthn = io.HID(
iface_num=1, iface_num=1,
ep_in=0x82, ep_in=0x82,
ep_out=0x02, ep_out=0x02,
@ -69,4 +69,4 @@ if __debug__:
bus.add(iface_debug) bus.add(iface_debug)
bus.add(iface_vcp) bus.add(iface_vcp)
else: else:
bus.add(iface_u2f) bus.add(iface_webauthn)