diff --git a/python/src/trezorlib/transport/thp/channel_data.py b/python/src/trezorlib/transport/thp/channel_data.py index 461fcac9bf..4d9d11d8d0 100644 --- a/python/src/trezorlib/transport/thp/channel_data.py +++ b/python/src/trezorlib/transport/thp/channel_data.py @@ -29,7 +29,7 @@ class ChannelData: self.nonce_response: int = nonce_response self.sync_bit_receive: int = sync_bit_receive self.sync_bit_send: int = sync_bit_send - self.handshake_hash: bytes = handshake_hash + self.handshake_hash: str = hexlify(handshake_hash).decode() def to_dict(self): return { diff --git a/python/src/trezorlib/transport/thp/channel_database.py b/python/src/trezorlib/transport/thp/channel_database.py index 22b72e2809..03be0f7ece 100644 --- a/python/src/trezorlib/transport/thp/channel_database.py +++ b/python/src/trezorlib/transport/thp/channel_database.py @@ -122,7 +122,7 @@ def dict_to_channel_data(dict: t.Dict) -> ChannelData: nonce_response=dict["nonce_response"], sync_bit_send=dict["sync_bit_send"], sync_bit_receive=dict["sync_bit_receive"], - handshake_hash=dict["handshake_hash"], + handshake_hash=bytes.fromhex(dict["handshake_hash"]), ) diff --git a/python/src/trezorlib/transport/thp/protocol_v2.py b/python/src/trezorlib/transport/thp/protocol_v2.py index 2eaa92d648..17f463d49b 100644 --- a/python/src/trezorlib/transport/thp/protocol_v2.py +++ b/python/src/trezorlib/transport/thp/protocol_v2.py @@ -61,6 +61,7 @@ class ProtocolV2(ProtocolAndChannel): nonce_response: int sync_bit_send: int sync_bit_receive: int + handshake_hash: bytes _has_valid_channel: bool = False _features: messages.Features | None = None @@ -81,7 +82,7 @@ class ProtocolV2(ProtocolAndChannel): self.nonce_response = channel_data.nonce_response self.sync_bit_receive = channel_data.sync_bit_receive self.sync_bit_send = channel_data.sync_bit_send - self.handshake_hash: bytes = b"" + self.handshake_hash = bytes.fromhex(channel_data.handshake_hash) self._has_valid_channel = True def get_channel(self, helper_debug: DebugLink | None = None) -> ProtocolV2: