From 809b30ddcfc65e7da5f2f7291b50f13632e0a388 Mon Sep 17 00:00:00 2001 From: Tomas Susanka Date: Wed, 30 Oct 2019 14:37:57 +0100 Subject: [PATCH 1/2] core/webauthn: set webauthn interface in its app not in main.py This way the other messages (WebAuthnListResidentCredentials etc.) get registered in device debug build and can be tested. Updates #591 --- core/src/apps/webauthn/__init__.py | 9 ++++++--- core/src/main.py | 6 ++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/core/src/apps/webauthn/__init__.py b/core/src/apps/webauthn/__init__.py index 56e5dc9f4..d86630175 100644 --- a/core/src/apps/webauthn/__init__.py +++ b/core/src/apps/webauthn/__init__.py @@ -1,10 +1,10 @@ -from trezor import io, loop, wire +from trezor import loop, utils, wire from trezor.messages import MessageType from apps.webauthn.fido2 import handle_reports -def boot(iface: io.HID) -> None: +def boot() -> None: wire.add( MessageType.WebAuthnListResidentCredentials, __name__, @@ -18,4 +18,7 @@ def boot(iface: io.HID) -> None: __name__, "remove_resident_credential", ) - loop.schedule(handle_reports(iface)) + if not __debug__ or utils.EMULATOR: + import usb + + loop.schedule(handle_reports(usb.iface_webauthn)) diff --git a/core/src/main.py b/core/src/main.py index de5f0eaf5..b80509ffe 100644 --- a/core/src/main.py +++ b/core/src/main.py @@ -50,8 +50,7 @@ def _boot_default() -> None: if __debug__: import apps.debug if not utils.BITCOIN_ONLY: - if not __debug__ or utils.EMULATOR: - import apps.webauthn + import apps.webauthn # boot applications apps.homescreen.boot() @@ -71,8 +70,7 @@ def _boot_default() -> None: if __debug__: apps.debug.boot() if not utils.BITCOIN_ONLY: - if not __debug__ or utils.EMULATOR: - apps.webauthn.boot(usb.iface_webauthn) + apps.webauthn.boot() # run main event loop and specify which screen is the default from apps.homescreen.homescreen import homescreen From 26e2960532c0e0026083b56cd55a1a116cfa622f Mon Sep 17 00:00:00 2001 From: Tomas Susanka Date: Wed, 30 Oct 2019 15:03:53 +0100 Subject: [PATCH 2/2] core/webauthn: move boot to regular firmware block --- core/src/main.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/src/main.py b/core/src/main.py index b80509ffe..1f13f8ac8 100644 --- a/core/src/main.py +++ b/core/src/main.py @@ -46,11 +46,10 @@ def _boot_default() -> None: import apps.tezos import apps.eos import apps.binance + import apps.webauthn if __debug__: import apps.debug - if not utils.BITCOIN_ONLY: - import apps.webauthn # boot applications apps.homescreen.boot() @@ -67,10 +66,9 @@ def _boot_default() -> None: apps.tezos.boot() apps.eos.boot() apps.binance.boot() + apps.webauthn.boot() if __debug__: apps.debug.boot() - if not utils.BITCOIN_ONLY: - apps.webauthn.boot() # run main event loop and specify which screen is the default from apps.homescreen.homescreen import homescreen