1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 09:28:13 +00:00

chore(core): separate message types of THP messages into new enum and update parsing

[no changelog]
This commit is contained in:
M1nd3r 2024-10-10 16:23:45 +02:00
parent c6ba01b347
commit e80bfca6cd
18 changed files with 360 additions and 250 deletions

View File

@ -9,6 +9,35 @@ import "options.proto";
option (include_in_bitcoin_only) = true;
/**
* Mapping between Trezor wire identifier (uint) and a Thp protobuf message
*/
enum ThpMessageType {
reserved 0 to 999; // Values reserved by other messages, see messages.proto
ThpMessageType_ThpCreateNewSession = 1000[(bitcoin_only)=true, (channel_in) = true];
ThpMessageType_ThpNewSession = 1001[(bitcoin_only)=true, (channel_out) = true];
ThpMessageType_ThpStartPairingRequest = 1008 [(bitcoin_only) = true, (pairing_in) = true];
ThpMessageType_ThpPairingPreparationsFinished = 1009 [(bitcoin_only) = true, (pairing_out) = true];
ThpMessageType_ThpCredentialRequest = 1010 [(bitcoin_only) = true, (pairing_in) = true];
ThpMessageType_ThpCredentialResponse = 1011 [(bitcoin_only) = true, (pairing_out) = true];
ThpMessageType_ThpEndRequest = 1012 [(bitcoin_only) = true, (pairing_in) = true];
ThpMessageType_ThpEndResponse = 1013[(bitcoin_only) = true, (pairing_out) = true];
ThpMessageType_ThpCodeEntryCommitment = 1016[(bitcoin_only)=true, (pairing_out) = true];
ThpMessageType_ThpCodeEntryChallenge = 1017[(bitcoin_only)=true, (pairing_in) = true];
ThpMessageType_ThpCodeEntryCpaceHost = 1018[(bitcoin_only)=true, (pairing_in) = true];
ThpMessageType_ThpCodeEntryCpaceTrezor = 1019[(bitcoin_only)=true, (pairing_out) = true];
ThpMessageType_ThpCodeEntryTag = 1020[(bitcoin_only)=true, (pairing_in) = true];
ThpMessageType_ThpCodeEntrySecret = 1021[(bitcoin_only)=true, (pairing_out) = true];
ThpMessageType_ThpQrCodeTag = 1024[(bitcoin_only)=true, (pairing_in) = true];
ThpMessageType_ThpQrCodeSecret = 1025[(bitcoin_only)=true, (pairing_out) = true];
ThpMessageType_ThpNfcUnidirectionalTag = 1032[(bitcoin_only)=true, (pairing_in) = true];
ThpMessageType_ThpNfcUnidirectionalSecret = 1033[(bitcoin_only)=true, (pairing_in) = true];
reserved 1100 to 2147483647; // Values reserved by other messages, see messages.proto
}
/**
* Numeric identifiers of pairing methods.
* @embed

View File

@ -349,24 +349,7 @@ enum MessageType {
MessageType_BenchmarkResult = 9103 [(bitcoin_only) = true];
// THP
MessageType_ThpCreateNewSession = 1000[(bitcoin_only)=true, (channel_in) = true];
MessageType_ThpNewSession = 1001[(bitcoin_only)=true, (channel_out) = true];
MessageType_ThpStartPairingRequest = 1008 [(bitcoin_only) = true, (pairing_in) = true];
MessageType_ThpPairingPreparationsFinished = 1009 [(bitcoin_only) = true, (pairing_out) = true];
MessageType_ThpCredentialRequest = 1010 [(bitcoin_only) = true, (pairing_in) = true];
MessageType_ThpCredentialResponse = 1011 [(bitcoin_only) = true, (pairing_out) = true];
MessageType_ThpEndRequest = 1012 [(bitcoin_only) = true, (pairing_in) = true];
MessageType_ThpEndResponse = 1013[(bitcoin_only) = true, (pairing_out) = true];
MessageType_ThpCodeEntryCommitment = 1016[(bitcoin_only)=true, (pairing_out) = true];
MessageType_ThpCodeEntryChallenge = 1017[(bitcoin_only)=true, (pairing_in) = true];
MessageType_ThpCodeEntryCpaceHost = 1018[(bitcoin_only)=true, (pairing_in) = true];
MessageType_ThpCodeEntryCpaceTrezor = 1019[(bitcoin_only)=true, (pairing_out) = true];
MessageType_ThpCodeEntryTag = 1020[(bitcoin_only)=true, (pairing_in) = true];
MessageType_ThpCodeEntrySecret = 1021[(bitcoin_only)=true, (pairing_out) = true];
MessageType_ThpQrCodeTag = 1024[(bitcoin_only)=true, (pairing_in) = true];
MessageType_ThpQrCodeSecret = 1025[(bitcoin_only)=true, (pairing_out) = true];
MessageType_ThpNfcUnidirectionalTag = 1032[(bitcoin_only)=true, (pairing_in) = true];
MessageType_ThpNfcUnidirectionalSecret = 1033[(bitcoin_only)=true, (pairing_in) = true];
reserved 1000 to 1099; // See messages-thp.proto
}

View File

@ -62,6 +62,7 @@ INT_TYPES = (
)
MESSAGE_TYPE_ENUM = "MessageType"
THP_MESSAGE_TYPE_ENUM = "ThpMessageType"
LengthDelimited = c.Struct(
"len" / c.VarInt,
@ -239,6 +240,9 @@ class ProtoMessage:
@classmethod
def from_message(cls, descriptor: "Descriptor", message):
message_type = find_by_name(descriptor.message_type_enum.value, message.name)
thp_message_type = None
if not isinstance(descriptor.thp_message_type_enum,tuple):
thp_message_type = find_by_name(descriptor.thp_message_type_enum.value, message.name)
# use extensions set on the message_type entry (if any)
extensions = descriptor.get_extensions(message_type)
# override with extensions set on the message itself
@ -248,6 +252,8 @@ class ProtoMessage:
wire_type = extensions["wire_type"]
elif message_type is not None:
wire_type = message_type.number
elif thp_message_type is not None:
wire_type = thp_message_type.number
else:
wire_type = None
@ -351,10 +357,12 @@ class Descriptor:
]
logging.debug(f"found {len(self.files)} bitcoin-only files")
# find message_type enum
# find message_type and thp_message_type enum
top_level_enums = itertools.chain.from_iterable(f.enum_type for f in self.files)
self.message_type_enum = find_by_name(top_level_enums, MESSAGE_TYPE_ENUM, ())
self.thp_message_type_enum = find_by_name(top_level_enums, THP_MESSAGE_TYPE_ENUM, ())
self.convert_enum_value_names(self.message_type_enum)
self.convert_enum_value_names(self.thp_message_type_enum)
# find messages and enums
self.messages = []
@ -423,6 +431,8 @@ class Descriptor:
self._nested_types_from_message(nested.orig)
def convert_enum_value_names(self, enum):
if isinstance(enum,tuple):
return
for value in enum.value:
value.name = strip_enum_prefix(enum.name, value.name)

View File

@ -411,6 +411,8 @@ apps.workflow_handlers
import apps.workflow_handlers
if utils.USE_THP:
trezor.enums.ThpMessageType
import trezor.enums.ThpMessageType
trezor.enums.ThpPairingMethod
import trezor.enums.ThpPairingMethod
trezor.wire.thp

View File

@ -3,7 +3,7 @@ from ubinascii import hexlify
from trezor import loop, protobuf
from trezor.crypto.hashlib import sha256
from trezor.enums import MessageType, ThpPairingMethod
from trezor.enums import ThpMessageType, ThpPairingMethod
from trezor.messages import (
Cancel,
ThpCodeEntryChallenge,
@ -318,8 +318,8 @@ async def _handle_secret_reveal(
ctx.channel_ctx.set_channel_state(ChannelState.TC1)
return await ctx.call_any(
msg,
MessageType.ThpCredentialRequest,
MessageType.ThpEndRequest,
ThpMessageType.ThpCredentialRequest,
ThpMessageType.ThpEndRequest,
)
@ -342,8 +342,8 @@ async def _handle_credential_request(
ThpCredentialResponse(
trezor_static_pubkey=trezor_static_pubkey, credential=credential
),
MessageType.ThpCredentialRequest,
MessageType.ThpEndRequest,
ThpMessageType.ThpCredentialRequest,
ThpMessageType.ThpEndRequest,
)
@ -404,9 +404,9 @@ def _get_possible_pairing_methods(ctx: PairingContext) -> Tuple[int, ...]:
def _get_message_type_for_method(method: int) -> int:
if method is ThpPairingMethod.CodeEntry:
return MessageType.ThpCodeEntryCpaceHost
return ThpMessageType.ThpCodeEntryCpaceHost
if method is ThpPairingMethod.NFC_Unidirectional:
return MessageType.ThpNfcUnidirectionalTag
return ThpMessageType.ThpNfcUnidirectionalTag
if method is ThpPairingMethod.QrCode:
return MessageType.ThpQrCodeTag
return ThpMessageType.ThpQrCodeTag
raise ValueError("Unexpected pairing method - no message type available")

View File

@ -30,8 +30,10 @@ def _find_message_handler_module(msg_type: int) -> str:
return "apps.debug.load_device"
if utils.USE_THP:
from trezor.enums import ThpMessageType
# thp management
if msg_type == MessageType.ThpCreateNewSession:
if msg_type == ThpMessageType.ThpCreateNewSession:
return "apps.thp.create_new_session"
# management

View File

@ -99,24 +99,6 @@ BenchmarkListNames = 9100
BenchmarkNames = 9101
BenchmarkRun = 9102
BenchmarkResult = 9103
ThpCreateNewSession = 1000
ThpNewSession = 1001
ThpStartPairingRequest = 1008
ThpPairingPreparationsFinished = 1009
ThpCredentialRequest = 1010
ThpCredentialResponse = 1011
ThpEndRequest = 1012
ThpEndResponse = 1013
ThpCodeEntryCommitment = 1016
ThpCodeEntryChallenge = 1017
ThpCodeEntryCpaceHost = 1018
ThpCodeEntryCpaceTrezor = 1019
ThpCodeEntryTag = 1020
ThpCodeEntrySecret = 1021
ThpQrCodeTag = 1024
ThpQrCodeSecret = 1025
ThpNfcUnidirectionalTag = 1032
ThpNfcUnidirectionalSecret = 1033
if not utils.BITCOIN_ONLY:
SetU2FCounter = 63
GetNextU2FCounter = 80

22
core/src/trezor/enums/ThpMessageType.py generated Normal file
View File

@ -0,0 +1,22 @@
# Automatically generated by pb2py
# fmt: off
# isort:skip_file
ThpCreateNewSession = 1000
ThpNewSession = 1001
ThpStartPairingRequest = 1008
ThpPairingPreparationsFinished = 1009
ThpCredentialRequest = 1010
ThpCredentialResponse = 1011
ThpEndRequest = 1012
ThpEndResponse = 1013
ThpCodeEntryCommitment = 1016
ThpCodeEntryChallenge = 1017
ThpCodeEntryCpaceHost = 1018
ThpCodeEntryCpaceTrezor = 1019
ThpCodeEntryTag = 1020
ThpCodeEntrySecret = 1021
ThpQrCodeTag = 1024
ThpQrCodeSecret = 1025
ThpNfcUnidirectionalTag = 1032
ThpNfcUnidirectionalSecret = 1033

View File

@ -559,24 +559,6 @@ if TYPE_CHECKING:
BenchmarkNames = 9101
BenchmarkRun = 9102
BenchmarkResult = 9103
ThpCreateNewSession = 1000
ThpNewSession = 1001
ThpStartPairingRequest = 1008
ThpPairingPreparationsFinished = 1009
ThpCredentialRequest = 1010
ThpCredentialResponse = 1011
ThpEndRequest = 1012
ThpEndResponse = 1013
ThpCodeEntryCommitment = 1016
ThpCodeEntryChallenge = 1017
ThpCodeEntryCpaceHost = 1018
ThpCodeEntryCpaceTrezor = 1019
ThpCodeEntryTag = 1020
ThpCodeEntrySecret = 1021
ThpQrCodeTag = 1024
ThpQrCodeSecret = 1025
ThpNfcUnidirectionalTag = 1032
ThpNfcUnidirectionalSecret = 1033
class StellarAssetType(IntEnum):
NATIVE = 0
@ -604,6 +586,26 @@ if TYPE_CHECKING:
Nay = 1
Pass = 2
class ThpMessageType(IntEnum):
ThpCreateNewSession = 1000
ThpNewSession = 1001
ThpStartPairingRequest = 1008
ThpPairingPreparationsFinished = 1009
ThpCredentialRequest = 1010
ThpCredentialResponse = 1011
ThpEndRequest = 1012
ThpEndResponse = 1013
ThpCodeEntryCommitment = 1016
ThpCodeEntryChallenge = 1017
ThpCodeEntryCpaceHost = 1018
ThpCodeEntryCpaceTrezor = 1019
ThpCodeEntryTag = 1020
ThpCodeEntrySecret = 1021
ThpQrCodeTag = 1024
ThpQrCodeSecret = 1025
ThpNfcUnidirectionalTag = 1032
ThpNfcUnidirectionalSecret = 1033
class ThpPairingMethod(IntEnum):
NoMethod = 1
CodeEntry = 2

View File

@ -66,6 +66,7 @@ if TYPE_CHECKING:
from trezor.enums import StellarSignerType # noqa: F401
from trezor.enums import TezosBallotType # noqa: F401
from trezor.enums import TezosContractType # noqa: F401
from trezor.enums import ThpMessageType # noqa: F401
from trezor.enums import ThpPairingMethod # noqa: F401
from trezor.enums import WordRequestType # noqa: F401

View File

@ -57,6 +57,18 @@ WIRE_BUFFER = bytearray(_PROTOBUF_BUFFER_SIZE)
if utils.USE_THP:
WIRE_BUFFER_2 = bytearray(_PROTOBUF_BUFFER_SIZE)
if utils.USE_THP:
from trezor.enums import ThpMessageType
def get_msg_name(msg_type: int) -> str | None:
for name in dir(ThpMessageType):
if not name.startswith("__"): # Skip built-in attributes
value = getattr(ThpMessageType, name)
if isinstance(value, int):
if value == msg_type:
return name
return None
async def handle_single_message(
ctx: Context,
@ -123,7 +135,15 @@ async def handle_single_message(
try:
# Find a protobuf.MessageType subclass that describes this
# message. Raises if the type is not found.
req_type = protobuf.type_for_wire(msg.type)
if utils.USE_THP:
name = get_msg_name(msg.type)
if name is None:
req_type = protobuf.type_for_wire(msg.type)
else:
req_type = protobuf.type_for_name(name)
else:
req_type = protobuf.type_for_wire(msg.type)
# Try to decode the message according to schema from
# `req_type`. Raises if the message is malformed.

View File

@ -1,5 +1,6 @@
from storage.cache_thp import SESSION_ID_LENGTH, TAG_LENGTH
from trezor import log, protobuf, utils
from trezor.enums import ThpMessageType
from . import ChannelState, ThpError
from .checksum import CHECKSUM_LENGTH
@ -52,20 +53,27 @@ def get_write_buffer(
return buffer
def get_msg_type(msg_name: str) -> int | None:
value = getattr(ThpMessageType, msg_name)
if isinstance(value, int):
return value
return None
def encode_into_buffer(
buffer: utils.BufferType, msg: protobuf.MessageType, session_id: int
) -> int:
# cannot write message without wire type
assert msg.MESSAGE_WIRE_TYPE is not None
msg_type = msg.MESSAGE_WIRE_TYPE
if msg_type is None:
msg_type = get_msg_type(msg.MESSAGE_NAME)
assert msg_type is not None
msg_size = protobuf.encoded_length(msg)
payload_size = SESSION_ID_LENGTH + MESSAGE_TYPE_LENGTH + msg_size
_encode_session_into_buffer(memoryview(buffer), session_id)
_encode_message_type_into_buffer(
memoryview(buffer), msg.MESSAGE_WIRE_TYPE, SESSION_ID_LENGTH
)
_encode_message_type_into_buffer(memoryview(buffer), msg_type, SESSION_ID_LENGTH)
_encode_message_into_buffer(
memoryview(buffer), msg, SESSION_ID_LENGTH + MESSAGE_TYPE_LENGTH
)

View File

@ -200,7 +200,11 @@ async def handle_pairing_request_message(
try:
# Find a protobuf.MessageType subclass that describes this
# message. Raises if the type is not found.
req_type = protobuf.type_for_wire(msg.type)
name = message_handler.get_msg_name(msg.type)
if name is None:
req_type = protobuf.type_for_wire(msg.type)
else:
req_type = protobuf.type_for_name(name)
# Try to decode the message according to schema from
# `req_type`. Raises if the message is malformed.

View File

@ -95,7 +95,9 @@ class ProtobufMapping:
mapping = cls()
message_types = getattr(module, "MessageType")
for entry in message_types:
thp_message_types = getattr(module, "ThpMessageType")
for entry in (*message_types, *thp_message_types):
msg_class = getattr(module, entry.name, None)
if msg_class is None:
raise ValueError(

View File

@ -605,24 +605,6 @@ class MessageType(IntEnum):
BenchmarkNames = 9101
BenchmarkRun = 9102
BenchmarkResult = 9103
ThpCreateNewSession = 1000
ThpNewSession = 1001
ThpStartPairingRequest = 1008
ThpPairingPreparationsFinished = 1009
ThpCredentialRequest = 1010
ThpCredentialResponse = 1011
ThpEndRequest = 1012
ThpEndResponse = 1013
ThpCodeEntryCommitment = 1016
ThpCodeEntryChallenge = 1017
ThpCodeEntryCpaceHost = 1018
ThpCodeEntryCpaceTrezor = 1019
ThpCodeEntryTag = 1020
ThpCodeEntrySecret = 1021
ThpQrCodeTag = 1024
ThpQrCodeSecret = 1025
ThpNfcUnidirectionalTag = 1032
ThpNfcUnidirectionalSecret = 1033
class StellarAssetType(IntEnum):
@ -656,6 +638,27 @@ class TezosBallotType(IntEnum):
Pass = 2
class ThpMessageType(IntEnum):
ThpCreateNewSession = 1000
ThpNewSession = 1001
ThpStartPairingRequest = 1008
ThpPairingPreparationsFinished = 1009
ThpCredentialRequest = 1010
ThpCredentialResponse = 1011
ThpEndRequest = 1012
ThpEndResponse = 1013
ThpCodeEntryCommitment = 1016
ThpCodeEntryChallenge = 1017
ThpCodeEntryCpaceHost = 1018
ThpCodeEntryCpaceTrezor = 1019
ThpCodeEntryTag = 1020
ThpCodeEntrySecret = 1021
ThpQrCodeTag = 1024
ThpQrCodeSecret = 1025
ThpNfcUnidirectionalTag = 1032
ThpNfcUnidirectionalSecret = 1033
class ThpPairingMethod(IntEnum):
NoMethod = 1
CodeEntry = 2

View File

@ -84,24 +84,6 @@ trezor_message_impl! {
BenchmarkNames => MessageType_BenchmarkNames,
BenchmarkRun => MessageType_BenchmarkRun,
BenchmarkResult => MessageType_BenchmarkResult,
ThpCreateNewSession => MessageType_ThpCreateNewSession,
ThpNewSession => MessageType_ThpNewSession,
ThpStartPairingRequest => MessageType_ThpStartPairingRequest,
ThpPairingPreparationsFinished => MessageType_ThpPairingPreparationsFinished,
ThpCredentialRequest => MessageType_ThpCredentialRequest,
ThpCredentialResponse => MessageType_ThpCredentialResponse,
ThpEndRequest => MessageType_ThpEndRequest,
ThpEndResponse => MessageType_ThpEndResponse,
ThpCodeEntryCommitment => MessageType_ThpCodeEntryCommitment,
ThpCodeEntryChallenge => MessageType_ThpCodeEntryChallenge,
ThpCodeEntryCpaceHost => MessageType_ThpCodeEntryCpaceHost,
ThpCodeEntryCpaceTrezor => MessageType_ThpCodeEntryCpaceTrezor,
ThpCodeEntryTag => MessageType_ThpCodeEntryTag,
ThpCodeEntrySecret => MessageType_ThpCodeEntrySecret,
ThpQrCodeTag => MessageType_ThpQrCodeTag,
ThpQrCodeSecret => MessageType_ThpQrCodeSecret,
ThpNfcUnidirectionalTag => MessageType_ThpNfcUnidirectionalTag,
ThpNfcUnidirectionalSecret => MessageType_ThpNfcUnidirectionalSecret,
}
#[cfg(feature = "binance")]

View File

@ -518,42 +518,6 @@ pub enum MessageType {
MessageType_BenchmarkRun = 9102,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_BenchmarkResult)
MessageType_BenchmarkResult = 9103,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpCreateNewSession)
MessageType_ThpCreateNewSession = 1000,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpNewSession)
MessageType_ThpNewSession = 1001,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpStartPairingRequest)
MessageType_ThpStartPairingRequest = 1008,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpPairingPreparationsFinished)
MessageType_ThpPairingPreparationsFinished = 1009,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpCredentialRequest)
MessageType_ThpCredentialRequest = 1010,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpCredentialResponse)
MessageType_ThpCredentialResponse = 1011,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpEndRequest)
MessageType_ThpEndRequest = 1012,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpEndResponse)
MessageType_ThpEndResponse = 1013,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpCodeEntryCommitment)
MessageType_ThpCodeEntryCommitment = 1016,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpCodeEntryChallenge)
MessageType_ThpCodeEntryChallenge = 1017,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpCodeEntryCpaceHost)
MessageType_ThpCodeEntryCpaceHost = 1018,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpCodeEntryCpaceTrezor)
MessageType_ThpCodeEntryCpaceTrezor = 1019,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpCodeEntryTag)
MessageType_ThpCodeEntryTag = 1020,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpCodeEntrySecret)
MessageType_ThpCodeEntrySecret = 1021,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpQrCodeTag)
MessageType_ThpQrCodeTag = 1024,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpQrCodeSecret)
MessageType_ThpQrCodeSecret = 1025,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpNfcUnidirectionalTag)
MessageType_ThpNfcUnidirectionalTag = 1032,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpNfcUnidirectionalSecret)
MessageType_ThpNfcUnidirectionalSecret = 1033,
}
impl ::protobuf::Enum for MessageType {
@ -810,24 +774,6 @@ impl ::protobuf::Enum for MessageType {
9101 => ::std::option::Option::Some(MessageType::MessageType_BenchmarkNames),
9102 => ::std::option::Option::Some(MessageType::MessageType_BenchmarkRun),
9103 => ::std::option::Option::Some(MessageType::MessageType_BenchmarkResult),
1000 => ::std::option::Option::Some(MessageType::MessageType_ThpCreateNewSession),
1001 => ::std::option::Option::Some(MessageType::MessageType_ThpNewSession),
1008 => ::std::option::Option::Some(MessageType::MessageType_ThpStartPairingRequest),
1009 => ::std::option::Option::Some(MessageType::MessageType_ThpPairingPreparationsFinished),
1010 => ::std::option::Option::Some(MessageType::MessageType_ThpCredentialRequest),
1011 => ::std::option::Option::Some(MessageType::MessageType_ThpCredentialResponse),
1012 => ::std::option::Option::Some(MessageType::MessageType_ThpEndRequest),
1013 => ::std::option::Option::Some(MessageType::MessageType_ThpEndResponse),
1016 => ::std::option::Option::Some(MessageType::MessageType_ThpCodeEntryCommitment),
1017 => ::std::option::Option::Some(MessageType::MessageType_ThpCodeEntryChallenge),
1018 => ::std::option::Option::Some(MessageType::MessageType_ThpCodeEntryCpaceHost),
1019 => ::std::option::Option::Some(MessageType::MessageType_ThpCodeEntryCpaceTrezor),
1020 => ::std::option::Option::Some(MessageType::MessageType_ThpCodeEntryTag),
1021 => ::std::option::Option::Some(MessageType::MessageType_ThpCodeEntrySecret),
1024 => ::std::option::Option::Some(MessageType::MessageType_ThpQrCodeTag),
1025 => ::std::option::Option::Some(MessageType::MessageType_ThpQrCodeSecret),
1032 => ::std::option::Option::Some(MessageType::MessageType_ThpNfcUnidirectionalTag),
1033 => ::std::option::Option::Some(MessageType::MessageType_ThpNfcUnidirectionalSecret),
_ => ::std::option::Option::None
}
}
@ -1079,24 +1025,6 @@ impl ::protobuf::Enum for MessageType {
"MessageType_BenchmarkNames" => ::std::option::Option::Some(MessageType::MessageType_BenchmarkNames),
"MessageType_BenchmarkRun" => ::std::option::Option::Some(MessageType::MessageType_BenchmarkRun),
"MessageType_BenchmarkResult" => ::std::option::Option::Some(MessageType::MessageType_BenchmarkResult),
"MessageType_ThpCreateNewSession" => ::std::option::Option::Some(MessageType::MessageType_ThpCreateNewSession),
"MessageType_ThpNewSession" => ::std::option::Option::Some(MessageType::MessageType_ThpNewSession),
"MessageType_ThpStartPairingRequest" => ::std::option::Option::Some(MessageType::MessageType_ThpStartPairingRequest),
"MessageType_ThpPairingPreparationsFinished" => ::std::option::Option::Some(MessageType::MessageType_ThpPairingPreparationsFinished),
"MessageType_ThpCredentialRequest" => ::std::option::Option::Some(MessageType::MessageType_ThpCredentialRequest),
"MessageType_ThpCredentialResponse" => ::std::option::Option::Some(MessageType::MessageType_ThpCredentialResponse),
"MessageType_ThpEndRequest" => ::std::option::Option::Some(MessageType::MessageType_ThpEndRequest),
"MessageType_ThpEndResponse" => ::std::option::Option::Some(MessageType::MessageType_ThpEndResponse),
"MessageType_ThpCodeEntryCommitment" => ::std::option::Option::Some(MessageType::MessageType_ThpCodeEntryCommitment),
"MessageType_ThpCodeEntryChallenge" => ::std::option::Option::Some(MessageType::MessageType_ThpCodeEntryChallenge),
"MessageType_ThpCodeEntryCpaceHost" => ::std::option::Option::Some(MessageType::MessageType_ThpCodeEntryCpaceHost),
"MessageType_ThpCodeEntryCpaceTrezor" => ::std::option::Option::Some(MessageType::MessageType_ThpCodeEntryCpaceTrezor),
"MessageType_ThpCodeEntryTag" => ::std::option::Option::Some(MessageType::MessageType_ThpCodeEntryTag),
"MessageType_ThpCodeEntrySecret" => ::std::option::Option::Some(MessageType::MessageType_ThpCodeEntrySecret),
"MessageType_ThpQrCodeTag" => ::std::option::Option::Some(MessageType::MessageType_ThpQrCodeTag),
"MessageType_ThpQrCodeSecret" => ::std::option::Option::Some(MessageType::MessageType_ThpQrCodeSecret),
"MessageType_ThpNfcUnidirectionalTag" => ::std::option::Option::Some(MessageType::MessageType_ThpNfcUnidirectionalTag),
"MessageType_ThpNfcUnidirectionalSecret" => ::std::option::Option::Some(MessageType::MessageType_ThpNfcUnidirectionalSecret),
_ => ::std::option::Option::None
}
}
@ -1347,24 +1275,6 @@ impl ::protobuf::Enum for MessageType {
MessageType::MessageType_BenchmarkNames,
MessageType::MessageType_BenchmarkRun,
MessageType::MessageType_BenchmarkResult,
MessageType::MessageType_ThpCreateNewSession,
MessageType::MessageType_ThpNewSession,
MessageType::MessageType_ThpStartPairingRequest,
MessageType::MessageType_ThpPairingPreparationsFinished,
MessageType::MessageType_ThpCredentialRequest,
MessageType::MessageType_ThpCredentialResponse,
MessageType::MessageType_ThpEndRequest,
MessageType::MessageType_ThpEndResponse,
MessageType::MessageType_ThpCodeEntryCommitment,
MessageType::MessageType_ThpCodeEntryChallenge,
MessageType::MessageType_ThpCodeEntryCpaceHost,
MessageType::MessageType_ThpCodeEntryCpaceTrezor,
MessageType::MessageType_ThpCodeEntryTag,
MessageType::MessageType_ThpCodeEntrySecret,
MessageType::MessageType_ThpQrCodeTag,
MessageType::MessageType_ThpQrCodeSecret,
MessageType::MessageType_ThpNfcUnidirectionalTag,
MessageType::MessageType_ThpNfcUnidirectionalSecret,
];
}
@ -1621,24 +1531,6 @@ impl ::protobuf::EnumFull for MessageType {
MessageType::MessageType_BenchmarkNames => 242,
MessageType::MessageType_BenchmarkRun => 243,
MessageType::MessageType_BenchmarkResult => 244,
MessageType::MessageType_ThpCreateNewSession => 245,
MessageType::MessageType_ThpNewSession => 246,
MessageType::MessageType_ThpStartPairingRequest => 247,
MessageType::MessageType_ThpPairingPreparationsFinished => 248,
MessageType::MessageType_ThpCredentialRequest => 249,
MessageType::MessageType_ThpCredentialResponse => 250,
MessageType::MessageType_ThpEndRequest => 251,
MessageType::MessageType_ThpEndResponse => 252,
MessageType::MessageType_ThpCodeEntryCommitment => 253,
MessageType::MessageType_ThpCodeEntryChallenge => 254,
MessageType::MessageType_ThpCodeEntryCpaceHost => 255,
MessageType::MessageType_ThpCodeEntryCpaceTrezor => 256,
MessageType::MessageType_ThpCodeEntryTag => 257,
MessageType::MessageType_ThpCodeEntrySecret => 258,
MessageType::MessageType_ThpQrCodeTag => 259,
MessageType::MessageType_ThpQrCodeSecret => 260,
MessageType::MessageType_ThpNfcUnidirectionalTag => 261,
MessageType::MessageType_ThpNfcUnidirectionalSecret => 262,
};
Self::enum_descriptor().value_by_index(index)
}
@ -1658,7 +1550,7 @@ impl MessageType {
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x0emessages.proto\x12\x12hw.trezor.messages\x1a\x20google/protobuf/de\
scriptor.proto\x1a\roptions.proto*\xe7[\n\x0bMessageType\x12(\n\x16Messa\
scriptor.proto\x1a\roptions.proto*\x89U\n\x0bMessageType\x12(\n\x16Messa\
geType_Initialize\x10\0\x1a\x0c\x80\xa6\x1d\x01\xb0\xb5\x18\x01\x90\xb5\
\x18\x01\x12\x1e\n\x10MessageType_Ping\x10\x01\x1a\x08\x80\xa6\x1d\x01\
\x90\xb5\x18\x01\x12%\n\x13MessageType_Success\x10\x02\x1a\x0c\x80\xa6\
@ -1935,34 +1827,11 @@ static file_descriptor_proto_data: &'static [u8] = b"\
s\x10\x8cG\x1a\x04\x80\xa6\x1d\x01\x12%\n\x1aMessageType_BenchmarkNames\
\x10\x8dG\x1a\x04\x80\xa6\x1d\x01\x12#\n\x18MessageType_BenchmarkRun\x10\
\x8eG\x1a\x04\x80\xa6\x1d\x01\x12&\n\x1bMessageType_BenchmarkResult\x10\
\x8fG\x1a\x04\x80\xa6\x1d\x01\x12.\n\x1fMessageType_ThpCreateNewSession\
\x10\xe8\x07\x1a\x08\x80\xa6\x1d\x01\xc8\xb5\x18\x01\x12(\n\x19MessageTy\
pe_ThpNewSession\x10\xe9\x07\x1a\x08\x80\xa6\x1d\x01\xd0\xb5\x18\x01\x12\
1\n\"MessageType_ThpStartPairingRequest\x10\xf0\x07\x1a\x08\x80\xa6\x1d\
\x01\xd8\xb5\x18\x01\x129\n*MessageType_ThpPairingPreparationsFinished\
\x10\xf1\x07\x1a\x08\x80\xa6\x1d\x01\xe0\xb5\x18\x01\x12/\n\x20MessageTy\
pe_ThpCredentialRequest\x10\xf2\x07\x1a\x08\x80\xa6\x1d\x01\xd8\xb5\x18\
\x01\x120\n!MessageType_ThpCredentialResponse\x10\xf3\x07\x1a\x08\x80\
\xa6\x1d\x01\xe0\xb5\x18\x01\x12(\n\x19MessageType_ThpEndRequest\x10\xf4\
\x07\x1a\x08\x80\xa6\x1d\x01\xd8\xb5\x18\x01\x12)\n\x1aMessageType_ThpEn\
dResponse\x10\xf5\x07\x1a\x08\x80\xa6\x1d\x01\xe0\xb5\x18\x01\x121\n\"Me\
ssageType_ThpCodeEntryCommitment\x10\xf8\x07\x1a\x08\x80\xa6\x1d\x01\xe0\
\xb5\x18\x01\x120\n!MessageType_ThpCodeEntryChallenge\x10\xf9\x07\x1a\
\x08\x80\xa6\x1d\x01\xd8\xb5\x18\x01\x120\n!MessageType_ThpCodeEntryCpac\
eHost\x10\xfa\x07\x1a\x08\x80\xa6\x1d\x01\xd8\xb5\x18\x01\x122\n#Message\
Type_ThpCodeEntryCpaceTrezor\x10\xfb\x07\x1a\x08\x80\xa6\x1d\x01\xe0\xb5\
\x18\x01\x12*\n\x1bMessageType_ThpCodeEntryTag\x10\xfc\x07\x1a\x08\x80\
\xa6\x1d\x01\xd8\xb5\x18\x01\x12-\n\x1eMessageType_ThpCodeEntrySecret\
\x10\xfd\x07\x1a\x08\x80\xa6\x1d\x01\xe0\xb5\x18\x01\x12'\n\x18MessageTy\
pe_ThpQrCodeTag\x10\x80\x08\x1a\x08\x80\xa6\x1d\x01\xd8\xb5\x18\x01\x12*\
\n\x1bMessageType_ThpQrCodeSecret\x10\x81\x08\x1a\x08\x80\xa6\x1d\x01\
\xe0\xb5\x18\x01\x122\n#MessageType_ThpNfcUnidirectionalTag\x10\x88\x08\
\x1a\x08\x80\xa6\x1d\x01\xd8\xb5\x18\x01\x125\n&MessageType_ThpNfcUnidir\
ectionalSecret\x10\x89\x08\x1a\x08\x80\xa6\x1d\x01\xd8\xb5\x18\x01\x1a\
\x04\xc8\xf3\x18\x01\"\x04\x08Z\x10\\\"\x04\x08G\x10J\"\x04\x08r\x10z\"\
\x06\x08\xdb\x01\x10\xdb\x01\"\x06\x08\xe0\x01\x10\xe0\x01\"\x06\x08\xac\
\x02\x10\xb0\x02\"\x06\x08\xb5\x02\x10\xb8\x02B8\n#com.satoshilabs.trezo\
r.lib.protobufB\rTrezorMessage\x80\xa6\x1d\x01\
\x8fG\x1a\x04\x80\xa6\x1d\x01\x1a\x04\xc8\xf3\x18\x01\"\x04\x08Z\x10\\\"\
\x04\x08G\x10J\"\x04\x08r\x10z\"\x06\x08\xdb\x01\x10\xdb\x01\"\x06\x08\
\xe0\x01\x10\xe0\x01\"\x06\x08\xac\x02\x10\xb0\x02\"\x06\x08\xb5\x02\x10\
\xb8\x02\"\x06\x08\xe8\x07\x10\xcb\x08B8\n#com.satoshilabs.trezor.lib.pr\
otobufB\rTrezorMessage\x80\xa6\x1d\x01\
";
/// `FileDescriptorProto` object which was a source for this generated file

View File

@ -3796,6 +3796,168 @@ impl ::protobuf::reflect::ProtobufValue for ThpAuthenticatedCredentialData {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)]
// @@protoc_insertion_point(enum:hw.trezor.messages.thp.ThpMessageType)
pub enum ThpMessageType {
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpCreateNewSession)
ThpMessageType_ThpCreateNewSession = 1000,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpNewSession)
ThpMessageType_ThpNewSession = 1001,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpStartPairingRequest)
ThpMessageType_ThpStartPairingRequest = 1008,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpPairingPreparationsFinished)
ThpMessageType_ThpPairingPreparationsFinished = 1009,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpCredentialRequest)
ThpMessageType_ThpCredentialRequest = 1010,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpCredentialResponse)
ThpMessageType_ThpCredentialResponse = 1011,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpEndRequest)
ThpMessageType_ThpEndRequest = 1012,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpEndResponse)
ThpMessageType_ThpEndResponse = 1013,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpCodeEntryCommitment)
ThpMessageType_ThpCodeEntryCommitment = 1016,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpCodeEntryChallenge)
ThpMessageType_ThpCodeEntryChallenge = 1017,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpCodeEntryCpaceHost)
ThpMessageType_ThpCodeEntryCpaceHost = 1018,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpCodeEntryCpaceTrezor)
ThpMessageType_ThpCodeEntryCpaceTrezor = 1019,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpCodeEntryTag)
ThpMessageType_ThpCodeEntryTag = 1020,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpCodeEntrySecret)
ThpMessageType_ThpCodeEntrySecret = 1021,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpQrCodeTag)
ThpMessageType_ThpQrCodeTag = 1024,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpQrCodeSecret)
ThpMessageType_ThpQrCodeSecret = 1025,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpNfcUnidirectionalTag)
ThpMessageType_ThpNfcUnidirectionalTag = 1032,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpMessageType.ThpMessageType_ThpNfcUnidirectionalSecret)
ThpMessageType_ThpNfcUnidirectionalSecret = 1033,
}
impl ::protobuf::Enum for ThpMessageType {
const NAME: &'static str = "ThpMessageType";
fn value(&self) -> i32 {
*self as i32
}
fn from_i32(value: i32) -> ::std::option::Option<ThpMessageType> {
match value {
1000 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCreateNewSession),
1001 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpNewSession),
1008 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpStartPairingRequest),
1009 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpPairingPreparationsFinished),
1010 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCredentialRequest),
1011 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCredentialResponse),
1012 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpEndRequest),
1013 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpEndResponse),
1016 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCodeEntryCommitment),
1017 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCodeEntryChallenge),
1018 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCodeEntryCpaceHost),
1019 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCodeEntryCpaceTrezor),
1020 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCodeEntryTag),
1021 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCodeEntrySecret),
1024 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpQrCodeTag),
1025 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpQrCodeSecret),
1032 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpNfcUnidirectionalTag),
1033 => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpNfcUnidirectionalSecret),
_ => ::std::option::Option::None
}
}
fn from_str(str: &str) -> ::std::option::Option<ThpMessageType> {
match str {
"ThpMessageType_ThpCreateNewSession" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCreateNewSession),
"ThpMessageType_ThpNewSession" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpNewSession),
"ThpMessageType_ThpStartPairingRequest" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpStartPairingRequest),
"ThpMessageType_ThpPairingPreparationsFinished" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpPairingPreparationsFinished),
"ThpMessageType_ThpCredentialRequest" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCredentialRequest),
"ThpMessageType_ThpCredentialResponse" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCredentialResponse),
"ThpMessageType_ThpEndRequest" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpEndRequest),
"ThpMessageType_ThpEndResponse" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpEndResponse),
"ThpMessageType_ThpCodeEntryCommitment" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCodeEntryCommitment),
"ThpMessageType_ThpCodeEntryChallenge" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCodeEntryChallenge),
"ThpMessageType_ThpCodeEntryCpaceHost" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCodeEntryCpaceHost),
"ThpMessageType_ThpCodeEntryCpaceTrezor" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCodeEntryCpaceTrezor),
"ThpMessageType_ThpCodeEntryTag" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCodeEntryTag),
"ThpMessageType_ThpCodeEntrySecret" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpCodeEntrySecret),
"ThpMessageType_ThpQrCodeTag" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpQrCodeTag),
"ThpMessageType_ThpQrCodeSecret" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpQrCodeSecret),
"ThpMessageType_ThpNfcUnidirectionalTag" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpNfcUnidirectionalTag),
"ThpMessageType_ThpNfcUnidirectionalSecret" => ::std::option::Option::Some(ThpMessageType::ThpMessageType_ThpNfcUnidirectionalSecret),
_ => ::std::option::Option::None
}
}
const VALUES: &'static [ThpMessageType] = &[
ThpMessageType::ThpMessageType_ThpCreateNewSession,
ThpMessageType::ThpMessageType_ThpNewSession,
ThpMessageType::ThpMessageType_ThpStartPairingRequest,
ThpMessageType::ThpMessageType_ThpPairingPreparationsFinished,
ThpMessageType::ThpMessageType_ThpCredentialRequest,
ThpMessageType::ThpMessageType_ThpCredentialResponse,
ThpMessageType::ThpMessageType_ThpEndRequest,
ThpMessageType::ThpMessageType_ThpEndResponse,
ThpMessageType::ThpMessageType_ThpCodeEntryCommitment,
ThpMessageType::ThpMessageType_ThpCodeEntryChallenge,
ThpMessageType::ThpMessageType_ThpCodeEntryCpaceHost,
ThpMessageType::ThpMessageType_ThpCodeEntryCpaceTrezor,
ThpMessageType::ThpMessageType_ThpCodeEntryTag,
ThpMessageType::ThpMessageType_ThpCodeEntrySecret,
ThpMessageType::ThpMessageType_ThpQrCodeTag,
ThpMessageType::ThpMessageType_ThpQrCodeSecret,
ThpMessageType::ThpMessageType_ThpNfcUnidirectionalTag,
ThpMessageType::ThpMessageType_ThpNfcUnidirectionalSecret,
];
}
impl ::protobuf::EnumFull for ThpMessageType {
fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().enum_by_package_relative_name("ThpMessageType").unwrap()).clone()
}
fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor {
let index = match self {
ThpMessageType::ThpMessageType_ThpCreateNewSession => 0,
ThpMessageType::ThpMessageType_ThpNewSession => 1,
ThpMessageType::ThpMessageType_ThpStartPairingRequest => 2,
ThpMessageType::ThpMessageType_ThpPairingPreparationsFinished => 3,
ThpMessageType::ThpMessageType_ThpCredentialRequest => 4,
ThpMessageType::ThpMessageType_ThpCredentialResponse => 5,
ThpMessageType::ThpMessageType_ThpEndRequest => 6,
ThpMessageType::ThpMessageType_ThpEndResponse => 7,
ThpMessageType::ThpMessageType_ThpCodeEntryCommitment => 8,
ThpMessageType::ThpMessageType_ThpCodeEntryChallenge => 9,
ThpMessageType::ThpMessageType_ThpCodeEntryCpaceHost => 10,
ThpMessageType::ThpMessageType_ThpCodeEntryCpaceTrezor => 11,
ThpMessageType::ThpMessageType_ThpCodeEntryTag => 12,
ThpMessageType::ThpMessageType_ThpCodeEntrySecret => 13,
ThpMessageType::ThpMessageType_ThpQrCodeTag => 14,
ThpMessageType::ThpMessageType_ThpQrCodeSecret => 15,
ThpMessageType::ThpMessageType_ThpNfcUnidirectionalTag => 16,
ThpMessageType::ThpMessageType_ThpNfcUnidirectionalSecret => 17,
};
Self::enum_descriptor().value_by_index(index)
}
}
// Note, `Default` is implemented although default value is not 0
impl ::std::default::Default for ThpMessageType {
fn default() -> Self {
ThpMessageType::ThpMessageType_ThpCreateNewSession
}
}
impl ThpMessageType {
fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData {
::protobuf::reflect::GeneratedEnumDescriptorData::new::<ThpMessageType>("ThpMessageType")
}
}
#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)]
// @@protoc_insertion_point(enum:hw.trezor.messages.thp.ThpPairingMethod)
pub enum ThpPairingMethod {
@ -3914,10 +4076,36 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x98\xb2\x19\x01\"\xa8\x01\n\x1eThpAuthenticatedCredentialData\x12,\n\
\x12host_static_pubkey\x18\x01\x20\x01(\x0cR\x10hostStaticPubkey\x12R\n\
\rcred_metadata\x18\x02\x20\x01(\x0b2-.hw.trezor.messages.thp.ThpCredent\
ialMetadataR\x0ccredMetadata:\x04\x98\xb2\x19\x01*S\n\x10ThpPairingMetho\
d\x12\x0c\n\x08NoMethod\x10\x01\x12\r\n\tCodeEntry\x10\x02\x12\n\n\x06Qr\
Code\x10\x03\x12\x16\n\x12NFC_Unidirectional\x10\x04B;\n#com.satoshilabs\
.trezor.lib.protobufB\x10TrezorMessageThp\x80\xa6\x1d\x01\
ialMetadataR\x0ccredMetadata:\x04\x98\xb2\x19\x01*\xbe\x07\n\x0eThpMessa\
geType\x121\n\"ThpMessageType_ThpCreateNewSession\x10\xe8\x07\x1a\x08\
\x80\xa6\x1d\x01\xc8\xb5\x18\x01\x12+\n\x1cThpMessageType_ThpNewSession\
\x10\xe9\x07\x1a\x08\x80\xa6\x1d\x01\xd0\xb5\x18\x01\x124\n%ThpMessageTy\
pe_ThpStartPairingRequest\x10\xf0\x07\x1a\x08\x80\xa6\x1d\x01\xd8\xb5\
\x18\x01\x12<\n-ThpMessageType_ThpPairingPreparationsFinished\x10\xf1\
\x07\x1a\x08\x80\xa6\x1d\x01\xe0\xb5\x18\x01\x122\n#ThpMessageType_ThpCr\
edentialRequest\x10\xf2\x07\x1a\x08\x80\xa6\x1d\x01\xd8\xb5\x18\x01\x123\
\n$ThpMessageType_ThpCredentialResponse\x10\xf3\x07\x1a\x08\x80\xa6\x1d\
\x01\xe0\xb5\x18\x01\x12+\n\x1cThpMessageType_ThpEndRequest\x10\xf4\x07\
\x1a\x08\x80\xa6\x1d\x01\xd8\xb5\x18\x01\x12,\n\x1dThpMessageType_ThpEnd\
Response\x10\xf5\x07\x1a\x08\x80\xa6\x1d\x01\xe0\xb5\x18\x01\x124\n%ThpM\
essageType_ThpCodeEntryCommitment\x10\xf8\x07\x1a\x08\x80\xa6\x1d\x01\
\xe0\xb5\x18\x01\x123\n$ThpMessageType_ThpCodeEntryChallenge\x10\xf9\x07\
\x1a\x08\x80\xa6\x1d\x01\xd8\xb5\x18\x01\x123\n$ThpMessageType_ThpCodeEn\
tryCpaceHost\x10\xfa\x07\x1a\x08\x80\xa6\x1d\x01\xd8\xb5\x18\x01\x125\n&\
ThpMessageType_ThpCodeEntryCpaceTrezor\x10\xfb\x07\x1a\x08\x80\xa6\x1d\
\x01\xe0\xb5\x18\x01\x12-\n\x1eThpMessageType_ThpCodeEntryTag\x10\xfc\
\x07\x1a\x08\x80\xa6\x1d\x01\xd8\xb5\x18\x01\x120\n!ThpMessageType_ThpCo\
deEntrySecret\x10\xfd\x07\x1a\x08\x80\xa6\x1d\x01\xe0\xb5\x18\x01\x12*\n\
\x1bThpMessageType_ThpQrCodeTag\x10\x80\x08\x1a\x08\x80\xa6\x1d\x01\xd8\
\xb5\x18\x01\x12-\n\x1eThpMessageType_ThpQrCodeSecret\x10\x81\x08\x1a\
\x08\x80\xa6\x1d\x01\xe0\xb5\x18\x01\x125\n&ThpMessageType_ThpNfcUnidire\
ctionalTag\x10\x88\x08\x1a\x08\x80\xa6\x1d\x01\xd8\xb5\x18\x01\x128\n)Th\
pMessageType_ThpNfcUnidirectionalSecret\x10\x89\x08\x1a\x08\x80\xa6\x1d\
\x01\xd8\xb5\x18\x01\"\x05\x08\0\x10\xe7\x07\"\t\x08\xcc\x08\x10\xff\xff\
\xff\xff\x07*S\n\x10ThpPairingMethod\x12\x0c\n\x08NoMethod\x10\x01\x12\r\
\n\tCodeEntry\x10\x02\x12\n\n\x06QrCode\x10\x03\x12\x16\n\x12NFC_Unidire\
ctional\x10\x04B;\n#com.satoshilabs.trezor.lib.protobufB\x10TrezorMessag\
eThp\x80\xa6\x1d\x01\
";
/// `FileDescriptorProto` object which was a source for this generated file
@ -3960,7 +4148,8 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
messages.push(ThpCredentialMetadata::generated_message_descriptor_data());
messages.push(ThpPairingCredential::generated_message_descriptor_data());
messages.push(ThpAuthenticatedCredentialData::generated_message_descriptor_data());
let mut enums = ::std::vec::Vec::with_capacity(1);
let mut enums = ::std::vec::Vec::with_capacity(2);
enums.push(ThpMessageType::generated_enum_descriptor_data());
enums.push(ThpPairingMethod::generated_enum_descriptor_data());
::protobuf::reflect::GeneratedFileDescriptor::new_generated(
file_descriptor_proto(),