mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-16 11:38:12 +00:00
22 lines
711 B
Python
22 lines
711 B
Python
from trezor import ui, wire
|
|
from trezor.messages import ButtonRequestType
|
|
from trezor.messages.Success import Success
|
|
from trezor.ui.text import Text
|
|
|
|
from apps.common.confirm import require_confirm
|
|
from apps.common.storage import device as storage_device
|
|
|
|
|
|
async def set_u2f_counter(ctx, msg):
|
|
if msg.u2f_counter is None:
|
|
raise wire.ProcessError("No value provided")
|
|
|
|
text = Text("Set U2F counter", ui.ICON_CONFIG)
|
|
text.normal("Do you really want to", "set the U2F counter")
|
|
text.bold("to %d?" % msg.u2f_counter)
|
|
await require_confirm(ctx, text, code=ButtonRequestType.ProtectCall)
|
|
|
|
storage_device.set_u2f_counter(msg.u2f_counter)
|
|
|
|
return Success(message="U2F counter set")
|