mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-08-01 19:38:33 +00:00
core/management: get next u2f counter
This commit is contained in:
parent
2a20287882
commit
a8b82975a1
@ -14,4 +14,5 @@ def boot() -> None:
|
|||||||
wire.add(MessageType.ApplyFlags, __name__, "apply_flags")
|
wire.add(MessageType.ApplyFlags, __name__, "apply_flags")
|
||||||
wire.add(MessageType.ChangePin, __name__, "change_pin")
|
wire.add(MessageType.ChangePin, __name__, "change_pin")
|
||||||
wire.add(MessageType.SetU2FCounter, __name__, "set_u2f_counter")
|
wire.add(MessageType.SetU2FCounter, __name__, "set_u2f_counter")
|
||||||
|
wire.add(MessageType.GetNextU2FCounter, __name__, "get_next_u2f_counter")
|
||||||
wire.add(MessageType.SdProtect, __name__, "sd_protect")
|
wire.add(MessageType.SdProtect, __name__, "sd_protect")
|
||||||
|
20
core/src/apps/management/get_next_u2f_counter.py
Normal file
20
core/src/apps/management/get_next_u2f_counter.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import storage.device
|
||||||
|
from trezor import ui, wire
|
||||||
|
from trezor.messages import ButtonRequestType
|
||||||
|
from trezor.messages.GetNextU2FCounter import GetNextU2FCounter
|
||||||
|
from trezor.messages.NextU2FCounter import NextU2FCounter
|
||||||
|
from trezor.ui.text import Text
|
||||||
|
|
||||||
|
from apps.common.confirm import require_confirm
|
||||||
|
|
||||||
|
|
||||||
|
async def get_next_u2f_counter(
|
||||||
|
ctx: wire.Context, msg: GetNextU2FCounter
|
||||||
|
) -> NextU2FCounter:
|
||||||
|
text = Text("Get next U2F counter", ui.ICON_CONFIG)
|
||||||
|
text.normal("Do you really want to")
|
||||||
|
text.bold("increase and retrieve")
|
||||||
|
text.normal("the U2F counter?")
|
||||||
|
await require_confirm(ctx, text, code=ButtonRequestType.ProtectCall)
|
||||||
|
|
||||||
|
return NextU2FCounter(storage.device.next_u2f_counter())
|
@ -1,13 +1,14 @@
|
|||||||
import storage.device
|
import storage.device
|
||||||
from trezor import ui, wire
|
from trezor import ui, wire
|
||||||
from trezor.messages import ButtonRequestType
|
from trezor.messages import ButtonRequestType
|
||||||
|
from trezor.messages.SetU2FCounter import SetU2FCounter
|
||||||
from trezor.messages.Success import Success
|
from trezor.messages.Success import Success
|
||||||
from trezor.ui.text import Text
|
from trezor.ui.text import Text
|
||||||
|
|
||||||
from apps.common.confirm import require_confirm
|
from apps.common.confirm import require_confirm
|
||||||
|
|
||||||
|
|
||||||
async def set_u2f_counter(ctx, msg):
|
async def set_u2f_counter(ctx: wire.Context, msg: SetU2FCounter) -> Success:
|
||||||
if msg.u2f_counter is None:
|
if msg.u2f_counter is None:
|
||||||
raise wire.ProcessError("No value provided")
|
raise wire.ProcessError("No value provided")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user