1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-13 01:58:08 +00:00
trezor-firmware/core/src/trezor/ui/layouts/tt/webauthn.py
grdddj 9fc5bb546b style(core): full pyright-based type-checking
Changes many fields to required -- as far as we were able to figure out,
signing would fail if these fields aren't provided anyway, so this
should not pose a compatibility problem.

Co-authored-by: matejcik <ja@matejcik.cz>
2022-01-07 21:41:17 +01:00

35 lines
1.1 KiB
Python

from trezor import ui, wire
from trezor.enums import ButtonRequestType
from ...components.common.confirm import is_confirmed
from ...components.common.webauthn import ConfirmInfo
from ...components.tt.confirm import Confirm, ConfirmPageable, Pageable
from ...components.tt.text import Text
from ...components.tt.webauthn import ConfirmContent
from ..common import interact
async def confirm_webauthn(
ctx: wire.GenericContext | None,
info: ConfirmInfo,
pageable: Pageable | None = None,
) -> bool:
if pageable is not None:
confirm: ui.Layout = ConfirmPageable(pageable, ConfirmContent(info))
else:
confirm = Confirm(ConfirmContent(info))
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:
text = Text("FIDO2 Reset", ui.ICON_CONFIG)
text.normal("Do you really want to")
text.bold("erase all credentials?")
return is_confirmed(await Confirm(text))