mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-26 00:08:10 +00:00
common: Add ChangeWipeCode message.
This commit is contained in:
parent
5e7dd41613
commit
4381511930
@ -33,6 +33,7 @@ message Failure {
|
||||
Failure_NotEnoughFunds = 10;
|
||||
Failure_NotInitialized = 11;
|
||||
Failure_PinMismatch = 12;
|
||||
Failure_WipeCodeMismatch = 13;
|
||||
Failure_FirmwareError = 99;
|
||||
}
|
||||
}
|
||||
@ -90,6 +91,8 @@ message PinMatrixRequest {
|
||||
PinMatrixRequestType_Current = 1;
|
||||
PinMatrixRequestType_NewFirst = 2;
|
||||
PinMatrixRequestType_NewSecond = 3;
|
||||
PinMatrixRequestType_WipeCodeFirst = 4;
|
||||
PinMatrixRequestType_WipeCodeSecond = 5;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,6 +141,16 @@ message ChangePin {
|
||||
optional bool remove = 1; // is PIN removal requested?
|
||||
}
|
||||
|
||||
/**
|
||||
* Request: Starts workflow for setting/removing the wipe code
|
||||
* @start
|
||||
* @next Success
|
||||
* @next Failure
|
||||
*/
|
||||
message ChangeWipeCode {
|
||||
optional bool remove = 1; // is wipe code removal requested?
|
||||
}
|
||||
|
||||
/**
|
||||
* Request: Starts workflow for enabling/regenerating/disabling SD card protection
|
||||
* @start
|
||||
|
@ -64,6 +64,7 @@ enum MessageType {
|
||||
MessageType_SdProtect = 79 [(wire_in) = true];
|
||||
MessageType_GetNextU2FCounter = 80 [(wire_in) = true];
|
||||
MessageType_NextU2FCounter = 81 [(wire_out) = true];
|
||||
MessageType_ChangeWipeCode = 82 [(wire_in) = true];
|
||||
|
||||
// Bootloader
|
||||
MessageType_FirmwareErase = 6 [(wire_in) = true, (wire_bootloader) = true];
|
||||
|
26
core/src/trezor/messages/ChangeWipeCode.py
Normal file
26
core/src/trezor/messages/ChangeWipeCode.py
Normal file
@ -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 ChangeWipeCode(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 82
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
remove: bool = None,
|
||||
) -> None:
|
||||
self.remove = remove
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls) -> Dict:
|
||||
return {
|
||||
1: ('remove', p.BoolType, 0),
|
||||
}
|
@ -6,7 +6,7 @@ if __debug__:
|
||||
try:
|
||||
from typing import Dict, List # noqa: F401
|
||||
from typing_extensions import Literal # noqa: F401
|
||||
EnumTypeFailureType = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 99]
|
||||
EnumTypeFailureType = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 99]
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
@ -25,6 +25,6 @@ class Failure(p.MessageType):
|
||||
@classmethod
|
||||
def get_fields(cls) -> Dict:
|
||||
return {
|
||||
1: ('code', p.EnumType("FailureType", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 99)), 0),
|
||||
1: ('code', p.EnumType("FailureType", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 99)), 0),
|
||||
2: ('message', p.UnicodeType, 0),
|
||||
}
|
||||
|
@ -15,4 +15,5 @@ ProcessError = 9 # type: Literal[9]
|
||||
NotEnoughFunds = 10 # type: Literal[10]
|
||||
NotInitialized = 11 # type: Literal[11]
|
||||
PinMismatch = 12 # type: Literal[12]
|
||||
WipeCodeMismatch = 13 # type: Literal[13]
|
||||
FirmwareError = 99 # type: Literal[99]
|
||||
|
@ -39,6 +39,7 @@ SetU2FCounter = 63 # type: Literal[63]
|
||||
SdProtect = 79 # type: Literal[79]
|
||||
GetNextU2FCounter = 80 # type: Literal[80]
|
||||
NextU2FCounter = 81 # type: Literal[81]
|
||||
ChangeWipeCode = 82 # type: Literal[82]
|
||||
FirmwareErase = 6 # type: Literal[6]
|
||||
FirmwareUpload = 7 # type: Literal[7]
|
||||
FirmwareRequest = 8 # type: Literal[8]
|
||||
|
@ -71,6 +71,11 @@ class PinMismatch(Error):
|
||||
super().__init__(FailureType.PinMismatch, message)
|
||||
|
||||
|
||||
class WipeCodeMismatch(Error):
|
||||
def __init__(self, message: str) -> None:
|
||||
super().__init__(FailureType.WipeCodeMismatch, message)
|
||||
|
||||
|
||||
class FirmwareError(Error):
|
||||
def __init__(self, message: str) -> None:
|
||||
super().__init__(FailureType.FirmwareError, message)
|
||||
|
26
python/src/trezorlib/messages/ChangeWipeCode.py
Normal file
26
python/src/trezorlib/messages/ChangeWipeCode.py
Normal file
@ -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 ChangeWipeCode(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 82
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
remove: bool = None,
|
||||
) -> None:
|
||||
self.remove = remove
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls) -> Dict:
|
||||
return {
|
||||
1: ('remove', p.BoolType, 0),
|
||||
}
|
@ -6,7 +6,7 @@ if __debug__:
|
||||
try:
|
||||
from typing import Dict, List # noqa: F401
|
||||
from typing_extensions import Literal # noqa: F401
|
||||
EnumTypeFailureType = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 99]
|
||||
EnumTypeFailureType = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 99]
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
@ -25,6 +25,6 @@ class Failure(p.MessageType):
|
||||
@classmethod
|
||||
def get_fields(cls) -> Dict:
|
||||
return {
|
||||
1: ('code', p.EnumType("FailureType", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 99)), 0),
|
||||
1: ('code', p.EnumType("FailureType", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 99)), 0),
|
||||
2: ('message', p.UnicodeType, 0),
|
||||
}
|
||||
|
@ -15,4 +15,5 @@ ProcessError = 9 # type: Literal[9]
|
||||
NotEnoughFunds = 10 # type: Literal[10]
|
||||
NotInitialized = 11 # type: Literal[11]
|
||||
PinMismatch = 12 # type: Literal[12]
|
||||
WipeCodeMismatch = 13 # type: Literal[13]
|
||||
FirmwareError = 99 # type: Literal[99]
|
||||
|
@ -37,6 +37,7 @@ SetU2FCounter = 63 # type: Literal[63]
|
||||
SdProtect = 79 # type: Literal[79]
|
||||
GetNextU2FCounter = 80 # type: Literal[80]
|
||||
NextU2FCounter = 81 # type: Literal[81]
|
||||
ChangeWipeCode = 82 # type: Literal[82]
|
||||
FirmwareErase = 6 # type: Literal[6]
|
||||
FirmwareUpload = 7 # type: Literal[7]
|
||||
FirmwareRequest = 8 # type: Literal[8]
|
||||
|
@ -6,7 +6,7 @@ if __debug__:
|
||||
try:
|
||||
from typing import Dict, List # noqa: F401
|
||||
from typing_extensions import Literal # noqa: F401
|
||||
EnumTypePinMatrixRequestType = Literal[1, 2, 3]
|
||||
EnumTypePinMatrixRequestType = Literal[1, 2, 3, 4, 5]
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
@ -23,5 +23,5 @@ class PinMatrixRequest(p.MessageType):
|
||||
@classmethod
|
||||
def get_fields(cls) -> Dict:
|
||||
return {
|
||||
1: ('type', p.EnumType("PinMatrixRequestType", (1, 2, 3)), 0),
|
||||
1: ('type', p.EnumType("PinMatrixRequestType", (1, 2, 3, 4, 5)), 0),
|
||||
}
|
||||
|
@ -6,3 +6,5 @@ if False:
|
||||
Current = 1 # type: Literal[1]
|
||||
NewFirst = 2 # type: Literal[2]
|
||||
NewSecond = 3 # type: Literal[3]
|
||||
WipeCodeFirst = 4 # type: Literal[4]
|
||||
WipeCodeSecond = 5 # type: Literal[5]
|
||||
|
@ -31,6 +31,7 @@ from .CardanoTxInputType import CardanoTxInputType
|
||||
from .CardanoTxOutputType import CardanoTxOutputType
|
||||
from .CardanoTxRequest import CardanoTxRequest
|
||||
from .ChangePin import ChangePin
|
||||
from .ChangeWipeCode import ChangeWipeCode
|
||||
from .CipherKeyValue import CipherKeyValue
|
||||
from .CipheredKeyValue import CipheredKeyValue
|
||||
from .ClearSession import ClearSession
|
||||
|
Loading…
Reference in New Issue
Block a user