From 25559cc24512d9f755d37480a05ab0b29304019e Mon Sep 17 00:00:00 2001 From: M1nd3r Date: Thu, 28 Nov 2024 18:21:14 +0100 Subject: [PATCH] fix(trezorlib): re-allow usage of passphrases on codec sessions [no changelog] --- python/src/trezorlib/transport/session.py | 7 +++++++ 1 file changed, 7 insertions(+) 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())