diff --git a/python/src/trezorlib/ui.py b/python/src/trezorlib/ui.py index 4b4a05ea0..546e780a1 100644 --- a/python/src/trezorlib/ui.py +++ b/python/src/trezorlib/ui.py @@ -15,11 +15,13 @@ # If not, see . import os +from typing import Union import click from mnemonic import Mnemonic +from typing_extensions import Protocol -from . import device +from . import device, messages from .client import MAX_PIN_LENGTH, PASSPHRASE_ON_DEVICE from .exceptions import Cancelled from .messages import PinMatrixRequestType, WordRequestType @@ -53,6 +55,17 @@ WIPE_CODE_NEW = PinMatrixRequestType.WipeCodeFirst WIPE_CODE_CONFIRM = PinMatrixRequestType.WipeCodeSecond +class TrezorClientUI(Protocol): + def button_request(self, br: messages.ButtonRequest) -> None: + ... + + def get_pin(self, code: PinMatrixRequestType) -> str: + ... + + def get_passphrase(self, available_on_device: bool) -> Union[str, object]: + ... + + def echo(*args, **kwargs): return click.echo(*args, err=True, **kwargs)