common: return deprecated fields to protobuf, to allow cross-version compatible code

pull/803/head
matejcik 4 years ago
parent 56dc952495
commit 4c9689d7a7

@ -111,19 +111,36 @@ message PinMatrixAck {
* @next PassphraseAck * @next PassphraseAck
*/ */
message PassphraseRequest { message PassphraseRequest {
// optional bool on_device = 1; // DEPRECATED optional bool _on_device = 1 [deprecated=true]; // <2.3.0
} }
/** /**
* Request: Send passphrase back * Request: Send passphrase back
* @auxend * @auxend
*/ */
message PassphraseAck { message PassphraseAck {
optional string passphrase = 1; 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 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 * Structure representing BIP32 (hierarchical deterministic) node
* Used for imports of private key into the device and exporting public key out of device * Used for imports of private key into the device and exporting public key out of device

@ -20,7 +20,7 @@ enum BackupType {
* @next Features * @next Features
*/ */
message Initialize { 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
} }
/** /**

@ -54,8 +54,6 @@ enum MessageType {
MessageType_EntropyAck = 36 [(wire_in) = true]; MessageType_EntropyAck = 36 [(wire_in) = true];
MessageType_PassphraseRequest = 41 [(wire_out) = true]; MessageType_PassphraseRequest = 41 [(wire_out) = true];
MessageType_PassphraseAck = 42 [(wire_in) = true, (wire_tiny) = true, (wire_no_fsm) = 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_RecoveryDevice = 45 [(wire_in) = true];
MessageType_WordRequest = 46 [(wire_out) = true]; MessageType_WordRequest = 46 [(wire_out) = true];
MessageType_WordAck = 47 [(wire_in) = true]; MessageType_WordAck = 47 [(wire_in) = true];
@ -66,6 +64,11 @@ enum MessageType {
MessageType_NextU2FCounter = 81 [(wire_out) = true]; MessageType_NextU2FCounter = 81 [(wire_out) = true];
MessageType_ChangeWipeCode = 82 [(wire_in) = 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 // Bootloader
MessageType_FirmwareErase = 6 [(wire_in) = true, (wire_bootloader) = true]; MessageType_FirmwareErase = 6 [(wire_in) = true, (wire_bootloader) = true];
MessageType_FirmwareUpload = 7 [(wire_in) = true, (wire_bootloader) = true]; MessageType_FirmwareUpload = 7 [(wire_in) = true, (wire_bootloader) = true];

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

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

@ -22,5 +22,5 @@ class Initialize(p.MessageType):
@classmethod @classmethod
def get_fields(cls) -> Dict: def get_fields(cls) -> Dict:
return { return {
3: ('session_id', p.BytesType, 0), 1: ('session_id', p.BytesType, 0),
} }

@ -38,6 +38,8 @@ SdProtect = 79 # type: Literal[79]
GetNextU2FCounter = 80 # type: Literal[80] GetNextU2FCounter = 80 # type: Literal[80]
NextU2FCounter = 81 # type: Literal[81] NextU2FCounter = 81 # type: Literal[81]
ChangeWipeCode = 82 # type: Literal[82] ChangeWipeCode = 82 # type: Literal[82]
Deprecated_PassphraseStateRequest = 77 # type: Literal[77]
Deprecated_PassphraseStateAck = 78 # type: Literal[78]
FirmwareErase = 6 # type: Literal[6] FirmwareErase = 6 # type: Literal[6]
FirmwareUpload = 7 # type: Literal[7] FirmwareUpload = 7 # type: Literal[7]
FirmwareRequest = 8 # type: Literal[8] FirmwareRequest = 8 # type: Literal[8]

@ -16,14 +16,17 @@ class PassphraseAck(p.MessageType):
def __init__( def __init__(
self, self,
passphrase: str = None, passphrase: str = None,
_state: bytes = None,
on_device: bool = None, on_device: bool = None,
) -> None: ) -> None:
self.passphrase = passphrase self.passphrase = passphrase
self._state = _state
self.on_device = on_device self.on_device = on_device
@classmethod @classmethod
def get_fields(cls) -> Dict: def get_fields(cls) -> Dict:
return { return {
1: ('passphrase', p.UnicodeType, 0), 1: ('passphrase', p.UnicodeType, 0),
2: ('_state', p.BytesType, 0),
3: ('on_device', p.BoolType, 0), 3: ('on_device', p.BoolType, 0),
} }

@ -12,3 +12,15 @@ if __debug__:
class PassphraseRequest(p.MessageType): class PassphraseRequest(p.MessageType):
MESSAGE_WIRE_TYPE = 41 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),
}

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

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

@ -22,5 +22,5 @@ class Initialize(p.MessageType):
@classmethod @classmethod
def get_fields(cls) -> Dict: def get_fields(cls) -> Dict:
return { return {
3: ('session_id', p.BytesType, 0), 1: ('session_id', p.BytesType, 0),
} }

@ -36,6 +36,8 @@ SdProtect = 79 # type: Literal[79]
GetNextU2FCounter = 80 # type: Literal[80] GetNextU2FCounter = 80 # type: Literal[80]
NextU2FCounter = 81 # type: Literal[81] NextU2FCounter = 81 # type: Literal[81]
ChangeWipeCode = 82 # type: Literal[82] ChangeWipeCode = 82 # type: Literal[82]
Deprecated_PassphraseStateRequest = 77 # type: Literal[77]
Deprecated_PassphraseStateAck = 78 # type: Literal[78]
FirmwareErase = 6 # type: Literal[6] FirmwareErase = 6 # type: Literal[6]
FirmwareUpload = 7 # type: Literal[7] FirmwareUpload = 7 # type: Literal[7]
FirmwareRequest = 8 # type: Literal[8] FirmwareRequest = 8 # type: Literal[8]

@ -16,14 +16,17 @@ class PassphraseAck(p.MessageType):
def __init__( def __init__(
self, self,
passphrase: str = None, passphrase: str = None,
_state: bytes = None,
on_device: bool = None, on_device: bool = None,
) -> None: ) -> None:
self.passphrase = passphrase self.passphrase = passphrase
self._state = _state
self.on_device = on_device self.on_device = on_device
@classmethod @classmethod
def get_fields(cls) -> Dict: def get_fields(cls) -> Dict:
return { return {
1: ('passphrase', p.UnicodeType, 0), 1: ('passphrase', p.UnicodeType, 0),
2: ('_state', p.BytesType, 0),
3: ('on_device', p.BoolType, 0), 3: ('on_device', p.BoolType, 0),
} }

@ -12,3 +12,15 @@ if __debug__:
class PassphraseRequest(p.MessageType): class PassphraseRequest(p.MessageType):
MESSAGE_WIRE_TYPE = 41 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),
}

@ -53,6 +53,8 @@ from .DebugLinkState import DebugLinkState
from .DebugLinkStop import DebugLinkStop from .DebugLinkStop import DebugLinkStop
from .DebugMoneroDiagAck import DebugMoneroDiagAck from .DebugMoneroDiagAck import DebugMoneroDiagAck
from .DebugMoneroDiagRequest import DebugMoneroDiagRequest from .DebugMoneroDiagRequest import DebugMoneroDiagRequest
from .Deprecated_PassphraseStateAck import Deprecated_PassphraseStateAck
from .Deprecated_PassphraseStateRequest import Deprecated_PassphraseStateRequest
from .ECDHSessionKey import ECDHSessionKey from .ECDHSessionKey import ECDHSessionKey
from .Entropy import Entropy from .Entropy import Entropy
from .EntropyAck import EntropyAck from .EntropyAck import EntropyAck

Loading…
Cancel
Save