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

python: rename unsafe_prompts to safety_checks

This commit is contained in:
matejcik 2020-08-05 15:51:53 +02:00
parent a94c0d074d
commit 35c3af87dd
3 changed files with 15 additions and 14 deletions

View File

@ -11,7 +11,7 @@ _At the moment, the project does **not** adhere to [Semantic Versioning](https:/
### Added ### Added
- `trezorctl set unsafe-prompts` controls the new "unsafe prompts" feature. [#1126] - `trezorctl set safety-checks` controls the new "safety checks" feature. [#1126]
- `trezorctl btc get-address` can create multisig addresses. - `trezorctl btc get-address` can create multisig addresses.
- the following commands are now equivalent in trezorctl: `firmware-update`, `firmware-upgrade`, - the following commands are now equivalent in trezorctl: `firmware-update`, `firmware-upgrade`,
`update-firmware`, `upgrade-firmware` `update-firmware`, `upgrade-firmware`

View File

@ -383,7 +383,7 @@ Device settings.
label Set new device label. label Set new device label.
passphrase Enable, disable or configure passphrase protection. passphrase Enable, disable or configure passphrase protection.
pin Set, change or remove PIN. pin Set, change or remove PIN.
unsafe-prompts Allow or disallow unsafe prompts. safety-checks Set safety check level.
wipe-code Set or remove the wipe code. wipe-code Set or remove the wipe code.
Stellar commands. Stellar commands.

View File

@ -20,6 +20,10 @@ from .. import device, messages
from . import ChoiceType, with_client from . import ChoiceType, with_client
ROTATION = {"north": 0, "east": 90, "south": 180, "west": 270} ROTATION = {"north": 0, "east": 90, "south": 180, "west": 270}
SAFETY_LEVELS = {
"strict": messages.SafetyCheckLevel.Strict,
"prompt": messages.SafetyCheckLevel.Prompt,
}
@click.group(name="set") @click.group(name="set")
@ -136,21 +140,18 @@ def homescreen(client, filename):
@cli.command() @cli.command()
@click.argument("allow", type=click.Choice(("on", "off"))) @click.argument("level", type=ChoiceType(SAFETY_LEVELS))
@with_client @with_client
def unsafe_prompts(client, allow): def safety_checks(client, level):
"""Allow or disallow unsafe prompts. """Set safety check level.
This is a power-user feature. With unsafe prompts enabled, Trezor will ask the user Set to "strict" to get the full Trezor security.
to confirm possibly dangerous actions instead of rejecting them outright.
Use with caution. Set to "prompt" if you want to be able to allow potentially unsafe actions, such as
mismatching coin keys or extreme fees.
This is a power-user feature. Use with caution.
""" """
# TODO change this to ChoiceType
if allow == "on":
level = messages.SafetyCheckLevel.Prompt
else:
level = messages.SafetyCheckLevel.Strict
return device.apply_settings(client, safety_checks=level) return device.apply_settings(client, safety_checks=level)