1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-14 03:30:02 +00:00

feat(core): remove message type from device properties message

This commit is contained in:
M1nd3r 2024-04-27 02:02:21 +02:00
parent ef1b429c62
commit fb99d1dbe6
2 changed files with 14 additions and 3 deletions

View File

@ -2,19 +2,30 @@ from trezor import protobuf
class Message:
def __init__(
self,
message_data: bytes,
) -> None:
self.data = message_data
def to_bytes(self):
return self.data
class MessageWithType(Message):
def __init__(
self,
message_type: int,
message_data: bytes,
) -> None:
self.type = message_type
self.data = message_data
super().__init__(message_data)
def to_bytes(self):
return self.type.to_bytes(2, "big") + self.data
class MessageWithId(Message):
class MessageWithId(MessageWithType):
def __init__(
self,
message_type: int,

View File

@ -60,7 +60,7 @@ _ERROR_UNALLOCATED_SESSION = (
def get_device_properties() -> Message:
return Message(1000, _ENCODED_PROTOBUF_DEVICE_PROPERTIES)
return Message(_ENCODED_PROTOBUF_DEVICE_PROPERTIES)
def get_channel_allocation_response(nonce: bytes, new_cid: int) -> bytes: