diff --git a/python/src/trezorlib/debuglink.py b/python/src/trezorlib/debuglink.py index 27c65d40de..aec80f8d2b 100644 --- a/python/src/trezorlib/debuglink.py +++ b/python/src/trezorlib/debuglink.py @@ -1163,6 +1163,7 @@ class SessionDebugWrapper(Session): self.button_callback = self.client.button_callback self.pin_callback = self.client.pin_callback self.passphrase_callback = self._session.passphrase_callback + self.passphrase = self._session.passphrase def __enter__(self) -> "SessionDebugWrapper": # For usage in with/expected_responses diff --git a/python/src/trezorlib/transport/session.py b/python/src/trezorlib/transport/session.py index 626080f271..a5d8ada5e4 100644 --- a/python/src/trezorlib/transport/session.py +++ b/python/src/trezorlib/transport/session.py @@ -96,7 +96,7 @@ class Session: class SessionV1(Session): @classmethod def new( - cls, client: TrezorClient, passphrase: str | None, derive_cardano: bool + cls, client: TrezorClient, passphrase: str = "", derive_cardano: bool = False ) -> SessionV1: assert isinstance(client.protocol, ProtocolV1) session_id = client.features.session_id @@ -108,6 +108,7 @@ class SessionV1(Session): session.button_callback = client.button_callback session.pin_callback = client.pin_callback session.passphrase_callback = _callback_passphrase + session.passphrase = passphrase session._init_session(derive_cardano=derive_cardano) return session @@ -132,7 +133,7 @@ def _callback_button(session: Session, msg: t.Any) -> t.Any: def _callback_passphrase(session: Session, msg: messages.PassphraseRequest) -> t.Any: - available_on_device = Capability.PassphraseEntry in Session.features.capabilities + available_on_device = Capability.PassphraseEntry in session.features.capabilities def send_passphrase( passphrase: str | None = None, on_device: bool | None = None ) -> t.Any: diff --git a/tests/device_tests/cardano/test_address_public_key.py b/tests/device_tests/cardano/test_address_public_key.py index 95f42ecec1..d8ec9288eb 100644 --- a/tests/device_tests/cardano/test_address_public_key.py +++ b/tests/device_tests/cardano/test_address_public_key.py @@ -96,7 +96,7 @@ def test_cardano_get_address(session: Session, chunkify: bool, parameters, resul ) def test_cardano_get_public_key(session: Session, parameters, result): with session, session.client as client: - IF = InputFlowShowXpubQRCode(client, passphrase=False) + IF = InputFlowShowXpubQRCode(client, passphrase=bool(session.passphrase)) client.set_input_flow(IF.get()) # session.init_device(new_session=True, derive_cardano=True)