1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-06 14:52:33 +00:00
trezor-firmware/core/src/apps/management/get_next_u2f_counter.py
grdddj 996fec5aae chore(core): delete newlines in strings where they do not delimit useful info
Done so we can use the same strings for both TT and TR

[no changelog]
2023-02-07 12:26:33 +01:00

27 lines
887 B
Python

from typing import TYPE_CHECKING
if TYPE_CHECKING:
from trezor.messages import GetNextU2FCounter, NextU2FCounter
from trezor.wire import Context
async def get_next_u2f_counter(ctx: Context, msg: GetNextU2FCounter) -> NextU2FCounter:
import storage.device as storage_device
from trezor.wire import NotInitialized
from trezor.enums import ButtonRequestType
from trezor.messages import NextU2FCounter
from trezor.ui.layouts import confirm_action
if not storage_device.is_initialized():
raise NotInitialized("Device is not initialized")
await confirm_action(
ctx,
"get_u2f_counter",
"Get next U2F counter",
description="Do you really want to increase and retrieve the U2F counter?",
br_code=ButtonRequestType.ProtectCall,
)
return NextU2FCounter(u2f_counter=storage_device.next_u2f_counter())