diff --git a/core/src/trezor/ui/layouts/tt_v2/__init__.py b/core/src/trezor/ui/layouts/tt_v2/__init__.py index 1ee11763d8..99007d278a 100644 --- a/core/src/trezor/ui/layouts/tt_v2/__init__.py +++ b/core/src/trezor/ui/layouts/tt_v2/__init__.py @@ -170,7 +170,7 @@ class _RustLayout(ui.Layout): async def raise_if_not_confirmed(a: Awaitable[T], exc: Any = ActionCancelled) -> T: result = await a - if result is not trezorui2.CONFIRMED: + if result is not CONFIRMED: raise exc return result @@ -614,15 +614,15 @@ async def confirm_blob( ) -def confirm_address( +async def confirm_address( ctx: GenericContext, title: str, address: str, description: str | None = "Address:", br_type: str = "confirm_address", br_code: ButtonRequestType = BR_TYPE_OTHER, -) -> Awaitable[None]: - return confirm_value( +) -> None: + return await confirm_value( ctx, title, address, diff --git a/core/src/trezor/ui/layouts/tt_v2/webauthn.py b/core/src/trezor/ui/layouts/tt_v2/webauthn.py index 4a0e09eaec..d70caa09fb 100644 --- a/core/src/trezor/ui/layouts/tt_v2/webauthn.py +++ b/core/src/trezor/ui/layouts/tt_v2/webauthn.py @@ -1,6 +1,13 @@ from typing import TYPE_CHECKING +from trezor.enums import ButtonRequestType + +import trezorui2 + +from ...components.common.confirm import is_confirmed from ...components.common.webauthn import ConfirmInfo +from ..common import interact +from . import _RustLayout if TYPE_CHECKING: from trezor.wire import GenericContext @@ -13,8 +20,30 @@ async def confirm_webauthn( info: ConfirmInfo, pageable: Pageable | None = None, ) -> bool: - raise NotImplementedError + if pageable is not None: + raise NotImplementedError + + confirm = _RustLayout( + trezorui2.confirm_blob( + title=info.get_header().upper(), + data=f"{info.app_name()}\n{info.account_name()}", + ) + ) + + if ctx is None: + return is_confirmed(await confirm) + else: + return is_confirmed( + await interact(ctx, confirm, "confirm_webauthn", ButtonRequestType.Other) + ) async def confirm_webauthn_reset() -> bool: - raise NotImplementedError + return is_confirmed( + await _RustLayout( + trezorui2.confirm_blob( + title="FIDO2 RESET", + data="Do you really want to\nerase all credentials?", + ) + ) + )