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

M1nd3r/thp6
M1nd3r 1 month ago
parent ef1b429c62
commit fb99d1dbe6

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

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

Loading…
Cancel
Save