Compare commits

...

9 Commits

@ -7,32 +7,50 @@ option java_outer_classname = "TrezorMessageThp";
// Numeric identifiers of pairing methods.
enum PairingMethod {
PairingMethod_None = 1; // Trust without MITM protection.
/**
* Numeric identifiers of pairing methods.
* @embed
*/
enum ThpPairingMethod {
PairingMethod_NoMethod = 1; // Trust without MITM protection.
PairingMethod_CodeEntry = 2; // User types code diplayed on Trezor into the host application.
PairingMethod_QrCode = 3; // User scans code displayed on Trezor into host application.
PairingMethod_NFC_Unidirectional = 4; // Trezor transmits an authentication key to the host device via NFC.
}
message DeviceProperties {
/**
* @embed
*/
message ThpDeviceProperties {
optional string internal_model = 1; // Internal model name e.g. "T2B1".
optional uint32 model_variant = 2; // Encodes the device properties such as color.
optional bool bootloader_mode = 3; // Indicates whether the device is in bootloader or firmware mode.
optional uint32 protocol_version = 4; // The communication protocol version supported by the firmware.
repeated PairingMethod pairing_methods = 5; // The pairing methods supported by the Trezor.
repeated ThpPairingMethod pairing_methods = 5; // The pairing methods supported by the Trezor.
}
message HandshakeCompletionReqNoisePayload {
/**
* @embed
*/
message ThpHandshakeCompletionReqNoisePayload {
optional bytes host_pairing_credential = 1; // Host's pairing credential
repeated PairingMethod pairing_methods = 2; // The pairing methods chosen by the host
repeated ThpPairingMethod pairing_methods = 2; // The pairing methods chosen by the host
}
message CreateNewSession{
/**
* Request: Ask device for a new session with given passphrase
* @start
* @next ThpNewSession
*/
message ThpCreateNewSession{
optional string passphrase = 1;
optional bool on_device = 2; // user wants to enter passphrase on the device
}
message NewSession{
/**
* Response: Contains session_id of the newly created session
* @end
*/
message ThpNewSession{
optional uint32 new_session_id = 1;
}

@ -377,13 +377,13 @@ enum MessageType {
MessageType_SolanaTxSignature = 905 [(wire_out) = true];
// THP
MessageType_StartPairingRequest = 1000 [(bitcoin_only) = true, (wire_in) = true];
MessageType_StartPairingResponse = 1001 [(bitcoin_only) = true, (wire_out) = true];
MessageType_CredentialRequest = 1002 [(bitcoin_only) = true, (wire_in) = true];
MessageType_CredentialResponse = 1003 [(bitcoin_only) = true, (wire_out) = true];
MessageType_EndRequest = 1004 [(bitcoin_only) = true, (wire_in) = true];
MessageType_EndResponse = 1005 [(bitcoin_only) = true, (wire_out) = true];
MessageType_CreateNewSession = 1006[(bitcoin_only)=true,(wire_in)=true];
MessageType_NewSession = 1007[(bitcoin_only)=true,(wire_out)=true];
MessageType_ThpStartPairingRequest = 1000 [(bitcoin_only) = true, (wire_in) = true];
MessageType_ThpStartPairingResponse = 1001 [(bitcoin_only) = true, (wire_out) = true];
MessageType_ThpCredentialRequest = 1002 [(bitcoin_only) = true, (wire_in) = true];
MessageType_ThpCredentialResponse = 1003 [(bitcoin_only) = true, (wire_out) = true];
MessageType_ThpEndRequest = 1004 [(bitcoin_only) = true, (wire_in) = true];
MessageType_ThpEndResponse = 1005 [(bitcoin_only) = true, (wire_out) = true];
MessageType_ThpCreateNewSession = 1006[(bitcoin_only)=true,(wire_in)=true];
MessageType_ThpNewSession = 1007[(bitcoin_only)=true,(wire_out)=true];
}

@ -133,6 +133,8 @@ trezor.enums.SafetyCheckLevel
import trezor.enums.SafetyCheckLevel
trezor.enums.SdProtectOperationType
import trezor.enums.SdProtectOperationType
trezor.enums.ThpPairingMethod
import trezor.enums.ThpPairingMethod
trezor.enums.WordRequestType
import trezor.enums.WordRequestType
trezor.enums
@ -215,8 +217,8 @@ trezor.wire.thp
import trezor.wire.thp
trezor.wire.thp.ack_handler
import trezor.wire.thp.ack_handler
trezor.wire.thp.channel_context
import trezor.wire.thp.channel_context
trezor.wire.thp.channel
import trezor.wire.thp.channel
trezor.wire.thp.checksum
import trezor.wire.thp.checksum
trezor.wire.thp.session_context

@ -97,6 +97,14 @@ DebugLinkRecordScreen = 9003
DebugLinkEraseSdCard = 9005
DebugLinkWatchLayout = 9006
DebugLinkResetDebugEvents = 9007
ThpStartPairingRequest = 1000
ThpStartPairingResponse = 1001
ThpCredentialRequest = 1002
ThpCredentialResponse = 1003
ThpEndRequest = 1004
ThpEndResponse = 1005
ThpCreateNewSession = 1006
ThpNewSession = 1007
if not utils.BITCOIN_ONLY:
SetU2FCounter = 63
GetNextU2FCounter = 80

@ -0,0 +1,8 @@
# Automatically generated by pb2py
# fmt: off
# isort:skip_file
PairingMethod_NoMethod = 1
PairingMethod_CodeEntry = 2
PairingMethod_QrCode = 3
PairingMethod_NFC_Unidirectional = 4

@ -264,7 +264,14 @@ if TYPE_CHECKING:
SolanaAddress = 903
SolanaSignTx = 904
SolanaTxSignature = 905
CreateNewSession = 1006
ThpStartPairingRequest = 1000
ThpStartPairingResponse = 1001
ThpCredentialRequest = 1002
ThpCredentialResponse = 1003
ThpEndRequest = 1004
ThpEndResponse = 1005
ThpCreateNewSession = 1006
ThpNewSession = 1007
class FailureType(IntEnum):
UnexpectedMessage = 1
@ -544,3 +551,9 @@ if TYPE_CHECKING:
Yay = 0
Nay = 1
Pass = 2
class ThpPairingMethod(IntEnum):
PairingMethod_NoMethod = 1
PairingMethod_CodeEntry = 2
PairingMethod_QrCode = 3
PairingMethod_NFC_Unidirectional = 4

@ -61,6 +61,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 ThpPairingMethod # noqa: F401
from trezor.enums import WordRequestType # noqa: F401
class BinanceGetAddress(protobuf.MessageType):
@ -372,22 +373,6 @@ if TYPE_CHECKING:
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["PassphraseAck"]:
return isinstance(msg, cls)
class CreateNewSession(protobuf.MessageType):
passphrase: "str | None"
on_device: "bool | None"
def __init__(
self,
*,
passphrase: "str | None" = None,
on_device: "bool | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["CreateNewSession"]:
return isinstance(msg, cls)
class HDNodeType(protobuf.MessageType):
depth: "int"
@ -6111,6 +6096,74 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: Any) -> TypeGuard["TezosManagerTransfer"]:
return isinstance(msg, cls)
class ThpDeviceProperties(protobuf.MessageType):
internal_model: "str | None"
model_variant: "int | None"
bootloader_mode: "bool | None"
protocol_version: "int | None"
pairing_methods: "list[ThpPairingMethod]"
def __init__(
self,
*,
pairing_methods: "list[ThpPairingMethod] | None" = None,
internal_model: "str | None" = None,
model_variant: "int | None" = None,
bootloader_mode: "bool | None" = None,
protocol_version: "int | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["ThpDeviceProperties"]:
return isinstance(msg, cls)
class ThpHandshakeCompletionReqNoisePayload(protobuf.MessageType):
host_pairing_credential: "bytes | None"
pairing_methods: "list[ThpPairingMethod]"
def __init__(
self,
*,
pairing_methods: "list[ThpPairingMethod] | None" = None,
host_pairing_credential: "bytes | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["ThpHandshakeCompletionReqNoisePayload"]:
return isinstance(msg, cls)
class ThpCreateNewSession(protobuf.MessageType):
passphrase: "str | None"
on_device: "bool | None"
def __init__(
self,
*,
passphrase: "str | None" = None,
on_device: "bool | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["ThpCreateNewSession"]:
return isinstance(msg, cls)
class ThpNewSession(protobuf.MessageType):
new_session_id: "int | None"
def __init__(
self,
*,
new_session_id: "int | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["ThpNewSession"]:
return isinstance(msg, cls)
class WebAuthnListResidentCredentials(protobuf.MessageType):
@classmethod

@ -42,7 +42,7 @@ if TYPE_CHECKING:
T = TypeVar("T")
class UnexpectedMessage(Exception):
class UnexpectedMessageWithId(Exception):
"""A message was received that is not part of the current workflow.
Utility exception to inform the session handler that the current workflow
@ -118,7 +118,7 @@ class CodecContext(Context):
# If we got a message with unexpected type, raise the message via
# `UnexpectedMessageError` and let the session handler deal with it.
if msg.type not in expected_types:
raise UnexpectedMessage(msg)
raise UnexpectedMessageWithId(msg)
# TODO check that the message has the expected session_id. If not, raise UnexpectedMessageError
# (and maybe update ctx.session_id - depends on expected behaviour)

@ -137,7 +137,7 @@ async def handle_single_message(
# results of the handler.
res_msg = await task
except context.UnexpectedMessage as exc:
except context.UnexpectedMessageWithId as exc:
# Workflow was trying to read a message from the wire, and
# something unexpected came in. See Context.read() for
# example, which expects some particular message and raises

@ -4,6 +4,7 @@ from trezor import protobuf
if TYPE_CHECKING:
from trezorio import WireInterface # pyright: ignore[reportMissingImports]
from typing import Container # pyright: ignore[reportShadowedImports]
class Message:
@ -46,6 +47,12 @@ class Context:
self.iface: WireInterface = iface
self.channel_id: bytes = channel_id
async def read(
self,
expected_types: Container[int],
expected_type: type[protobuf.MessageType] | None = None,
) -> protobuf.MessageType: ...
async def write(self, msg: protobuf.MessageType) -> None: ...

@ -7,10 +7,10 @@ import usb
from storage import cache_thp
from storage.cache_thp import KEY_LENGTH, TAG_LENGTH, ChannelCache
from trezor import loop, protobuf, utils
from trezor.messages import CreateNewSession
from trezor.messages import ThpCreateNewSession
from trezor.wire import message_handler
from ..protocol_common import Context
from ..protocol_common import Context, MessageWithType
from . import ChannelState, SessionState, checksum
from . import thp_session as THP
from .checksum import CHECKSUM_LENGTH
@ -39,7 +39,7 @@ REPORT_LENGTH = const(64)
MAX_PAYLOAD_LEN = const(60000)
class ChannelContext(Context):
class Channel(Context):
def __init__(self, channel_cache: ChannelCache) -> None:
iface = _decode_iface(channel_cache.iface)
super().__init__(iface, channel_cache.channel_id)
@ -56,7 +56,7 @@ class ChannelContext(Context):
@classmethod
def create_new_channel(
cls, iface: WireInterface, buffer: utils.BufferType
) -> "ChannelContext":
) -> "Channel":
channel_cache = cache_thp.get_new_unauthenticated_channel(_encode_iface(iface))
r = cls(channel_cache)
r.set_buffer(buffer)
@ -197,11 +197,11 @@ class ChannelContext(Context):
message = message_handler.wrap_protobuf_load(buf, expected_type)
print(message)
# ------------------------------------------------TYPE ERROR------------------------------------------------
session_message: CreateNewSession = message
print("passphrase:", session_message.passphrase)
assert isinstance(message, ThpCreateNewSession)
print("passphrase:", message.passphrase)
# await thp_messages.handle_CreateNewSession(message)
if session_message.passphrase is not None:
self.create_new_session(session_message.passphrase)
if message.passphrase is not None:
self.create_new_session(message.passphrase)
else:
self.create_new_session()
except Exception as e:
@ -217,9 +217,11 @@ class ChannelContext(Context):
if session_state is SessionState.UNALLOCATED:
raise Exception("Unalloacted session")
await self.sessions[session_id].receive_message(
message_type,
self.buffer[INIT_DATA_OFFSET + 3 : msg_len - CHECKSUM_LENGTH],
self.sessions[session_id].incoming_message.publish(
MessageWithType(
message_type,
self.buffer[INIT_DATA_OFFSET + 3 : msg_len - CHECKSUM_LENGTH],
)
)
if state is ChannelState.TH2:
@ -263,6 +265,8 @@ class ChannelContext(Context):
pass
# TODO protocol.write(self.iface, self.channel_id, session_id, msg)
# OTHER
def create_new_session(
self,
passphrase="",
@ -273,10 +277,9 @@ class ChannelContext(Context):
session = SessionContext.create_new_session(self)
print("help")
self.sessions[session.session_id] = session
loop.schedule(session.handle())
print("new session created. Session id:", session.session_id)
# OTHER
def _todo_clear_buffer(self):
# TODO Buffer clearing not implemented
pass
@ -300,11 +303,11 @@ class ChannelContext(Context):
return THP.sync_get_send_bit(self.channel_cache) != sync_bit
def load_cached_channels(buffer: utils.BufferType) -> dict[int, ChannelContext]: # TODO
channels: dict[int, ChannelContext] = {}
def load_cached_channels(buffer: utils.BufferType) -> dict[int, Channel]: # TODO
channels: dict[int, Channel] = {}
cached_channels = cache_thp.get_all_allocated_channels()
for c in cached_channels:
channels[int.from_bytes(c.channel_id, "big")] = ChannelContext(c)
channels[int.from_bytes(c.channel_id, "big")] = Channel(c)
for c in channels.values():
c.set_buffer(buffer)
return channels

@ -1,33 +1,72 @@
from typing import TYPE_CHECKING # pyright: ignore[reportShadowedImports]
from storage import cache_thp
from storage.cache_thp import SessionThpCache
from trezor import protobuf
from trezor import loop, protobuf
from trezor.wire import message_handler
from ..protocol_common import Context
from ..protocol_common import Context, MessageWithType
from . import SessionState
from .channel_context import ChannelContext
from .channel import Channel
if TYPE_CHECKING:
from typing import Container # pyright: ignore[reportShadowedImports]
class UnexpectedMessageWithType(Exception):
"""A message was received that is not part of the current workflow.
Utility exception to inform the session handler that the current workflow
should be aborted and a new one started as if `msg` was the first message.
"""
def __init__(self, msg: MessageWithType) -> None:
super().__init__()
self.msg = msg
class SessionContext(Context):
def __init__(
self, channel_context: ChannelContext, session_cache: SessionThpCache
) -> None:
if channel_context.channel_id != session_cache.channel_id:
def __init__(self, channel: Channel, session_cache: SessionThpCache) -> None:
if channel.channel_id != session_cache.channel_id:
raise Exception(
"The session has different channel id than the provided channel context!"
)
super().__init__(channel_context.iface, channel_context.channel_id)
self.channel_context = channel_context
super().__init__(channel.iface, channel.channel_id)
self.channel_context = channel
self.session_cache = session_cache
self.session_id = int.from_bytes(session_cache.session_id, "big")
async def write(self, msg: protobuf.MessageType) -> None:
return await self.channel_context.write(msg, self.session_id)
self.incoming_message = loop.chan()
@classmethod
def create_new_session(cls, channel_context: ChannelContext) -> "SessionContext":
def create_new_session(cls, channel_context: Channel) -> "SessionContext":
session_cache = cache_thp.get_new_session(channel_context.channel_cache)
return cls(channel_context, session_cache)
async def handle(self) -> None:
take = self.incoming_message.take()
while True:
message = await take
print(message)
# TODO continue similarly to handle_session function in wire.__init__
async def read(
self,
expected_types: Container[int],
expected_type: type[protobuf.MessageType] | None = None,
) -> protobuf.MessageType:
message: MessageWithType = await self.incoming_message.take()
if message.type not in expected_types:
raise UnexpectedMessageWithType(message)
if expected_type is None:
expected_type = protobuf.type_for_wire(message.type)
return message_handler.wrap_protobuf_load(message.data, expected_type)
async def write(self, msg: protobuf.MessageType) -> None:
return await self.channel_context.write(msg, self.session_id)
# ACCESS TO SESSION DATA
def get_session_state(self) -> SessionState:
@ -43,7 +82,7 @@ class SessionContext(Context):
pass # TODO implement
def load_cached_sessions(channel: ChannelContext) -> dict[int, SessionContext]: # TODO
def load_cached_sessions(channel: Channel) -> dict[int, SessionContext]: # TODO
sessions: dict[int, SessionContext] = {}
cached_sessions = cache_thp.get_all_allocated_sessions()
for session in cached_sessions:

@ -2,7 +2,7 @@ import ustruct # pyright:ignore[reportMissingModuleSource]
from storage.cache_thp import BROADCAST_CHANNEL_ID
from trezor import protobuf
from trezor.messages import CreateNewSession
from trezor.messages import ThpCreateNewSession
from .. import message_handler
from ..protocol_common import Message
@ -90,7 +90,7 @@ def decode_message(buffer: bytes, msg_type: int) -> protobuf.MessageType:
return x
async def handle_CreateNewSession(msg: CreateNewSession) -> None:
async def handle_CreateNewSession(msg: ThpCreateNewSession) -> None:
print(msg.passphrase)
print(msg.on_device)
pass

@ -8,12 +8,12 @@ from trezor import io, log, loop, utils
from .protocol_common import MessageWithId
from .thp import ChannelState, ack_handler, checksum, thp_messages
from .thp import thp_session as THP
from .thp.channel_context import (
from .thp.channel import (
CONT_DATA_OFFSET,
INIT_DATA_OFFSET,
MAX_PAYLOAD_LEN,
REPORT_LENGTH,
ChannelContext,
Channel,
load_cached_channels,
)
from .thp.checksum import CHECKSUM_LENGTH
@ -38,7 +38,7 @@ _PLAINTEXT = 0x01
_BUFFER: bytearray
_BUFFER_LOCK = None
_CHANNEL_CONTEXTS: dict[int, ChannelContext] = {}
_CHANNEL_CONTEXTS: dict[int, Channel] = {}
async def read_message(iface: WireInterface, buffer: utils.BufferType) -> MessageWithId:
@ -346,7 +346,7 @@ async def _handle_broadcast(
if not checksum.is_valid(payload[-4:], header.to_bytes() + payload[:-4]):
raise ThpError("Checksum is not valid")
new_context: ChannelContext = ChannelContext.create_new_channel(iface, _BUFFER)
new_context: Channel = Channel.create_new_channel(iface, _BUFFER)
cid = int.from_bytes(new_context.channel_id, "big")
_CHANNEL_CONTEXTS[cid] = new_context

@ -0,0 +1,42 @@
#!/usr/bin/env bash
declare -a results
declare -i passed=0 failed=0 exit_code=0
declare COLOR_GREEN='\e[32m' COLOR_RED='\e[91m' COLOR_RESET='\e[39m'
MICROPYTHON="${MICROPYTHON:-../build/unix/trezor-emu-core -X heapsize=2M}"
print_summary() {
echo
echo 'Summary:'
echo '-------------------'
printf '%b\n' "${results[@]}"
if [ $exit_code == 0 ]; then
echo -e "${COLOR_GREEN}PASSED:${COLOR_RESET} $passed/$num_of_tests tests OK!"
else
echo -e "${COLOR_RED}FAILED:${COLOR_RESET} $failed/$num_of_tests tests failed!"
fi
}
trap 'print_summary; echo -e "${COLOR_RED}Interrupted by user!${COLOR_RESET}"; exit 1' SIGINT
cd $(dirname $0)
[ -z "$*" ] && tests=(test_trezor.wire.t*.py ) || tests=($*)
declare -i num_of_tests=${#tests[@]}
for test_case in ${tests[@]}; do
echo ${MICROPYTHON}
echo ${test_case}
echo
if $MICROPYTHON $test_case; then
results+=("${COLOR_GREEN}OK:${COLOR_RESET} $test_case")
((passed++))
else
results+=("${COLOR_RED}FAIL:${COLOR_RESET} $test_case")
((failed++))
exit_code=1
fi
done
print_summary
exit $exit_code

@ -272,6 +272,14 @@ class MessageType(IntEnum):
SolanaAddress = 903
SolanaSignTx = 904
SolanaTxSignature = 905
ThpStartPairingRequest = 1000
ThpStartPairingResponse = 1001
ThpCredentialRequest = 1002
ThpCredentialResponse = 1003
ThpEndRequest = 1004
ThpEndResponse = 1005
ThpCreateNewSession = 1006
ThpNewSession = 1007
class FailureType(IntEnum):
@ -595,6 +603,13 @@ class TezosBallotType(IntEnum):
Pass = 2
class ThpPairingMethod(IntEnum):
PairingMethod_NoMethod = 1
PairingMethod_CodeEntry = 2
PairingMethod_QrCode = 3
PairingMethod_NFC_Unidirectional = 4
class BinanceGetAddress(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 700
FIELDS = {
@ -7698,6 +7713,80 @@ class TezosManagerTransfer(protobuf.MessageType):
self.amount = amount
class ThpDeviceProperties(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("internal_model", "string", repeated=False, required=False, default=None),
2: protobuf.Field("model_variant", "uint32", repeated=False, required=False, default=None),
3: protobuf.Field("bootloader_mode", "bool", repeated=False, required=False, default=None),
4: protobuf.Field("protocol_version", "uint32", repeated=False, required=False, default=None),
5: protobuf.Field("pairing_methods", "ThpPairingMethod", repeated=True, required=False, default=None),
}
def __init__(
self,
*,
pairing_methods: Optional[Sequence["ThpPairingMethod"]] = None,
internal_model: Optional["str"] = None,
model_variant: Optional["int"] = None,
bootloader_mode: Optional["bool"] = None,
protocol_version: Optional["int"] = None,
) -> None:
self.pairing_methods: Sequence["ThpPairingMethod"] = pairing_methods if pairing_methods is not None else []
self.internal_model = internal_model
self.model_variant = model_variant
self.bootloader_mode = bootloader_mode
self.protocol_version = protocol_version
class ThpHandshakeCompletionReqNoisePayload(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("host_pairing_credential", "bytes", repeated=False, required=False, default=None),
2: protobuf.Field("pairing_methods", "ThpPairingMethod", repeated=True, required=False, default=None),
}
def __init__(
self,
*,
pairing_methods: Optional[Sequence["ThpPairingMethod"]] = None,
host_pairing_credential: Optional["bytes"] = None,
) -> None:
self.pairing_methods: Sequence["ThpPairingMethod"] = pairing_methods if pairing_methods is not None else []
self.host_pairing_credential = host_pairing_credential
class ThpCreateNewSession(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 1006
FIELDS = {
1: protobuf.Field("passphrase", "string", repeated=False, required=False, default=None),
2: protobuf.Field("on_device", "bool", repeated=False, required=False, default=None),
}
def __init__(
self,
*,
passphrase: Optional["str"] = None,
on_device: Optional["bool"] = None,
) -> None:
self.passphrase = passphrase
self.on_device = on_device
class ThpNewSession(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 1007
FIELDS = {
1: protobuf.Field("new_session_id", "uint32", repeated=False, required=False, default=None),
}
def __init__(
self,
*,
new_session_id: Optional["int"] = None,
) -> None:
self.new_session_id = new_session_id
class WebAuthnListResidentCredentials(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 800

@ -183,7 +183,7 @@ class Field:
class _MessageTypeMeta(type):
def __init__(cls, name: str, bases: tuple, d: dict) -> None:
super().__init__(name, bases, d)
super().__init__(name, bases, d) # type: ignore [Expected 1 positional argument]
if name != "MessageType":
cls.__init__ = MessageType.__init__ # type: ignore ["__init__" is obscured by a declaration of the same name;;Cannot assign member "__init__" for type "_MessageTypeMeta"]

@ -82,6 +82,14 @@ trezor_message_impl! {
DebugLinkEraseSdCard => MessageType_DebugLinkEraseSdCard,
DebugLinkWatchLayout => MessageType_DebugLinkWatchLayout,
DebugLinkResetDebugEvents => MessageType_DebugLinkResetDebugEvents,
ThpStartPairingRequest => MessageType_ThpStartPairingRequest,
ThpStartPairingResponse => MessageType_ThpStartPairingResponse,
ThpCredentialRequest => MessageType_ThpCredentialRequest,
ThpCredentialResponse => MessageType_ThpCredentialResponse,
ThpEndRequest => MessageType_ThpEndRequest,
ThpEndResponse => MessageType_ThpEndResponse,
ThpCreateNewSession => MessageType_ThpCreateNewSession,
ThpNewSession => MessageType_ThpNewSession,
}
#[cfg(feature = "binance")]

@ -514,6 +514,22 @@ pub enum MessageType {
MessageType_SolanaSignTx = 904,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SolanaTxSignature)
MessageType_SolanaTxSignature = 905,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpStartPairingRequest)
MessageType_ThpStartPairingRequest = 1000,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpStartPairingResponse)
MessageType_ThpStartPairingResponse = 1001,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpCredentialRequest)
MessageType_ThpCredentialRequest = 1002,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpCredentialResponse)
MessageType_ThpCredentialResponse = 1003,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpEndRequest)
MessageType_ThpEndRequest = 1004,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpEndResponse)
MessageType_ThpEndResponse = 1005,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpCreateNewSession)
MessageType_ThpCreateNewSession = 1006,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_ThpNewSession)
MessageType_ThpNewSession = 1007,
}
impl ::protobuf::Enum for MessageType {
@ -768,6 +784,14 @@ impl ::protobuf::Enum for MessageType {
903 => ::std::option::Option::Some(MessageType::MessageType_SolanaAddress),
904 => ::std::option::Option::Some(MessageType::MessageType_SolanaSignTx),
905 => ::std::option::Option::Some(MessageType::MessageType_SolanaTxSignature),
1000 => ::std::option::Option::Some(MessageType::MessageType_ThpStartPairingRequest),
1001 => ::std::option::Option::Some(MessageType::MessageType_ThpStartPairingResponse),
1002 => ::std::option::Option::Some(MessageType::MessageType_ThpCredentialRequest),
1003 => ::std::option::Option::Some(MessageType::MessageType_ThpCredentialResponse),
1004 => ::std::option::Option::Some(MessageType::MessageType_ThpEndRequest),
1005 => ::std::option::Option::Some(MessageType::MessageType_ThpEndResponse),
1006 => ::std::option::Option::Some(MessageType::MessageType_ThpCreateNewSession),
1007 => ::std::option::Option::Some(MessageType::MessageType_ThpNewSession),
_ => ::std::option::Option::None
}
}
@ -1017,6 +1041,14 @@ impl ::protobuf::Enum for MessageType {
"MessageType_SolanaAddress" => ::std::option::Option::Some(MessageType::MessageType_SolanaAddress),
"MessageType_SolanaSignTx" => ::std::option::Option::Some(MessageType::MessageType_SolanaSignTx),
"MessageType_SolanaTxSignature" => ::std::option::Option::Some(MessageType::MessageType_SolanaTxSignature),
"MessageType_ThpStartPairingRequest" => ::std::option::Option::Some(MessageType::MessageType_ThpStartPairingRequest),
"MessageType_ThpStartPairingResponse" => ::std::option::Option::Some(MessageType::MessageType_ThpStartPairingResponse),
"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_ThpCreateNewSession" => ::std::option::Option::Some(MessageType::MessageType_ThpCreateNewSession),
"MessageType_ThpNewSession" => ::std::option::Option::Some(MessageType::MessageType_ThpNewSession),
_ => ::std::option::Option::None
}
}
@ -1265,6 +1297,14 @@ impl ::protobuf::Enum for MessageType {
MessageType::MessageType_SolanaAddress,
MessageType::MessageType_SolanaSignTx,
MessageType::MessageType_SolanaTxSignature,
MessageType::MessageType_ThpStartPairingRequest,
MessageType::MessageType_ThpStartPairingResponse,
MessageType::MessageType_ThpCredentialRequest,
MessageType::MessageType_ThpCredentialResponse,
MessageType::MessageType_ThpEndRequest,
MessageType::MessageType_ThpEndResponse,
MessageType::MessageType_ThpCreateNewSession,
MessageType::MessageType_ThpNewSession,
];
}
@ -1519,6 +1559,14 @@ impl ::protobuf::EnumFull for MessageType {
MessageType::MessageType_SolanaAddress => 240,
MessageType::MessageType_SolanaSignTx => 241,
MessageType::MessageType_SolanaTxSignature => 242,
MessageType::MessageType_ThpStartPairingRequest => 243,
MessageType::MessageType_ThpStartPairingResponse => 244,
MessageType::MessageType_ThpCredentialRequest => 245,
MessageType::MessageType_ThpCredentialResponse => 246,
MessageType::MessageType_ThpEndRequest => 247,
MessageType::MessageType_ThpEndResponse => 248,
MessageType::MessageType_ThpCreateNewSession => 249,
MessageType::MessageType_ThpNewSession => 250,
};
Self::enum_descriptor().value_by_index(index)
}
@ -1568,7 +1616,7 @@ pub mod exts {
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x0emessages.proto\x12\x12hw.trezor.messages\x1a\x20google/protobuf/de\
scriptor.proto*\x9aT\n\x0bMessageType\x12(\n\x16MessageType_Initialize\
scriptor.proto*\x93W\n\x0bMessageType\x12(\n\x16MessageType_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\x1d\x01\xa8\xb5\x18\
@ -1843,30 +1891,40 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x07\x1a\x04\x90\xb5\x18\x01\x12$\n\x19MessageType_SolanaAddress\x10\x87\
\x07\x1a\x04\x98\xb5\x18\x01\x12#\n\x18MessageType_SolanaSignTx\x10\x88\
\x07\x1a\x04\x90\xb5\x18\x01\x12(\n\x1dMessageType_SolanaTxSignature\x10\
\x89\x07\x1a\x04\x98\xb5\x18\x01\x1a\x04\xc8\xf3\x18\x01\"\x04\x08Z\x10\
\\\"\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:<\n\
\x07wire_in\x18\xd2\x86\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueO\
ptionsR\x06wireIn:>\n\x08wire_out\x18\xd3\x86\x03\x20\x01(\x08\x12!.goog\
le.protobuf.EnumValueOptionsR\x07wireOut:G\n\rwire_debug_in\x18\xd4\x86\
\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x0bwireDebugIn:\
I\n\x0ewire_debug_out\x18\xd5\x86\x03\x20\x01(\x08\x12!.google.protobuf.\
EnumValueOptionsR\x0cwireDebugOut:@\n\twire_tiny\x18\xd6\x86\x03\x20\x01\
(\x08\x12!.google.protobuf.EnumValueOptionsR\x08wireTiny:L\n\x0fwire_boo\
tloader\x18\xd7\x86\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptio\
nsR\x0ewireBootloader:C\n\x0bwire_no_fsm\x18\xd8\x86\x03\x20\x01(\x08\
\x12!.google.protobuf.EnumValueOptionsR\twireNoFsm:F\n\x0cbitcoin_only\
\x18\xe0\xd4\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x0b\
bitcoinOnly:U\n\x17has_bitcoin_only_values\x18\xb9\x8e\x03\x20\x01(\x08\
\x12\x1c.google.protobuf.EnumOptionsR\x14hasBitcoinOnlyValues:T\n\x14exp\
erimental_message\x18\xa1\x96\x03\x20\x01(\x08\x12\x1f.google.protobuf.M\
essageOptionsR\x13experimentalMessage:>\n\twire_type\x18\xa2\x96\x03\x20\
\x01(\r\x12\x1f.google.protobuf.MessageOptionsR\x08wireType:N\n\x12exper\
imental_field\x18\x89\x9e\x03\x20\x01(\x08\x12\x1d.google.protobuf.Field\
OptionsR\x11experimentalField:U\n\x17include_in_bitcoin_only\x18\xe0\xd4\
\x03\x20\x01(\x08\x12\x1c.google.protobuf.FileOptionsR\x14includeInBitco\
inOnlyB8\n#com.satoshilabs.trezor.lib.protobufB\rTrezorMessage\x80\xa6\
\x1d\x01\
\x89\x07\x1a\x04\x98\xb5\x18\x01\x121\n\"MessageType_ThpStartPairingRequ\
est\x10\xe8\x07\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x122\n#MessageTy\
pe_ThpStartPairingResponse\x10\xe9\x07\x1a\x08\x80\xa6\x1d\x01\x98\xb5\
\x18\x01\x12/\n\x20MessageType_ThpCredentialRequest\x10\xea\x07\x1a\x08\
\x80\xa6\x1d\x01\x90\xb5\x18\x01\x120\n!MessageType_ThpCredentialRespons\
e\x10\xeb\x07\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12(\n\x19MessageT\
ype_ThpEndRequest\x10\xec\x07\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\
\x12)\n\x1aMessageType_ThpEndResponse\x10\xed\x07\x1a\x08\x80\xa6\x1d\
\x01\x98\xb5\x18\x01\x12.\n\x1fMessageType_ThpCreateNewSession\x10\xee\
\x07\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12(\n\x19MessageType_ThpNe\
wSession\x10\xef\x07\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x1a\x04\xc8\
\xf3\x18\x01\"\x04\x08Z\x10\\\"\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:<\n\x07wire_in\x18\xd2\x86\x03\x20\x01(\x08\x12\
!.google.protobuf.EnumValueOptionsR\x06wireIn:>\n\x08wire_out\x18\xd3\
\x86\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x07wireOut:\
G\n\rwire_debug_in\x18\xd4\x86\x03\x20\x01(\x08\x12!.google.protobuf.Enu\
mValueOptionsR\x0bwireDebugIn:I\n\x0ewire_debug_out\x18\xd5\x86\x03\x20\
\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x0cwireDebugOut:@\n\twi\
re_tiny\x18\xd6\x86\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptio\
nsR\x08wireTiny:L\n\x0fwire_bootloader\x18\xd7\x86\x03\x20\x01(\x08\x12!\
.google.protobuf.EnumValueOptionsR\x0ewireBootloader:C\n\x0bwire_no_fsm\
\x18\xd8\x86\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\twi\
reNoFsm:F\n\x0cbitcoin_only\x18\xe0\xd4\x03\x20\x01(\x08\x12!.google.pro\
tobuf.EnumValueOptionsR\x0bbitcoinOnly:U\n\x17has_bitcoin_only_values\
\x18\xb9\x8e\x03\x20\x01(\x08\x12\x1c.google.protobuf.EnumOptionsR\x14ha\
sBitcoinOnlyValues:T\n\x14experimental_message\x18\xa1\x96\x03\x20\x01(\
\x08\x12\x1f.google.protobuf.MessageOptionsR\x13experimentalMessage:>\n\
\twire_type\x18\xa2\x96\x03\x20\x01(\r\x12\x1f.google.protobuf.MessageOp\
tionsR\x08wireType:N\n\x12experimental_field\x18\x89\x9e\x03\x20\x01(\
\x08\x12\x1d.google.protobuf.FieldOptionsR\x11experimentalField:U\n\x17i\
nclude_in_bitcoin_only\x18\xe0\xd4\x03\x20\x01(\x08\x12\x1c.google.proto\
buf.FileOptionsR\x14includeInBitcoinOnlyB8\n#com.satoshilabs.trezor.lib.\
protobufB\rTrezorMessage\x80\xa6\x1d\x01\
";
/// `FileDescriptorProto` object which was a source for this generated file

@ -0,0 +1,962 @@
// This file is generated by rust-protobuf 3.3.0. Do not edit
// .proto file is parsed by protoc 3.19.6
// @generated
// https://github.com/rust-lang/rust-clippy/issues/702
#![allow(unknown_lints)]
#![allow(clippy::all)]
#![allow(unused_attributes)]
#![cfg_attr(rustfmt, rustfmt::skip)]
#![allow(box_pointers)]
#![allow(dead_code)]
#![allow(missing_docs)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(trivial_casts)]
#![allow(unused_results)]
#![allow(unused_mut)]
//! Generated file from `messages-thp.proto`
/// Generated files are compatible only with the same version
/// of protobuf runtime.
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0;
// @@protoc_insertion_point(message:hw.trezor.messages.thp.ThpDeviceProperties)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct ThpDeviceProperties {
// message fields
// @@protoc_insertion_point(field:hw.trezor.messages.thp.ThpDeviceProperties.internal_model)
pub internal_model: ::std::option::Option<::std::string::String>,
// @@protoc_insertion_point(field:hw.trezor.messages.thp.ThpDeviceProperties.model_variant)
pub model_variant: ::std::option::Option<u32>,
// @@protoc_insertion_point(field:hw.trezor.messages.thp.ThpDeviceProperties.bootloader_mode)
pub bootloader_mode: ::std::option::Option<bool>,
// @@protoc_insertion_point(field:hw.trezor.messages.thp.ThpDeviceProperties.protocol_version)
pub protocol_version: ::std::option::Option<u32>,
// @@protoc_insertion_point(field:hw.trezor.messages.thp.ThpDeviceProperties.pairing_methods)
pub pairing_methods: ::std::vec::Vec<::protobuf::EnumOrUnknown<ThpPairingMethod>>,
// special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.thp.ThpDeviceProperties.special_fields)
pub special_fields: ::protobuf::SpecialFields,
}
impl<'a> ::std::default::Default for &'a ThpDeviceProperties {
fn default() -> &'a ThpDeviceProperties {
<ThpDeviceProperties as ::protobuf::Message>::default_instance()
}
}
impl ThpDeviceProperties {
pub fn new() -> ThpDeviceProperties {
::std::default::Default::default()
}
// optional string internal_model = 1;
pub fn internal_model(&self) -> &str {
match self.internal_model.as_ref() {
Some(v) => v,
None => "",
}
}
pub fn clear_internal_model(&mut self) {
self.internal_model = ::std::option::Option::None;
}
pub fn has_internal_model(&self) -> bool {
self.internal_model.is_some()
}
// Param is passed by value, moved
pub fn set_internal_model(&mut self, v: ::std::string::String) {
self.internal_model = ::std::option::Option::Some(v);
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_internal_model(&mut self) -> &mut ::std::string::String {
if self.internal_model.is_none() {
self.internal_model = ::std::option::Option::Some(::std::string::String::new());
}
self.internal_model.as_mut().unwrap()
}
// Take field
pub fn take_internal_model(&mut self) -> ::std::string::String {
self.internal_model.take().unwrap_or_else(|| ::std::string::String::new())
}
// optional uint32 model_variant = 2;
pub fn model_variant(&self) -> u32 {
self.model_variant.unwrap_or(0)
}
pub fn clear_model_variant(&mut self) {
self.model_variant = ::std::option::Option::None;
}
pub fn has_model_variant(&self) -> bool {
self.model_variant.is_some()
}
// Param is passed by value, moved
pub fn set_model_variant(&mut self, v: u32) {
self.model_variant = ::std::option::Option::Some(v);
}
// optional bool bootloader_mode = 3;
pub fn bootloader_mode(&self) -> bool {
self.bootloader_mode.unwrap_or(false)
}
pub fn clear_bootloader_mode(&mut self) {
self.bootloader_mode = ::std::option::Option::None;
}
pub fn has_bootloader_mode(&self) -> bool {
self.bootloader_mode.is_some()
}
// Param is passed by value, moved
pub fn set_bootloader_mode(&mut self, v: bool) {
self.bootloader_mode = ::std::option::Option::Some(v);
}
// optional uint32 protocol_version = 4;
pub fn protocol_version(&self) -> u32 {
self.protocol_version.unwrap_or(0)
}
pub fn clear_protocol_version(&mut self) {
self.protocol_version = ::std::option::Option::None;
}
pub fn has_protocol_version(&self) -> bool {
self.protocol_version.is_some()
}
// Param is passed by value, moved
pub fn set_protocol_version(&mut self, v: u32) {
self.protocol_version = ::std::option::Option::Some(v);
}
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(5);
let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"internal_model",
|m: &ThpDeviceProperties| { &m.internal_model },
|m: &mut ThpDeviceProperties| { &mut m.internal_model },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"model_variant",
|m: &ThpDeviceProperties| { &m.model_variant },
|m: &mut ThpDeviceProperties| { &mut m.model_variant },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"bootloader_mode",
|m: &ThpDeviceProperties| { &m.bootloader_mode },
|m: &mut ThpDeviceProperties| { &mut m.bootloader_mode },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"protocol_version",
|m: &ThpDeviceProperties| { &m.protocol_version },
|m: &mut ThpDeviceProperties| { &mut m.protocol_version },
));
fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>(
"pairing_methods",
|m: &ThpDeviceProperties| { &m.pairing_methods },
|m: &mut ThpDeviceProperties| { &mut m.pairing_methods },
));
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<ThpDeviceProperties>(
"ThpDeviceProperties",
fields,
oneofs,
)
}
}
impl ::protobuf::Message for ThpDeviceProperties {
const NAME: &'static str = "ThpDeviceProperties";
fn is_initialized(&self) -> bool {
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> {
while let Some(tag) = is.read_raw_tag_or_eof()? {
match tag {
10 => {
self.internal_model = ::std::option::Option::Some(is.read_string()?);
},
16 => {
self.model_variant = ::std::option::Option::Some(is.read_uint32()?);
},
24 => {
self.bootloader_mode = ::std::option::Option::Some(is.read_bool()?);
},
32 => {
self.protocol_version = ::std::option::Option::Some(is.read_uint32()?);
},
40 => {
self.pairing_methods.push(is.read_enum_or_unknown()?);
},
42 => {
::protobuf::rt::read_repeated_packed_enum_or_unknown_into(is, &mut self.pairing_methods)?
},
tag => {
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u64 {
let mut my_size = 0;
if let Some(v) = self.internal_model.as_ref() {
my_size += ::protobuf::rt::string_size(1, &v);
}
if let Some(v) = self.model_variant {
my_size += ::protobuf::rt::uint32_size(2, v);
}
if let Some(v) = self.bootloader_mode {
my_size += 1 + 1;
}
if let Some(v) = self.protocol_version {
my_size += ::protobuf::rt::uint32_size(4, v);
}
for value in &self.pairing_methods {
my_size += ::protobuf::rt::int32_size(5, value.value());
};
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
self.special_fields.cached_size().set(my_size as u32);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
if let Some(v) = self.internal_model.as_ref() {
os.write_string(1, v)?;
}
if let Some(v) = self.model_variant {
os.write_uint32(2, v)?;
}
if let Some(v) = self.bootloader_mode {
os.write_bool(3, v)?;
}
if let Some(v) = self.protocol_version {
os.write_uint32(4, v)?;
}
for v in &self.pairing_methods {
os.write_enum(5, ::protobuf::EnumOrUnknown::value(v))?;
};
os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(())
}
fn special_fields(&self) -> &::protobuf::SpecialFields {
&self.special_fields
}
fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields {
&mut self.special_fields
}
fn new() -> ThpDeviceProperties {
ThpDeviceProperties::new()
}
fn clear(&mut self) {
self.internal_model = ::std::option::Option::None;
self.model_variant = ::std::option::Option::None;
self.bootloader_mode = ::std::option::Option::None;
self.protocol_version = ::std::option::Option::None;
self.pairing_methods.clear();
self.special_fields.clear();
}
fn default_instance() -> &'static ThpDeviceProperties {
static instance: ThpDeviceProperties = ThpDeviceProperties {
internal_model: ::std::option::Option::None,
model_variant: ::std::option::Option::None,
bootloader_mode: ::std::option::Option::None,
protocol_version: ::std::option::Option::None,
pairing_methods: ::std::vec::Vec::new(),
special_fields: ::protobuf::SpecialFields::new(),
};
&instance
}
}
impl ::protobuf::MessageFull for ThpDeviceProperties {
fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().message_by_package_relative_name("ThpDeviceProperties").unwrap()).clone()
}
}
impl ::std::fmt::Display for ThpDeviceProperties {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for ThpDeviceProperties {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
// @@protoc_insertion_point(message:hw.trezor.messages.thp.ThpHandshakeCompletionReqNoisePayload)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct ThpHandshakeCompletionReqNoisePayload {
// message fields
// @@protoc_insertion_point(field:hw.trezor.messages.thp.ThpHandshakeCompletionReqNoisePayload.host_pairing_credential)
pub host_pairing_credential: ::std::option::Option<::std::vec::Vec<u8>>,
// @@protoc_insertion_point(field:hw.trezor.messages.thp.ThpHandshakeCompletionReqNoisePayload.pairing_methods)
pub pairing_methods: ::std::vec::Vec<::protobuf::EnumOrUnknown<ThpPairingMethod>>,
// special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.thp.ThpHandshakeCompletionReqNoisePayload.special_fields)
pub special_fields: ::protobuf::SpecialFields,
}
impl<'a> ::std::default::Default for &'a ThpHandshakeCompletionReqNoisePayload {
fn default() -> &'a ThpHandshakeCompletionReqNoisePayload {
<ThpHandshakeCompletionReqNoisePayload as ::protobuf::Message>::default_instance()
}
}
impl ThpHandshakeCompletionReqNoisePayload {
pub fn new() -> ThpHandshakeCompletionReqNoisePayload {
::std::default::Default::default()
}
// optional bytes host_pairing_credential = 1;
pub fn host_pairing_credential(&self) -> &[u8] {
match self.host_pairing_credential.as_ref() {
Some(v) => v,
None => &[],
}
}
pub fn clear_host_pairing_credential(&mut self) {
self.host_pairing_credential = ::std::option::Option::None;
}
pub fn has_host_pairing_credential(&self) -> bool {
self.host_pairing_credential.is_some()
}
// Param is passed by value, moved
pub fn set_host_pairing_credential(&mut self, v: ::std::vec::Vec<u8>) {
self.host_pairing_credential = ::std::option::Option::Some(v);
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_host_pairing_credential(&mut self) -> &mut ::std::vec::Vec<u8> {
if self.host_pairing_credential.is_none() {
self.host_pairing_credential = ::std::option::Option::Some(::std::vec::Vec::new());
}
self.host_pairing_credential.as_mut().unwrap()
}
// Take field
pub fn take_host_pairing_credential(&mut self) -> ::std::vec::Vec<u8> {
self.host_pairing_credential.take().unwrap_or_else(|| ::std::vec::Vec::new())
}
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(2);
let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"host_pairing_credential",
|m: &ThpHandshakeCompletionReqNoisePayload| { &m.host_pairing_credential },
|m: &mut ThpHandshakeCompletionReqNoisePayload| { &mut m.host_pairing_credential },
));
fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>(
"pairing_methods",
|m: &ThpHandshakeCompletionReqNoisePayload| { &m.pairing_methods },
|m: &mut ThpHandshakeCompletionReqNoisePayload| { &mut m.pairing_methods },
));
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<ThpHandshakeCompletionReqNoisePayload>(
"ThpHandshakeCompletionReqNoisePayload",
fields,
oneofs,
)
}
}
impl ::protobuf::Message for ThpHandshakeCompletionReqNoisePayload {
const NAME: &'static str = "ThpHandshakeCompletionReqNoisePayload";
fn is_initialized(&self) -> bool {
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> {
while let Some(tag) = is.read_raw_tag_or_eof()? {
match tag {
10 => {
self.host_pairing_credential = ::std::option::Option::Some(is.read_bytes()?);
},
16 => {
self.pairing_methods.push(is.read_enum_or_unknown()?);
},
18 => {
::protobuf::rt::read_repeated_packed_enum_or_unknown_into(is, &mut self.pairing_methods)?
},
tag => {
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u64 {
let mut my_size = 0;
if let Some(v) = self.host_pairing_credential.as_ref() {
my_size += ::protobuf::rt::bytes_size(1, &v);
}
for value in &self.pairing_methods {
my_size += ::protobuf::rt::int32_size(2, value.value());
};
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
self.special_fields.cached_size().set(my_size as u32);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
if let Some(v) = self.host_pairing_credential.as_ref() {
os.write_bytes(1, v)?;
}
for v in &self.pairing_methods {
os.write_enum(2, ::protobuf::EnumOrUnknown::value(v))?;
};
os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(())
}
fn special_fields(&self) -> &::protobuf::SpecialFields {
&self.special_fields
}
fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields {
&mut self.special_fields
}
fn new() -> ThpHandshakeCompletionReqNoisePayload {
ThpHandshakeCompletionReqNoisePayload::new()
}
fn clear(&mut self) {
self.host_pairing_credential = ::std::option::Option::None;
self.pairing_methods.clear();
self.special_fields.clear();
}
fn default_instance() -> &'static ThpHandshakeCompletionReqNoisePayload {
static instance: ThpHandshakeCompletionReqNoisePayload = ThpHandshakeCompletionReqNoisePayload {
host_pairing_credential: ::std::option::Option::None,
pairing_methods: ::std::vec::Vec::new(),
special_fields: ::protobuf::SpecialFields::new(),
};
&instance
}
}
impl ::protobuf::MessageFull for ThpHandshakeCompletionReqNoisePayload {
fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().message_by_package_relative_name("ThpHandshakeCompletionReqNoisePayload").unwrap()).clone()
}
}
impl ::std::fmt::Display for ThpHandshakeCompletionReqNoisePayload {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for ThpHandshakeCompletionReqNoisePayload {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
// @@protoc_insertion_point(message:hw.trezor.messages.thp.ThpCreateNewSession)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct ThpCreateNewSession {
// message fields
// @@protoc_insertion_point(field:hw.trezor.messages.thp.ThpCreateNewSession.passphrase)
pub passphrase: ::std::option::Option<::std::string::String>,
// @@protoc_insertion_point(field:hw.trezor.messages.thp.ThpCreateNewSession.on_device)
pub on_device: ::std::option::Option<bool>,
// special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.thp.ThpCreateNewSession.special_fields)
pub special_fields: ::protobuf::SpecialFields,
}
impl<'a> ::std::default::Default for &'a ThpCreateNewSession {
fn default() -> &'a ThpCreateNewSession {
<ThpCreateNewSession as ::protobuf::Message>::default_instance()
}
}
impl ThpCreateNewSession {
pub fn new() -> ThpCreateNewSession {
::std::default::Default::default()
}
// optional string passphrase = 1;
pub fn passphrase(&self) -> &str {
match self.passphrase.as_ref() {
Some(v) => v,
None => "",
}
}
pub fn clear_passphrase(&mut self) {
self.passphrase = ::std::option::Option::None;
}
pub fn has_passphrase(&self) -> bool {
self.passphrase.is_some()
}
// Param is passed by value, moved
pub fn set_passphrase(&mut self, v: ::std::string::String) {
self.passphrase = ::std::option::Option::Some(v);
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_passphrase(&mut self) -> &mut ::std::string::String {
if self.passphrase.is_none() {
self.passphrase = ::std::option::Option::Some(::std::string::String::new());
}
self.passphrase.as_mut().unwrap()
}
// Take field
pub fn take_passphrase(&mut self) -> ::std::string::String {
self.passphrase.take().unwrap_or_else(|| ::std::string::String::new())
}
// optional bool on_device = 2;
pub fn on_device(&self) -> bool {
self.on_device.unwrap_or(false)
}
pub fn clear_on_device(&mut self) {
self.on_device = ::std::option::Option::None;
}
pub fn has_on_device(&self) -> bool {
self.on_device.is_some()
}
// Param is passed by value, moved
pub fn set_on_device(&mut self, v: bool) {
self.on_device = ::std::option::Option::Some(v);
}
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(2);
let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"passphrase",
|m: &ThpCreateNewSession| { &m.passphrase },
|m: &mut ThpCreateNewSession| { &mut m.passphrase },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"on_device",
|m: &ThpCreateNewSession| { &m.on_device },
|m: &mut ThpCreateNewSession| { &mut m.on_device },
));
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<ThpCreateNewSession>(
"ThpCreateNewSession",
fields,
oneofs,
)
}
}
impl ::protobuf::Message for ThpCreateNewSession {
const NAME: &'static str = "ThpCreateNewSession";
fn is_initialized(&self) -> bool {
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> {
while let Some(tag) = is.read_raw_tag_or_eof()? {
match tag {
10 => {
self.passphrase = ::std::option::Option::Some(is.read_string()?);
},
16 => {
self.on_device = ::std::option::Option::Some(is.read_bool()?);
},
tag => {
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u64 {
let mut my_size = 0;
if let Some(v) = self.passphrase.as_ref() {
my_size += ::protobuf::rt::string_size(1, &v);
}
if let Some(v) = self.on_device {
my_size += 1 + 1;
}
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
self.special_fields.cached_size().set(my_size as u32);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
if let Some(v) = self.passphrase.as_ref() {
os.write_string(1, v)?;
}
if let Some(v) = self.on_device {
os.write_bool(2, v)?;
}
os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(())
}
fn special_fields(&self) -> &::protobuf::SpecialFields {
&self.special_fields
}
fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields {
&mut self.special_fields
}
fn new() -> ThpCreateNewSession {
ThpCreateNewSession::new()
}
fn clear(&mut self) {
self.passphrase = ::std::option::Option::None;
self.on_device = ::std::option::Option::None;
self.special_fields.clear();
}
fn default_instance() -> &'static ThpCreateNewSession {
static instance: ThpCreateNewSession = ThpCreateNewSession {
passphrase: ::std::option::Option::None,
on_device: ::std::option::Option::None,
special_fields: ::protobuf::SpecialFields::new(),
};
&instance
}
}
impl ::protobuf::MessageFull for ThpCreateNewSession {
fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().message_by_package_relative_name("ThpCreateNewSession").unwrap()).clone()
}
}
impl ::std::fmt::Display for ThpCreateNewSession {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for ThpCreateNewSession {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
// @@protoc_insertion_point(message:hw.trezor.messages.thp.ThpNewSession)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct ThpNewSession {
// message fields
// @@protoc_insertion_point(field:hw.trezor.messages.thp.ThpNewSession.new_session_id)
pub new_session_id: ::std::option::Option<u32>,
// special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.thp.ThpNewSession.special_fields)
pub special_fields: ::protobuf::SpecialFields,
}
impl<'a> ::std::default::Default for &'a ThpNewSession {
fn default() -> &'a ThpNewSession {
<ThpNewSession as ::protobuf::Message>::default_instance()
}
}
impl ThpNewSession {
pub fn new() -> ThpNewSession {
::std::default::Default::default()
}
// optional uint32 new_session_id = 1;
pub fn new_session_id(&self) -> u32 {
self.new_session_id.unwrap_or(0)
}
pub fn clear_new_session_id(&mut self) {
self.new_session_id = ::std::option::Option::None;
}
pub fn has_new_session_id(&self) -> bool {
self.new_session_id.is_some()
}
// Param is passed by value, moved
pub fn set_new_session_id(&mut self, v: u32) {
self.new_session_id = ::std::option::Option::Some(v);
}
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(1);
let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"new_session_id",
|m: &ThpNewSession| { &m.new_session_id },
|m: &mut ThpNewSession| { &mut m.new_session_id },
));
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<ThpNewSession>(
"ThpNewSession",
fields,
oneofs,
)
}
}
impl ::protobuf::Message for ThpNewSession {
const NAME: &'static str = "ThpNewSession";
fn is_initialized(&self) -> bool {
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> {
while let Some(tag) = is.read_raw_tag_or_eof()? {
match tag {
8 => {
self.new_session_id = ::std::option::Option::Some(is.read_uint32()?);
},
tag => {
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u64 {
let mut my_size = 0;
if let Some(v) = self.new_session_id {
my_size += ::protobuf::rt::uint32_size(1, v);
}
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
self.special_fields.cached_size().set(my_size as u32);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
if let Some(v) = self.new_session_id {
os.write_uint32(1, v)?;
}
os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(())
}
fn special_fields(&self) -> &::protobuf::SpecialFields {
&self.special_fields
}
fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields {
&mut self.special_fields
}
fn new() -> ThpNewSession {
ThpNewSession::new()
}
fn clear(&mut self) {
self.new_session_id = ::std::option::Option::None;
self.special_fields.clear();
}
fn default_instance() -> &'static ThpNewSession {
static instance: ThpNewSession = ThpNewSession {
new_session_id: ::std::option::Option::None,
special_fields: ::protobuf::SpecialFields::new(),
};
&instance
}
}
impl ::protobuf::MessageFull for ThpNewSession {
fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().message_by_package_relative_name("ThpNewSession").unwrap()).clone()
}
}
impl ::std::fmt::Display for ThpNewSession {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for ThpNewSession {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)]
// @@protoc_insertion_point(enum:hw.trezor.messages.thp.ThpPairingMethod)
pub enum ThpPairingMethod {
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpPairingMethod.PairingMethod_NoMethod)
PairingMethod_NoMethod = 1,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpPairingMethod.PairingMethod_CodeEntry)
PairingMethod_CodeEntry = 2,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpPairingMethod.PairingMethod_QrCode)
PairingMethod_QrCode = 3,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.thp.ThpPairingMethod.PairingMethod_NFC_Unidirectional)
PairingMethod_NFC_Unidirectional = 4,
}
impl ::protobuf::Enum for ThpPairingMethod {
const NAME: &'static str = "ThpPairingMethod";
fn value(&self) -> i32 {
*self as i32
}
fn from_i32(value: i32) -> ::std::option::Option<ThpPairingMethod> {
match value {
1 => ::std::option::Option::Some(ThpPairingMethod::PairingMethod_NoMethod),
2 => ::std::option::Option::Some(ThpPairingMethod::PairingMethod_CodeEntry),
3 => ::std::option::Option::Some(ThpPairingMethod::PairingMethod_QrCode),
4 => ::std::option::Option::Some(ThpPairingMethod::PairingMethod_NFC_Unidirectional),
_ => ::std::option::Option::None
}
}
fn from_str(str: &str) -> ::std::option::Option<ThpPairingMethod> {
match str {
"PairingMethod_NoMethod" => ::std::option::Option::Some(ThpPairingMethod::PairingMethod_NoMethod),
"PairingMethod_CodeEntry" => ::std::option::Option::Some(ThpPairingMethod::PairingMethod_CodeEntry),
"PairingMethod_QrCode" => ::std::option::Option::Some(ThpPairingMethod::PairingMethod_QrCode),
"PairingMethod_NFC_Unidirectional" => ::std::option::Option::Some(ThpPairingMethod::PairingMethod_NFC_Unidirectional),
_ => ::std::option::Option::None
}
}
const VALUES: &'static [ThpPairingMethod] = &[
ThpPairingMethod::PairingMethod_NoMethod,
ThpPairingMethod::PairingMethod_CodeEntry,
ThpPairingMethod::PairingMethod_QrCode,
ThpPairingMethod::PairingMethod_NFC_Unidirectional,
];
}
impl ::protobuf::EnumFull for ThpPairingMethod {
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("ThpPairingMethod").unwrap()).clone()
}
fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor {
let index = match self {
ThpPairingMethod::PairingMethod_NoMethod => 0,
ThpPairingMethod::PairingMethod_CodeEntry => 1,
ThpPairingMethod::PairingMethod_QrCode => 2,
ThpPairingMethod::PairingMethod_NFC_Unidirectional => 3,
};
Self::enum_descriptor().value_by_index(index)
}
}
// Note, `Default` is implemented although default value is not 0
impl ::std::default::Default for ThpPairingMethod {
fn default() -> Self {
ThpPairingMethod::PairingMethod_NoMethod
}
}
impl ThpPairingMethod {
fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData {
::protobuf::reflect::GeneratedEnumDescriptorData::new::<ThpPairingMethod>("ThpPairingMethod")
}
}
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x12messages-thp.proto\x12\x16hw.trezor.messages.thp\"\x88\x02\n\x13Th\
pDeviceProperties\x12%\n\x0einternal_model\x18\x01\x20\x01(\tR\rinternal\
Model\x12#\n\rmodel_variant\x18\x02\x20\x01(\rR\x0cmodelVariant\x12'\n\
\x0fbootloader_mode\x18\x03\x20\x01(\x08R\x0ebootloaderMode\x12)\n\x10pr\
otocol_version\x18\x04\x20\x01(\rR\x0fprotocolVersion\x12Q\n\x0fpairing_\
methods\x18\x05\x20\x03(\x0e2(.hw.trezor.messages.thp.ThpPairingMethodR\
\x0epairingMethods\"\xb2\x01\n%ThpHandshakeCompletionReqNoisePayload\x12\
6\n\x17host_pairing_credential\x18\x01\x20\x01(\x0cR\x15hostPairingCrede\
ntial\x12Q\n\x0fpairing_methods\x18\x02\x20\x03(\x0e2(.hw.trezor.message\
s.thp.ThpPairingMethodR\x0epairingMethods\"R\n\x13ThpCreateNewSession\
\x12\x1e\n\npassphrase\x18\x01\x20\x01(\tR\npassphrase\x12\x1b\n\ton_dev\
ice\x18\x02\x20\x01(\x08R\x08onDevice\"5\n\rThpNewSession\x12$\n\x0enew_\
session_id\x18\x01\x20\x01(\rR\x0cnewSessionId*\x8b\x01\n\x10ThpPairingM\
ethod\x12\x1a\n\x16PairingMethod_NoMethod\x10\x01\x12\x1b\n\x17PairingMe\
thod_CodeEntry\x10\x02\x12\x18\n\x14PairingMethod_QrCode\x10\x03\x12$\n\
\x20PairingMethod_NFC_Unidirectional\x10\x04B7\n#com.satoshilabs.trezor.\
lib.protobufB\x10TrezorMessageThp\
";
/// `FileDescriptorProto` object which was a source for this generated file
fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new();
file_descriptor_proto_lazy.get(|| {
::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap()
})
}
/// `FileDescriptor` object which allows dynamic access to files
pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new();
static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new();
file_descriptor.get(|| {
let generated_file_descriptor = generated_file_descriptor_lazy.get(|| {
let mut deps = ::std::vec::Vec::with_capacity(0);
let mut messages = ::std::vec::Vec::with_capacity(4);
messages.push(ThpDeviceProperties::generated_message_descriptor_data());
messages.push(ThpHandshakeCompletionReqNoisePayload::generated_message_descriptor_data());
messages.push(ThpCreateNewSession::generated_message_descriptor_data());
messages.push(ThpNewSession::generated_message_descriptor_data());
let mut enums = ::std::vec::Vec::with_capacity(1);
enums.push(ThpPairingMethod::generated_enum_descriptor_data());
::protobuf::reflect::GeneratedFileDescriptor::new_generated(
file_descriptor_proto(),
deps,
messages,
enums,
)
});
::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor)
})
}
Loading…
Cancel
Save