diff --git a/common/protob/messages-common.proto b/common/protob/messages-common.proto index 892258bb1..71f78f20c 100644 --- a/common/protob/messages-common.proto +++ b/common/protob/messages-common.proto @@ -111,19 +111,36 @@ message PinMatrixAck { * @next PassphraseAck */ message PassphraseRequest { -// optional bool on_device = 1; // DEPRECATED + optional bool _on_device = 1 [deprecated=true]; // <2.3.0 } /** * Request: Send passphrase back * @auxend */ -message PassphraseAck { + message PassphraseAck { optional string passphrase = 1; -// optional bytes state = 2; // DEPRECATED + optional bytes _state = 2 [deprecated=true]; // <2.3.0 optional bool on_device = 3; // user wants to enter passphrase on the device } +/** + * Response: Device awaits passphrase state + * Deprecated in 2.3.0 + * @next Deprecated_PassphraseStateAck + */ +message Deprecated_PassphraseStateRequest { + optional bytes state = 1; // actual device state +} + +/** +* Request: Send passphrase state back +* Deprecated in 2.3.0 + * @auxend + */ +message Deprecated_PassphraseStateAck { +} + /** * Structure representing BIP32 (hierarchical deterministic) node * Used for imports of private key into the device and exporting public key out of device diff --git a/common/protob/messages-management.proto b/common/protob/messages-management.proto index d35e6e09a..be936f60f 100644 --- a/common/protob/messages-management.proto +++ b/common/protob/messages-management.proto @@ -20,7 +20,7 @@ enum BackupType { * @next Features */ message Initialize { - optional bytes session_id = 3; // assumed device session id; Trezor clears caches if it is different or empty + optional bytes session_id = 1; // assumed device session id; Trezor clears caches if it is different or empty } /** diff --git a/common/protob/messages.proto b/common/protob/messages.proto index 2d973010b..e89f3facd 100644 --- a/common/protob/messages.proto +++ b/common/protob/messages.proto @@ -54,8 +54,6 @@ enum MessageType { MessageType_EntropyAck = 36 [(wire_in) = true]; MessageType_PassphraseRequest = 41 [(wire_out) = true]; MessageType_PassphraseAck = 42 [(wire_in) = true, (wire_tiny) = true, (wire_no_fsm) = true]; -// PassphraseStateRequest = 77 DEPRECATED -// PassphraseStateAck = 78 DEPRECATED MessageType_RecoveryDevice = 45 [(wire_in) = true]; MessageType_WordRequest = 46 [(wire_out) = true]; MessageType_WordAck = 47 [(wire_in) = true]; @@ -66,6 +64,11 @@ enum MessageType { MessageType_NextU2FCounter = 81 [(wire_out) = true]; MessageType_ChangeWipeCode = 82 [(wire_in) = true]; + // Deprecated messages, kept for protobuf compatibility. + // Both are marked wire_out so that we don't need to implement incoming handler for legacy + MessageType_Deprecated_PassphraseStateRequest = 77 [(wire_out) = true]; + MessageType_Deprecated_PassphraseStateAck = 78 [(wire_out) = true]; + // Bootloader MessageType_FirmwareErase = 6 [(wire_in) = true, (wire_bootloader) = true]; MessageType_FirmwareUpload = 7 [(wire_in) = true, (wire_bootloader) = true]; diff --git a/core/src/trezor/messages/Deprecated_PassphraseStateAck.py b/core/src/trezor/messages/Deprecated_PassphraseStateAck.py new file mode 100644 index 000000000..5bd97159e --- /dev/null +++ b/core/src/trezor/messages/Deprecated_PassphraseStateAck.py @@ -0,0 +1,14 @@ +# Automatically generated by pb2py +# fmt: off +import protobuf as p + +if __debug__: + try: + from typing import Dict, List # noqa: F401 + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass + + +class Deprecated_PassphraseStateAck(p.MessageType): + MESSAGE_WIRE_TYPE = 78 diff --git a/core/src/trezor/messages/Deprecated_PassphraseStateRequest.py b/core/src/trezor/messages/Deprecated_PassphraseStateRequest.py new file mode 100644 index 000000000..3699eab13 --- /dev/null +++ b/core/src/trezor/messages/Deprecated_PassphraseStateRequest.py @@ -0,0 +1,26 @@ +# Automatically generated by pb2py +# fmt: off +import protobuf as p + +if __debug__: + try: + from typing import Dict, List # noqa: F401 + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass + + +class Deprecated_PassphraseStateRequest(p.MessageType): + MESSAGE_WIRE_TYPE = 77 + + def __init__( + self, + state: bytes = None, + ) -> None: + self.state = state + + @classmethod + def get_fields(cls) -> Dict: + return { + 1: ('state', p.BytesType, 0), + } diff --git a/core/src/trezor/messages/Initialize.py b/core/src/trezor/messages/Initialize.py index 2bab78b46..73dd3fdc9 100644 --- a/core/src/trezor/messages/Initialize.py +++ b/core/src/trezor/messages/Initialize.py @@ -22,5 +22,5 @@ class Initialize(p.MessageType): @classmethod def get_fields(cls) -> Dict: return { - 3: ('session_id', p.BytesType, 0), + 1: ('session_id', p.BytesType, 0), } diff --git a/core/src/trezor/messages/MessageType.py b/core/src/trezor/messages/MessageType.py index e6f5426e1..e8c1836a5 100644 --- a/core/src/trezor/messages/MessageType.py +++ b/core/src/trezor/messages/MessageType.py @@ -38,6 +38,8 @@ SdProtect = 79 # type: Literal[79] GetNextU2FCounter = 80 # type: Literal[80] NextU2FCounter = 81 # type: Literal[81] ChangeWipeCode = 82 # type: Literal[82] +Deprecated_PassphraseStateRequest = 77 # type: Literal[77] +Deprecated_PassphraseStateAck = 78 # type: Literal[78] FirmwareErase = 6 # type: Literal[6] FirmwareUpload = 7 # type: Literal[7] FirmwareRequest = 8 # type: Literal[8] diff --git a/core/src/trezor/messages/PassphraseAck.py b/core/src/trezor/messages/PassphraseAck.py index 791d6c54f..84d134c93 100644 --- a/core/src/trezor/messages/PassphraseAck.py +++ b/core/src/trezor/messages/PassphraseAck.py @@ -16,14 +16,17 @@ class PassphraseAck(p.MessageType): def __init__( self, passphrase: str = None, + _state: bytes = None, on_device: bool = None, ) -> None: self.passphrase = passphrase + self._state = _state self.on_device = on_device @classmethod def get_fields(cls) -> Dict: return { 1: ('passphrase', p.UnicodeType, 0), + 2: ('_state', p.BytesType, 0), 3: ('on_device', p.BoolType, 0), } diff --git a/core/src/trezor/messages/PassphraseRequest.py b/core/src/trezor/messages/PassphraseRequest.py index 898f91cc2..a2d28848c 100644 --- a/core/src/trezor/messages/PassphraseRequest.py +++ b/core/src/trezor/messages/PassphraseRequest.py @@ -12,3 +12,15 @@ if __debug__: class PassphraseRequest(p.MessageType): MESSAGE_WIRE_TYPE = 41 + + def __init__( + self, + _on_device: bool = None, + ) -> None: + self._on_device = _on_device + + @classmethod + def get_fields(cls) -> Dict: + return { + 1: ('_on_device', p.BoolType, 0), + } diff --git a/python/src/trezorlib/messages/Deprecated_PassphraseStateAck.py b/python/src/trezorlib/messages/Deprecated_PassphraseStateAck.py new file mode 100644 index 000000000..fa178ddf5 --- /dev/null +++ b/python/src/trezorlib/messages/Deprecated_PassphraseStateAck.py @@ -0,0 +1,14 @@ +# Automatically generated by pb2py +# fmt: off +from .. import protobuf as p + +if __debug__: + try: + from typing import Dict, List # noqa: F401 + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass + + +class Deprecated_PassphraseStateAck(p.MessageType): + MESSAGE_WIRE_TYPE = 78 diff --git a/python/src/trezorlib/messages/Deprecated_PassphraseStateRequest.py b/python/src/trezorlib/messages/Deprecated_PassphraseStateRequest.py new file mode 100644 index 000000000..4ca29bb51 --- /dev/null +++ b/python/src/trezorlib/messages/Deprecated_PassphraseStateRequest.py @@ -0,0 +1,26 @@ +# Automatically generated by pb2py +# fmt: off +from .. import protobuf as p + +if __debug__: + try: + from typing import Dict, List # noqa: F401 + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass + + +class Deprecated_PassphraseStateRequest(p.MessageType): + MESSAGE_WIRE_TYPE = 77 + + def __init__( + self, + state: bytes = None, + ) -> None: + self.state = state + + @classmethod + def get_fields(cls) -> Dict: + return { + 1: ('state', p.BytesType, 0), + } diff --git a/python/src/trezorlib/messages/Initialize.py b/python/src/trezorlib/messages/Initialize.py index 3d84f94a5..3d8ca3810 100644 --- a/python/src/trezorlib/messages/Initialize.py +++ b/python/src/trezorlib/messages/Initialize.py @@ -22,5 +22,5 @@ class Initialize(p.MessageType): @classmethod def get_fields(cls) -> Dict: return { - 3: ('session_id', p.BytesType, 0), + 1: ('session_id', p.BytesType, 0), } diff --git a/python/src/trezorlib/messages/MessageType.py b/python/src/trezorlib/messages/MessageType.py index abe7754eb..2720b0767 100644 --- a/python/src/trezorlib/messages/MessageType.py +++ b/python/src/trezorlib/messages/MessageType.py @@ -36,6 +36,8 @@ SdProtect = 79 # type: Literal[79] GetNextU2FCounter = 80 # type: Literal[80] NextU2FCounter = 81 # type: Literal[81] ChangeWipeCode = 82 # type: Literal[82] +Deprecated_PassphraseStateRequest = 77 # type: Literal[77] +Deprecated_PassphraseStateAck = 78 # type: Literal[78] FirmwareErase = 6 # type: Literal[6] FirmwareUpload = 7 # type: Literal[7] FirmwareRequest = 8 # type: Literal[8] diff --git a/python/src/trezorlib/messages/PassphraseAck.py b/python/src/trezorlib/messages/PassphraseAck.py index bc5f94c2d..ef00fa78e 100644 --- a/python/src/trezorlib/messages/PassphraseAck.py +++ b/python/src/trezorlib/messages/PassphraseAck.py @@ -16,14 +16,17 @@ class PassphraseAck(p.MessageType): def __init__( self, passphrase: str = None, + _state: bytes = None, on_device: bool = None, ) -> None: self.passphrase = passphrase + self._state = _state self.on_device = on_device @classmethod def get_fields(cls) -> Dict: return { 1: ('passphrase', p.UnicodeType, 0), + 2: ('_state', p.BytesType, 0), 3: ('on_device', p.BoolType, 0), } diff --git a/python/src/trezorlib/messages/PassphraseRequest.py b/python/src/trezorlib/messages/PassphraseRequest.py index cb75b54e1..903c0dfc2 100644 --- a/python/src/trezorlib/messages/PassphraseRequest.py +++ b/python/src/trezorlib/messages/PassphraseRequest.py @@ -12,3 +12,15 @@ if __debug__: class PassphraseRequest(p.MessageType): MESSAGE_WIRE_TYPE = 41 + + def __init__( + self, + _on_device: bool = None, + ) -> None: + self._on_device = _on_device + + @classmethod + def get_fields(cls) -> Dict: + return { + 1: ('_on_device', p.BoolType, 0), + } diff --git a/python/src/trezorlib/messages/__init__.py b/python/src/trezorlib/messages/__init__.py index dea408822..d101055fb 100644 --- a/python/src/trezorlib/messages/__init__.py +++ b/python/src/trezorlib/messages/__init__.py @@ -53,6 +53,8 @@ from .DebugLinkState import DebugLinkState from .DebugLinkStop import DebugLinkStop from .DebugMoneroDiagAck import DebugMoneroDiagAck from .DebugMoneroDiagRequest import DebugMoneroDiagRequest +from .Deprecated_PassphraseStateAck import Deprecated_PassphraseStateAck +from .Deprecated_PassphraseStateRequest import Deprecated_PassphraseStateRequest from .ECDHSessionKey import ECDHSessionKey from .Entropy import Entropy from .EntropyAck import EntropyAck