|
|
|
@ -1137,12 +1137,13 @@ def request_passphrase_on_host() -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def request_passphrase_on_device(max_len: int) -> str:
|
|
|
|
|
await button_request("passphrase_device", code=ButtonRequestType.PassphraseEntry)
|
|
|
|
|
|
|
|
|
|
keyboard = RustLayout(
|
|
|
|
|
trezorui2.request_passphrase(prompt="Enter passphrase", max_len=max_len)
|
|
|
|
|
result = await interact(
|
|
|
|
|
RustLayout(
|
|
|
|
|
trezorui2.request_passphrase(prompt="Enter passphrase", max_len=max_len)
|
|
|
|
|
),
|
|
|
|
|
"passphrase_device",
|
|
|
|
|
ButtonRequestType.PassphraseEntry,
|
|
|
|
|
)
|
|
|
|
|
result = await ctx_wait(keyboard)
|
|
|
|
|
if result is CANCELLED:
|
|
|
|
|
raise ActionCancelled("Passphrase entry cancelled")
|
|
|
|
|
|
|
|
|
@ -1158,8 +1159,6 @@ async def request_pin_on_device(
|
|
|
|
|
) -> str:
|
|
|
|
|
from trezor.wire import PinCancelled
|
|
|
|
|
|
|
|
|
|
await button_request("pin_device", code=ButtonRequestType.PinEntry)
|
|
|
|
|
|
|
|
|
|
if attempts_remaining is None:
|
|
|
|
|
subprompt = ""
|
|
|
|
|
elif attempts_remaining == 1:
|
|
|
|
@ -1167,15 +1166,18 @@ async def request_pin_on_device(
|
|
|
|
|
else:
|
|
|
|
|
subprompt = f"{attempts_remaining} tries left"
|
|
|
|
|
|
|
|
|
|
dialog = RustLayout(
|
|
|
|
|
trezorui2.request_pin(
|
|
|
|
|
prompt=prompt,
|
|
|
|
|
subprompt=subprompt,
|
|
|
|
|
allow_cancel=allow_cancel,
|
|
|
|
|
wrong_pin=wrong_pin,
|
|
|
|
|
)
|
|
|
|
|
result = await interact(
|
|
|
|
|
RustLayout(
|
|
|
|
|
trezorui2.request_pin(
|
|
|
|
|
prompt=prompt,
|
|
|
|
|
subprompt=subprompt,
|
|
|
|
|
allow_cancel=allow_cancel,
|
|
|
|
|
wrong_pin=wrong_pin,
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
"pin_device",
|
|
|
|
|
ButtonRequestType.PinEntry,
|
|
|
|
|
)
|
|
|
|
|
result = await ctx_wait(dialog)
|
|
|
|
|
if result is CANCELLED:
|
|
|
|
|
raise PinCancelled
|
|
|
|
|
assert isinstance(result, str)
|
|
|
|
|