Skip to content

Commit

Permalink
feat(python): Implement DebugLinkOptigaSetSecMax.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewkozlik committed Jul 9, 2024
1 parent b71a809 commit b6b1ad8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions python/.changelog.d/4000.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added ability to set Optiga's security event counter to maximum: `trezorctl debug optiga-set-sec-max`.
8 changes: 8 additions & 0 deletions python/src/trezorlib/cli/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from .. import mapping, messages, protobuf
from ..client import TrezorClient
from ..debuglink import TrezorClientDebugLink
from ..debuglink import optiga_set_sec_max as debuglink_optiga_set_sec_max
from ..debuglink import prodtest_t1 as debuglink_prodtest_t1
from ..debuglink import record_screen
from . import with_client
Expand Down Expand Up @@ -112,3 +113,10 @@ def prodtest_t1(client: "TrezorClient") -> str:
Only available on PRODTEST firmware and on T1B1. Formerly named self-test.
"""
return debuglink_prodtest_t1(client)


@cli.command()
@with_client
def optiga_set_sec_max(client: "TrezorClient") -> str:
"""Set Optiga's security event counter to maximum."""
return debuglink_optiga_set_sec_max(client)
5 changes: 5 additions & 0 deletions python/src/trezorlib/debuglink.py
Original file line number Diff line number Diff line change
Expand Up @@ -1362,3 +1362,8 @@ def get_session_screenshot_dir(directory: Path) -> Path:
def _is_emulator(debug_client: "TrezorClientDebugLink") -> bool:
"""Check if we are connected to emulator, in contrast to hardware device."""
return debug_client.features.fw_vendor == "EMULATOR"


@expect(messages.Success, field="message", ret_type=str)
def optiga_set_sec_max(client: "TrezorClient") -> protobuf.MessageType:
return client.call(messages.DebugLinkOptigaSetSecMax())

0 comments on commit b6b1ad8

Please sign in to comment.