1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 04:18:10 +00:00

feat(python): ability to not show passphrase coming from host

[no changelog]
This commit is contained in:
grdddj 2023-02-15 15:43:20 +01:00 committed by Jiří Musil
parent 20d280d7e0
commit 07e51279e2
3 changed files with 19 additions and 0 deletions

View File

@ -337,3 +337,14 @@ passphrase.aliases = {
"enabled": passphrase_on, "enabled": passphrase_on,
"disabled": passphrase_off, "disabled": passphrase_off,
} }
@passphrase.command(name="hide")
@click.argument("hide", type=ChoiceType({"on": True, "off": False}))
@with_client
def hide_passphrase_from_host(client: "TrezorClient", hide: bool) -> str:
"""Enable or disable hiding passphrase coming from host.
This is a developer feature. Use with caution.
"""
return device.apply_settings(client, hide_passphrase_from_host=hide)

View File

@ -43,6 +43,7 @@ def apply_settings(
display_rotation: Optional[int] = None, display_rotation: Optional[int] = None,
safety_checks: Optional[messages.SafetyCheckLevel] = None, safety_checks: Optional[messages.SafetyCheckLevel] = None,
experimental_features: Optional[bool] = None, experimental_features: Optional[bool] = None,
hide_passphrase_from_host: Optional[bool] = None,
) -> "MessageType": ) -> "MessageType":
settings = messages.ApplySettings( settings = messages.ApplySettings(
label=label, label=label,
@ -54,6 +55,7 @@ def apply_settings(
display_rotation=display_rotation, display_rotation=display_rotation,
safety_checks=safety_checks, safety_checks=safety_checks,
experimental_features=experimental_features, experimental_features=experimental_features,
hide_passphrase_from_host=hide_passphrase_from_host,
) )
out = client.call(settings) out = client.call(settings)

View File

@ -3143,6 +3143,7 @@ class Features(protobuf.MessageType):
40: protobuf.Field("experimental_features", "bool", repeated=False, required=False, default=None), 40: protobuf.Field("experimental_features", "bool", repeated=False, required=False, default=None),
41: protobuf.Field("busy", "bool", repeated=False, required=False, default=None), 41: protobuf.Field("busy", "bool", repeated=False, required=False, default=None),
42: protobuf.Field("homescreen_format", "HomescreenFormat", repeated=False, required=False, default=None), 42: protobuf.Field("homescreen_format", "HomescreenFormat", repeated=False, required=False, default=None),
43: protobuf.Field("hide_passphrase_from_host", "bool", repeated=False, required=False, default=None),
} }
def __init__( def __init__(
@ -3188,6 +3189,7 @@ class Features(protobuf.MessageType):
experimental_features: Optional["bool"] = None, experimental_features: Optional["bool"] = None,
busy: Optional["bool"] = None, busy: Optional["bool"] = None,
homescreen_format: Optional["HomescreenFormat"] = None, homescreen_format: Optional["HomescreenFormat"] = None,
hide_passphrase_from_host: Optional["bool"] = None,
) -> None: ) -> None:
self.capabilities: Sequence["Capability"] = capabilities if capabilities is not None else [] self.capabilities: Sequence["Capability"] = capabilities if capabilities is not None else []
self.major_version = major_version self.major_version = major_version
@ -3229,6 +3231,7 @@ class Features(protobuf.MessageType):
self.experimental_features = experimental_features self.experimental_features = experimental_features
self.busy = busy self.busy = busy
self.homescreen_format = homescreen_format self.homescreen_format = homescreen_format
self.hide_passphrase_from_host = hide_passphrase_from_host
class LockDevice(protobuf.MessageType): class LockDevice(protobuf.MessageType):
@ -3266,6 +3269,7 @@ class ApplySettings(protobuf.MessageType):
8: protobuf.Field("passphrase_always_on_device", "bool", repeated=False, required=False, default=None), 8: protobuf.Field("passphrase_always_on_device", "bool", repeated=False, required=False, default=None),
9: protobuf.Field("safety_checks", "SafetyCheckLevel", repeated=False, required=False, default=None), 9: protobuf.Field("safety_checks", "SafetyCheckLevel", repeated=False, required=False, default=None),
10: protobuf.Field("experimental_features", "bool", repeated=False, required=False, default=None), 10: protobuf.Field("experimental_features", "bool", repeated=False, required=False, default=None),
11: protobuf.Field("hide_passphrase_from_host", "bool", repeated=False, required=False, default=None),
} }
def __init__( def __init__(
@ -3281,6 +3285,7 @@ class ApplySettings(protobuf.MessageType):
passphrase_always_on_device: Optional["bool"] = None, passphrase_always_on_device: Optional["bool"] = None,
safety_checks: Optional["SafetyCheckLevel"] = None, safety_checks: Optional["SafetyCheckLevel"] = None,
experimental_features: Optional["bool"] = None, experimental_features: Optional["bool"] = None,
hide_passphrase_from_host: Optional["bool"] = None,
) -> None: ) -> None:
self.language = language self.language = language
self.label = label self.label = label
@ -3292,6 +3297,7 @@ class ApplySettings(protobuf.MessageType):
self.passphrase_always_on_device = passphrase_always_on_device self.passphrase_always_on_device = passphrase_always_on_device
self.safety_checks = safety_checks self.safety_checks = safety_checks
self.experimental_features = experimental_features self.experimental_features = experimental_features
self.hide_passphrase_from_host = hide_passphrase_from_host
class ApplyFlags(protobuf.MessageType): class ApplyFlags(protobuf.MessageType):