diff --git a/python/src/trezorlib/transport/session.py b/python/src/trezorlib/transport/session.py index 7ba6535801..1d0948ddf5 100644 --- a/python/src/trezorlib/transport/session.py +++ b/python/src/trezorlib/transport/session.py @@ -154,9 +154,16 @@ class SessionV1(Session): resp: messages.Features = self.call_raw( messages.Initialize(session_id=session_id, derive_cardano=derive_cardano) ) + if isinstance(self.passphrase, str): + self.passphrase_callback = _send_passphrase self._id = resp.session_id +def _send_passphrase(session: Session, resp: t.Any) -> None: + assert isinstance(session.passphrase, str) + return session.call(messages.PassphraseAck(passphrase=session.passphrase)) + + def _callback_button(session: Session, msg: t.Any) -> t.Any: print("Please confirm action on your Trezor device.") # TODO how to handle UI? return session.call(messages.ButtonAck())