1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-01 18:30:56 +00:00

chore(python): add handshake hash to channelData

[no changelog]
This commit is contained in:
M1nd3r 2025-01-31 14:56:39 +01:00
parent 11029932fb
commit 9203649a62
3 changed files with 4 additions and 3 deletions

View File

@ -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 {

View File

@ -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"]),
)

View File

@ -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: