1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 20:19:23 +00:00

src/apps/fido_u2f: implement bogus app_id screen

This commit is contained in:
Pavol Rusnak 2018-03-01 01:33:28 +01:00
parent df10f5df3f
commit 7dc207a8df
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -435,7 +435,7 @@ class ConfirmContent(ui.Widget):
header = 'U2F Authenticate'
ui.header(header, ui.ICON_DEFAULT, ui.GREEN, ui.BG, ui.GREEN)
ui.display.image((ui.WIDTH - 64) // 2, 64, self.app_icon)
ui.display.text_center(ui.WIDTH // 2, 176, self.app_name, ui.MONO, ui.FG, ui.BG)
ui.display.text_center(ui.WIDTH // 2, 168, self.app_name, ui.MONO, ui.FG, ui.BG)
_CONFIRM_STATE_TIMEOUT_MS = const(10 * 1000)
@ -472,10 +472,21 @@ class ConfirmState:
@ui.layout
async def confirm_layout(self) -> None:
from trezor.ui.confirm import HoldToConfirmDialog, CONFIRMED
from trezor.ui.text import Text
if bytes(self.app_id) == _BOGUS_APPID:
text = Text(
'U2F mismatch', ui.ICON_WRONG,
'Another U2F device',
'was used to register',
'in this application.',
icon_color=ui.RED)
text.render()
await loop.sleep(3 * 1000 * 1000)
return True
content = ConfirmContent(self.action, self.app_id)
dialog = HoldToConfirmDialog(content)
return await dialog == CONFIRMED