You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-firmware/core/src/apps/management/get_next_u2f_counter.py

25 lines
797 B

from typing import TYPE_CHECKING
if TYPE_CHECKING:
from trezor.messages import GetNextU2FCounter, NextU2FCounter
async def get_next_u2f_counter(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(
"get_u2f_counter",
"Get U2F counter",
description="Increase and retrieve the U2F counter?",
br_code=ButtonRequestType.ProtectCall,
)
return NextU2FCounter(u2f_counter=storage_device.next_u2f_counter())