diff --git a/common/protob/messages-thp.proto b/common/protob/messages-thp.proto index 646b1d1747..f9cc2d4a91 100644 --- a/common/protob/messages-thp.proto +++ b/common/protob/messages-thp.proto @@ -25,10 +25,10 @@ enum ThpPairingMethod { * @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 uint32 protocol_version_major = 3; // The major version of the communication protocol used by the firmware. - optional uint32 protocol_version_minor = 4; // The minor version of the communication protocol used by the firmware. + required string internal_model = 1; // Internal model name e.g. "T2B1". + optional uint32 model_variant = 2 [default=0]; // Encodes the device properties such as color. + required uint32 protocol_version_major = 3; // The major version of the communication protocol used by the firmware. + required uint32 protocol_version_minor = 4; // The minor version of the communication protocol used by the firmware. repeated ThpPairingMethod pairing_methods = 5; // The pairing methods supported by the Trezor. } @@ -46,8 +46,8 @@ message ThpHandshakeCompletionReqNoisePayload { */ message ThpCreateNewSession{ optional string passphrase = 1; - optional bool on_device = 2; // User wants to enter passphrase on the device - optional bool derive_cardano = 3; // If True, Cardano keys will be derived. Ignored with BTC-only + optional bool on_device = 2 [default=false]; // User wants to enter passphrase on the device + optional bool derive_cardano = 3 [default=false]; // If True, Cardano keys will be derived. Ignored with BTC-only } @@ -75,7 +75,7 @@ message ThpPairingRequestApproved{ * @next ThpCodeEntryCommitment */ message ThpSelectMethod { - optional ThpPairingMethod selected_pairing_method = 1; + required ThpPairingMethod selected_pairing_method = 1; } /** @@ -92,7 +92,7 @@ message ThpPairingPreparationsFinished{ * @next ThpCodeEntryChallenge */ message ThpCodeEntryCommitment { - optional bytes commitment = 1; // SHA-256 of Trezor's random 32-byte secret + required bytes commitment = 1; // SHA-256 of Trezor's random 32-byte secret } /** @@ -100,7 +100,7 @@ message ThpCodeEntryCommitment { * @next ThpCodeEntryCpaceTrezor */ message ThpCodeEntryChallenge { - optional bytes challenge = 1; // Host's random 32-byte challenge + required bytes challenge = 1; // Host's random 32-byte challenge } /** @@ -108,7 +108,7 @@ message ThpCodeEntryChallenge { * @next ThpCodeEntryCpaceHostTag */ message ThpCodeEntryCpaceTrezor { - optional bytes cpace_trezor_public_key = 1; // Trezor's ephemeral CPace public key + required bytes cpace_trezor_public_key = 1; // Trezor's ephemeral CPace public key } /** @@ -116,8 +116,8 @@ message ThpCodeEntryCpaceTrezor { * @next ThpCodeEntrySecret */ message ThpCodeEntryCpaceHostTag { - optional bytes cpace_host_public_key = 1; // Host's ephemeral CPace public key - optional bytes tag = 2; // SHA-256 of shared secret + required bytes cpace_host_public_key = 1; // Host's ephemeral CPace public key + required bytes tag = 2; // SHA-256 of shared secret } @@ -127,7 +127,7 @@ message ThpCodeEntryCpaceTrezor { * @next ThpEndRequest */ message ThpCodeEntrySecret { - optional bytes secret = 1; // Trezor's secret + required bytes secret = 1; // Trezor's secret } /** @@ -135,7 +135,7 @@ message ThpCodeEntrySecret { * @next ThpQrCodeSecret */ message ThpQrCodeTag { - optional bytes tag = 1; // SHA-256 of shared secret + required bytes tag = 1; // SHA-256 of shared secret } /** @@ -144,7 +144,7 @@ message ThpQrCodeTag { * @next ThpEndRequest */ message ThpQrCodeSecret { - optional bytes secret = 1; // Trezor's secret + required bytes secret = 1; // Trezor's secret } /** @@ -152,7 +152,7 @@ message ThpQrCodeSecret { * @next ThpNfcTagTrezor */ message ThpNfcTagHost { - optional bytes tag = 1; // Host's tag + required bytes tag = 1; // Host's tag } /** @@ -161,7 +161,7 @@ message ThpNfcTagHost { * @next ThpEndRequest */ message ThpNfcTagTrezor { - optional bytes tag = 1; // Trezor's tag + required bytes tag = 1; // Trezor's tag } /** @@ -170,9 +170,9 @@ message ThpNfcTagTrezor { * @next ThpCredentialResponse */ message ThpCredentialRequest { - optional bytes host_static_pubkey = 1; // Host's static public key identifying the credential. - optional bool autoconnect = 2; // Whether host wants to autoconnect without user confirmation - optional bytes credential = 3; // Host's previous credential + required bytes host_static_pubkey = 1; // Host's static public key identifying the credential. + optional bool autoconnect = 2 [default=false]; // Whether host wants to autoconnect without user confirmation + optional bytes credential = 3; // Host's previous credential } /** @@ -181,8 +181,8 @@ message ThpCredentialRequest { * @next ThpEndRequest */ message ThpCredentialResponse { - optional bytes trezor_static_pubkey = 1; // Trezor's static public key used in the handshake. - optional bytes credential = 2; // The pairing credential issued by the Trezor to the host. + required bytes trezor_static_pubkey = 1; // Trezor's static public key used in the handshake. + required bytes credential = 2; // The pairing credential issued by the Trezor to the host. } /** @@ -214,8 +214,8 @@ message ThpEndResponse {} */ message ThpPairingCredential { option (internal_only) = true; - optional ThpCredentialMetadata cred_metadata = 1; // Credential metadata - optional bytes mac = 2; // Message authentication code generated by the Trezor + required ThpCredentialMetadata cred_metadata = 1; // Credential metadata + required bytes mac = 2; // Message authentication code generated by the Trezor } /** @@ -224,6 +224,6 @@ message ThpEndResponse {} */ message ThpAuthenticatedCredentialData { option (internal_only) = true; - optional bytes host_static_pubkey = 1; // Host's static public key used in the handshake - optional ThpCredentialMetadata cred_metadata = 2; // Credential metadata + required bytes host_static_pubkey = 1; // Host's static public key used in the handshake + required ThpCredentialMetadata cred_metadata = 2; // Credential metadata } diff --git a/core/src/trezor/messages.py b/core/src/trezor/messages.py index bbcc71aab9..c2fcb20c0d 100644 --- a/core/src/trezor/messages.py +++ b/core/src/trezor/messages.py @@ -6153,20 +6153,20 @@ if TYPE_CHECKING: return isinstance(msg, cls) class ThpDeviceProperties(protobuf.MessageType): - internal_model: "str | None" - model_variant: "int | None" - protocol_version_major: "int | None" - protocol_version_minor: "int | None" + internal_model: "str" + model_variant: "int" + protocol_version_major: "int" + protocol_version_minor: "int" pairing_methods: "list[ThpPairingMethod]" def __init__( self, *, + internal_model: "str", + protocol_version_major: "int", + protocol_version_minor: "int", pairing_methods: "list[ThpPairingMethod] | None" = None, - internal_model: "str | None" = None, model_variant: "int | None" = None, - protocol_version_major: "int | None" = None, - protocol_version_minor: "int | None" = None, ) -> None: pass @@ -6190,8 +6190,8 @@ if TYPE_CHECKING: class ThpCreateNewSession(protobuf.MessageType): passphrase: "str | None" - on_device: "bool | None" - derive_cardano: "bool | None" + on_device: "bool" + derive_cardano: "bool" def __init__( self, @@ -6227,12 +6227,12 @@ if TYPE_CHECKING: return isinstance(msg, cls) class ThpSelectMethod(protobuf.MessageType): - selected_pairing_method: "ThpPairingMethod | None" + selected_pairing_method: "ThpPairingMethod" def __init__( self, *, - selected_pairing_method: "ThpPairingMethod | None" = None, + selected_pairing_method: "ThpPairingMethod", ) -> None: pass @@ -6247,12 +6247,12 @@ if TYPE_CHECKING: return isinstance(msg, cls) class ThpCodeEntryCommitment(protobuf.MessageType): - commitment: "bytes | None" + commitment: "bytes" def __init__( self, *, - commitment: "bytes | None" = None, + commitment: "bytes", ) -> None: pass @@ -6261,12 +6261,12 @@ if TYPE_CHECKING: return isinstance(msg, cls) class ThpCodeEntryChallenge(protobuf.MessageType): - challenge: "bytes | None" + challenge: "bytes" def __init__( self, *, - challenge: "bytes | None" = None, + challenge: "bytes", ) -> None: pass @@ -6275,12 +6275,12 @@ if TYPE_CHECKING: return isinstance(msg, cls) class ThpCodeEntryCpaceTrezor(protobuf.MessageType): - cpace_trezor_public_key: "bytes | None" + cpace_trezor_public_key: "bytes" def __init__( self, *, - cpace_trezor_public_key: "bytes | None" = None, + cpace_trezor_public_key: "bytes", ) -> None: pass @@ -6289,14 +6289,14 @@ if TYPE_CHECKING: return isinstance(msg, cls) class ThpCodeEntryCpaceHostTag(protobuf.MessageType): - cpace_host_public_key: "bytes | None" - tag: "bytes | None" + cpace_host_public_key: "bytes" + tag: "bytes" def __init__( self, *, - cpace_host_public_key: "bytes | None" = None, - tag: "bytes | None" = None, + cpace_host_public_key: "bytes", + tag: "bytes", ) -> None: pass @@ -6305,12 +6305,12 @@ if TYPE_CHECKING: return isinstance(msg, cls) class ThpCodeEntrySecret(protobuf.MessageType): - secret: "bytes | None" + secret: "bytes" def __init__( self, *, - secret: "bytes | None" = None, + secret: "bytes", ) -> None: pass @@ -6319,12 +6319,12 @@ if TYPE_CHECKING: return isinstance(msg, cls) class ThpQrCodeTag(protobuf.MessageType): - tag: "bytes | None" + tag: "bytes" def __init__( self, *, - tag: "bytes | None" = None, + tag: "bytes", ) -> None: pass @@ -6333,12 +6333,12 @@ if TYPE_CHECKING: return isinstance(msg, cls) class ThpQrCodeSecret(protobuf.MessageType): - secret: "bytes | None" + secret: "bytes" def __init__( self, *, - secret: "bytes | None" = None, + secret: "bytes", ) -> None: pass @@ -6347,12 +6347,12 @@ if TYPE_CHECKING: return isinstance(msg, cls) class ThpNfcTagHost(protobuf.MessageType): - tag: "bytes | None" + tag: "bytes" def __init__( self, *, - tag: "bytes | None" = None, + tag: "bytes", ) -> None: pass @@ -6361,12 +6361,12 @@ if TYPE_CHECKING: return isinstance(msg, cls) class ThpNfcTagTrezor(protobuf.MessageType): - tag: "bytes | None" + tag: "bytes" def __init__( self, *, - tag: "bytes | None" = None, + tag: "bytes", ) -> None: pass @@ -6375,14 +6375,14 @@ if TYPE_CHECKING: return isinstance(msg, cls) class ThpCredentialRequest(protobuf.MessageType): - host_static_pubkey: "bytes | None" - autoconnect: "bool | None" + host_static_pubkey: "bytes" + autoconnect: "bool" credential: "bytes | None" def __init__( self, *, - host_static_pubkey: "bytes | None" = None, + host_static_pubkey: "bytes", autoconnect: "bool | None" = None, credential: "bytes | None" = None, ) -> None: @@ -6393,14 +6393,14 @@ if TYPE_CHECKING: return isinstance(msg, cls) class ThpCredentialResponse(protobuf.MessageType): - trezor_static_pubkey: "bytes | None" - credential: "bytes | None" + trezor_static_pubkey: "bytes" + credential: "bytes" def __init__( self, *, - trezor_static_pubkey: "bytes | None" = None, - credential: "bytes | None" = None, + trezor_static_pubkey: "bytes", + credential: "bytes", ) -> None: pass @@ -6437,14 +6437,14 @@ if TYPE_CHECKING: return isinstance(msg, cls) class ThpPairingCredential(protobuf.MessageType): - cred_metadata: "ThpCredentialMetadata | None" - mac: "bytes | None" + cred_metadata: "ThpCredentialMetadata" + mac: "bytes" def __init__( self, *, - cred_metadata: "ThpCredentialMetadata | None" = None, - mac: "bytes | None" = None, + cred_metadata: "ThpCredentialMetadata", + mac: "bytes", ) -> None: pass @@ -6453,14 +6453,14 @@ if TYPE_CHECKING: return isinstance(msg, cls) class ThpAuthenticatedCredentialData(protobuf.MessageType): - host_static_pubkey: "bytes | None" - cred_metadata: "ThpCredentialMetadata | None" + host_static_pubkey: "bytes" + cred_metadata: "ThpCredentialMetadata" def __init__( self, *, - host_static_pubkey: "bytes | None" = None, - cred_metadata: "ThpCredentialMetadata | None" = None, + host_static_pubkey: "bytes", + cred_metadata: "ThpCredentialMetadata", ) -> None: pass diff --git a/python/src/trezorlib/messages.py b/python/src/trezorlib/messages.py index 4ed26cb799..416eb1136f 100644 --- a/python/src/trezorlib/messages.py +++ b/python/src/trezorlib/messages.py @@ -7862,27 +7862,27 @@ class TezosManagerTransfer(protobuf.MessageType): 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("protocol_version_major", "uint32", repeated=False, required=False, default=None), - 4: protobuf.Field("protocol_version_minor", "uint32", repeated=False, required=False, default=None), + 1: protobuf.Field("internal_model", "string", repeated=False, required=True), + 2: protobuf.Field("model_variant", "uint32", repeated=False, required=False, default=0), + 3: protobuf.Field("protocol_version_major", "uint32", repeated=False, required=True), + 4: protobuf.Field("protocol_version_minor", "uint32", repeated=False, required=True), 5: protobuf.Field("pairing_methods", "ThpPairingMethod", repeated=True, required=False, default=None), } def __init__( self, *, + internal_model: "str", + protocol_version_major: "int", + protocol_version_minor: "int", pairing_methods: Optional[Sequence["ThpPairingMethod"]] = None, - internal_model: Optional["str"] = None, - model_variant: Optional["int"] = None, - protocol_version_major: Optional["int"] = None, - protocol_version_minor: Optional["int"] = None, + model_variant: Optional["int"] = 0, ) -> 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.protocol_version_major = protocol_version_major self.protocol_version_minor = protocol_version_minor + self.model_variant = model_variant class ThpHandshakeCompletionReqNoisePayload(protobuf.MessageType): @@ -7903,16 +7903,16 @@ class ThpCreateNewSession(protobuf.MessageType): MESSAGE_WIRE_TYPE = 1000 FIELDS = { 1: protobuf.Field("passphrase", "string", repeated=False, required=False, default=None), - 2: protobuf.Field("on_device", "bool", repeated=False, required=False, default=None), - 3: protobuf.Field("derive_cardano", "bool", repeated=False, required=False, default=None), + 2: protobuf.Field("on_device", "bool", repeated=False, required=False, default=False), + 3: protobuf.Field("derive_cardano", "bool", repeated=False, required=False, default=False), } def __init__( self, *, passphrase: Optional["str"] = None, - on_device: Optional["bool"] = None, - derive_cardano: Optional["bool"] = None, + on_device: Optional["bool"] = False, + derive_cardano: Optional["bool"] = False, ) -> None: self.passphrase = passphrase self.on_device = on_device @@ -7940,13 +7940,13 @@ class ThpPairingRequestApproved(protobuf.MessageType): class ThpSelectMethod(protobuf.MessageType): MESSAGE_WIRE_TYPE = 1008 FIELDS = { - 1: protobuf.Field("selected_pairing_method", "ThpPairingMethod", repeated=False, required=False, default=None), + 1: protobuf.Field("selected_pairing_method", "ThpPairingMethod", repeated=False, required=True), } def __init__( self, *, - selected_pairing_method: Optional["ThpPairingMethod"] = None, + selected_pairing_method: "ThpPairingMethod", ) -> None: self.selected_pairing_method = selected_pairing_method @@ -7958,13 +7958,13 @@ class ThpPairingPreparationsFinished(protobuf.MessageType): class ThpCodeEntryCommitment(protobuf.MessageType): MESSAGE_WIRE_TYPE = 1016 FIELDS = { - 1: protobuf.Field("commitment", "bytes", repeated=False, required=False, default=None), + 1: protobuf.Field("commitment", "bytes", repeated=False, required=True), } def __init__( self, *, - commitment: Optional["bytes"] = None, + commitment: "bytes", ) -> None: self.commitment = commitment @@ -7972,13 +7972,13 @@ class ThpCodeEntryCommitment(protobuf.MessageType): class ThpCodeEntryChallenge(protobuf.MessageType): MESSAGE_WIRE_TYPE = 1017 FIELDS = { - 1: protobuf.Field("challenge", "bytes", repeated=False, required=False, default=None), + 1: protobuf.Field("challenge", "bytes", repeated=False, required=True), } def __init__( self, *, - challenge: Optional["bytes"] = None, + challenge: "bytes", ) -> None: self.challenge = challenge @@ -7986,13 +7986,13 @@ class ThpCodeEntryChallenge(protobuf.MessageType): class ThpCodeEntryCpaceTrezor(protobuf.MessageType): MESSAGE_WIRE_TYPE = 1018 FIELDS = { - 1: protobuf.Field("cpace_trezor_public_key", "bytes", repeated=False, required=False, default=None), + 1: protobuf.Field("cpace_trezor_public_key", "bytes", repeated=False, required=True), } def __init__( self, *, - cpace_trezor_public_key: Optional["bytes"] = None, + cpace_trezor_public_key: "bytes", ) -> None: self.cpace_trezor_public_key = cpace_trezor_public_key @@ -8000,15 +8000,15 @@ class ThpCodeEntryCpaceTrezor(protobuf.MessageType): class ThpCodeEntryCpaceHostTag(protobuf.MessageType): MESSAGE_WIRE_TYPE = 1019 FIELDS = { - 1: protobuf.Field("cpace_host_public_key", "bytes", repeated=False, required=False, default=None), - 2: protobuf.Field("tag", "bytes", repeated=False, required=False, default=None), + 1: protobuf.Field("cpace_host_public_key", "bytes", repeated=False, required=True), + 2: protobuf.Field("tag", "bytes", repeated=False, required=True), } def __init__( self, *, - cpace_host_public_key: Optional["bytes"] = None, - tag: Optional["bytes"] = None, + cpace_host_public_key: "bytes", + tag: "bytes", ) -> None: self.cpace_host_public_key = cpace_host_public_key self.tag = tag @@ -8017,13 +8017,13 @@ class ThpCodeEntryCpaceHostTag(protobuf.MessageType): class ThpCodeEntrySecret(protobuf.MessageType): MESSAGE_WIRE_TYPE = 1020 FIELDS = { - 1: protobuf.Field("secret", "bytes", repeated=False, required=False, default=None), + 1: protobuf.Field("secret", "bytes", repeated=False, required=True), } def __init__( self, *, - secret: Optional["bytes"] = None, + secret: "bytes", ) -> None: self.secret = secret @@ -8031,13 +8031,13 @@ class ThpCodeEntrySecret(protobuf.MessageType): class ThpQrCodeTag(protobuf.MessageType): MESSAGE_WIRE_TYPE = 1024 FIELDS = { - 1: protobuf.Field("tag", "bytes", repeated=False, required=False, default=None), + 1: protobuf.Field("tag", "bytes", repeated=False, required=True), } def __init__( self, *, - tag: Optional["bytes"] = None, + tag: "bytes", ) -> None: self.tag = tag @@ -8045,13 +8045,13 @@ class ThpQrCodeTag(protobuf.MessageType): class ThpQrCodeSecret(protobuf.MessageType): MESSAGE_WIRE_TYPE = 1025 FIELDS = { - 1: protobuf.Field("secret", "bytes", repeated=False, required=False, default=None), + 1: protobuf.Field("secret", "bytes", repeated=False, required=True), } def __init__( self, *, - secret: Optional["bytes"] = None, + secret: "bytes", ) -> None: self.secret = secret @@ -8059,13 +8059,13 @@ class ThpQrCodeSecret(protobuf.MessageType): class ThpNfcTagHost(protobuf.MessageType): MESSAGE_WIRE_TYPE = 1032 FIELDS = { - 1: protobuf.Field("tag", "bytes", repeated=False, required=False, default=None), + 1: protobuf.Field("tag", "bytes", repeated=False, required=True), } def __init__( self, *, - tag: Optional["bytes"] = None, + tag: "bytes", ) -> None: self.tag = tag @@ -8073,13 +8073,13 @@ class ThpNfcTagHost(protobuf.MessageType): class ThpNfcTagTrezor(protobuf.MessageType): MESSAGE_WIRE_TYPE = 1033 FIELDS = { - 1: protobuf.Field("tag", "bytes", repeated=False, required=False, default=None), + 1: protobuf.Field("tag", "bytes", repeated=False, required=True), } def __init__( self, *, - tag: Optional["bytes"] = None, + tag: "bytes", ) -> None: self.tag = tag @@ -8087,16 +8087,16 @@ class ThpNfcTagTrezor(protobuf.MessageType): class ThpCredentialRequest(protobuf.MessageType): MESSAGE_WIRE_TYPE = 1010 FIELDS = { - 1: protobuf.Field("host_static_pubkey", "bytes", repeated=False, required=False, default=None), - 2: protobuf.Field("autoconnect", "bool", repeated=False, required=False, default=None), + 1: protobuf.Field("host_static_pubkey", "bytes", repeated=False, required=True), + 2: protobuf.Field("autoconnect", "bool", repeated=False, required=False, default=False), 3: protobuf.Field("credential", "bytes", repeated=False, required=False, default=None), } def __init__( self, *, - host_static_pubkey: Optional["bytes"] = None, - autoconnect: Optional["bool"] = None, + host_static_pubkey: "bytes", + autoconnect: Optional["bool"] = False, credential: Optional["bytes"] = None, ) -> None: self.host_static_pubkey = host_static_pubkey @@ -8107,15 +8107,15 @@ class ThpCredentialRequest(protobuf.MessageType): class ThpCredentialResponse(protobuf.MessageType): MESSAGE_WIRE_TYPE = 1011 FIELDS = { - 1: protobuf.Field("trezor_static_pubkey", "bytes", repeated=False, required=False, default=None), - 2: protobuf.Field("credential", "bytes", repeated=False, required=False, default=None), + 1: protobuf.Field("trezor_static_pubkey", "bytes", repeated=False, required=True), + 2: protobuf.Field("credential", "bytes", repeated=False, required=True), } def __init__( self, *, - trezor_static_pubkey: Optional["bytes"] = None, - credential: Optional["bytes"] = None, + trezor_static_pubkey: "bytes", + credential: "bytes", ) -> None: self.trezor_static_pubkey = trezor_static_pubkey self.credential = credential @@ -8149,15 +8149,15 @@ class ThpCredentialMetadata(protobuf.MessageType): class ThpPairingCredential(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("cred_metadata", "ThpCredentialMetadata", repeated=False, required=False, default=None), - 2: protobuf.Field("mac", "bytes", repeated=False, required=False, default=None), + 1: protobuf.Field("cred_metadata", "ThpCredentialMetadata", repeated=False, required=True), + 2: protobuf.Field("mac", "bytes", repeated=False, required=True), } def __init__( self, *, - cred_metadata: Optional["ThpCredentialMetadata"] = None, - mac: Optional["bytes"] = None, + cred_metadata: "ThpCredentialMetadata", + mac: "bytes", ) -> None: self.cred_metadata = cred_metadata self.mac = mac @@ -8166,15 +8166,15 @@ class ThpPairingCredential(protobuf.MessageType): class ThpAuthenticatedCredentialData(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("host_static_pubkey", "bytes", repeated=False, required=False, default=None), - 2: protobuf.Field("cred_metadata", "ThpCredentialMetadata", repeated=False, required=False, default=None), + 1: protobuf.Field("host_static_pubkey", "bytes", repeated=False, required=True), + 2: protobuf.Field("cred_metadata", "ThpCredentialMetadata", repeated=False, required=True), } def __init__( self, *, - host_static_pubkey: Optional["bytes"] = None, - cred_metadata: Optional["ThpCredentialMetadata"] = None, + host_static_pubkey: "bytes", + cred_metadata: "ThpCredentialMetadata", ) -> None: self.host_static_pubkey = host_static_pubkey self.cred_metadata = cred_metadata diff --git a/rust/trezor-client/src/protos/generated/messages_thp.rs b/rust/trezor-client/src/protos/generated/messages_thp.rs index 61d771722e..aded1f635f 100644 --- a/rust/trezor-client/src/protos/generated/messages_thp.rs +++ b/rust/trezor-client/src/protos/generated/messages_thp.rs @@ -54,7 +54,7 @@ impl ThpDeviceProperties { ::std::default::Default::default() } - // optional string internal_model = 1; + // required string internal_model = 1; pub fn internal_model(&self) -> &str { match self.internal_model.as_ref() { @@ -93,7 +93,7 @@ impl ThpDeviceProperties { // optional uint32 model_variant = 2; pub fn model_variant(&self) -> u32 { - self.model_variant.unwrap_or(0) + self.model_variant.unwrap_or(0u32) } pub fn clear_model_variant(&mut self) { @@ -109,7 +109,7 @@ impl ThpDeviceProperties { self.model_variant = ::std::option::Option::Some(v); } - // optional uint32 protocol_version_major = 3; + // required uint32 protocol_version_major = 3; pub fn protocol_version_major(&self) -> u32 { self.protocol_version_major.unwrap_or(0) @@ -128,7 +128,7 @@ impl ThpDeviceProperties { self.protocol_version_major = ::std::option::Option::Some(v); } - // optional uint32 protocol_version_minor = 4; + // required uint32 protocol_version_minor = 4; pub fn protocol_version_minor(&self) -> u32 { self.protocol_version_minor.unwrap_or(0) @@ -187,6 +187,15 @@ impl ::protobuf::Message for ThpDeviceProperties { const NAME: &'static str = "ThpDeviceProperties"; fn is_initialized(&self) -> bool { + if self.internal_model.is_none() { + return false; + } + if self.protocol_version_major.is_none() { + return false; + } + if self.protocol_version_minor.is_none() { + return false; + } true } @@ -987,7 +996,7 @@ impl ThpSelectMethod { ::std::default::Default::default() } - // optional .hw.trezor.messages.thp.ThpPairingMethod selected_pairing_method = 1; + // required .hw.trezor.messages.thp.ThpPairingMethod selected_pairing_method = 1; pub fn selected_pairing_method(&self) -> ThpPairingMethod { match self.selected_pairing_method { @@ -1029,6 +1038,9 @@ impl ::protobuf::Message for ThpSelectMethod { const NAME: &'static str = "ThpSelectMethod"; fn is_initialized(&self) -> bool { + if self.selected_pairing_method.is_none() { + return false; + } true } @@ -1234,7 +1246,7 @@ impl ThpCodeEntryCommitment { ::std::default::Default::default() } - // optional bytes commitment = 1; + // required bytes commitment = 1; pub fn commitment(&self) -> &[u8] { match self.commitment.as_ref() { @@ -1290,6 +1302,9 @@ impl ::protobuf::Message for ThpCodeEntryCommitment { const NAME: &'static str = "ThpCodeEntryCommitment"; fn is_initialized(&self) -> bool { + if self.commitment.is_none() { + return false; + } true } @@ -1392,7 +1407,7 @@ impl ThpCodeEntryChallenge { ::std::default::Default::default() } - // optional bytes challenge = 1; + // required bytes challenge = 1; pub fn challenge(&self) -> &[u8] { match self.challenge.as_ref() { @@ -1448,6 +1463,9 @@ impl ::protobuf::Message for ThpCodeEntryChallenge { const NAME: &'static str = "ThpCodeEntryChallenge"; fn is_initialized(&self) -> bool { + if self.challenge.is_none() { + return false; + } true } @@ -1550,7 +1568,7 @@ impl ThpCodeEntryCpaceTrezor { ::std::default::Default::default() } - // optional bytes cpace_trezor_public_key = 1; + // required bytes cpace_trezor_public_key = 1; pub fn cpace_trezor_public_key(&self) -> &[u8] { match self.cpace_trezor_public_key.as_ref() { @@ -1606,6 +1624,9 @@ impl ::protobuf::Message for ThpCodeEntryCpaceTrezor { const NAME: &'static str = "ThpCodeEntryCpaceTrezor"; fn is_initialized(&self) -> bool { + if self.cpace_trezor_public_key.is_none() { + return false; + } true } @@ -1710,7 +1731,7 @@ impl ThpCodeEntryCpaceHostTag { ::std::default::Default::default() } - // optional bytes cpace_host_public_key = 1; + // required bytes cpace_host_public_key = 1; pub fn cpace_host_public_key(&self) -> &[u8] { match self.cpace_host_public_key.as_ref() { @@ -1746,7 +1767,7 @@ impl ThpCodeEntryCpaceHostTag { self.cpace_host_public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) } - // optional bytes tag = 2; + // required bytes tag = 2; pub fn tag(&self) -> &[u8] { match self.tag.as_ref() { @@ -1807,6 +1828,12 @@ impl ::protobuf::Message for ThpCodeEntryCpaceHostTag { const NAME: &'static str = "ThpCodeEntryCpaceHostTag"; fn is_initialized(&self) -> bool { + if self.cpace_host_public_key.is_none() { + return false; + } + if self.tag.is_none() { + return false; + } true } @@ -1920,7 +1947,7 @@ impl ThpCodeEntrySecret { ::std::default::Default::default() } - // optional bytes secret = 1; + // required bytes secret = 1; pub fn secret(&self) -> &[u8] { match self.secret.as_ref() { @@ -1976,6 +2003,9 @@ impl ::protobuf::Message for ThpCodeEntrySecret { const NAME: &'static str = "ThpCodeEntrySecret"; fn is_initialized(&self) -> bool { + if self.secret.is_none() { + return false; + } true } @@ -2078,7 +2108,7 @@ impl ThpQrCodeTag { ::std::default::Default::default() } - // optional bytes tag = 1; + // required bytes tag = 1; pub fn tag(&self) -> &[u8] { match self.tag.as_ref() { @@ -2134,6 +2164,9 @@ impl ::protobuf::Message for ThpQrCodeTag { const NAME: &'static str = "ThpQrCodeTag"; fn is_initialized(&self) -> bool { + if self.tag.is_none() { + return false; + } true } @@ -2236,7 +2269,7 @@ impl ThpQrCodeSecret { ::std::default::Default::default() } - // optional bytes secret = 1; + // required bytes secret = 1; pub fn secret(&self) -> &[u8] { match self.secret.as_ref() { @@ -2292,6 +2325,9 @@ impl ::protobuf::Message for ThpQrCodeSecret { const NAME: &'static str = "ThpQrCodeSecret"; fn is_initialized(&self) -> bool { + if self.secret.is_none() { + return false; + } true } @@ -2394,7 +2430,7 @@ impl ThpNfcTagHost { ::std::default::Default::default() } - // optional bytes tag = 1; + // required bytes tag = 1; pub fn tag(&self) -> &[u8] { match self.tag.as_ref() { @@ -2450,6 +2486,9 @@ impl ::protobuf::Message for ThpNfcTagHost { const NAME: &'static str = "ThpNfcTagHost"; fn is_initialized(&self) -> bool { + if self.tag.is_none() { + return false; + } true } @@ -2552,7 +2591,7 @@ impl ThpNfcTagTrezor { ::std::default::Default::default() } - // optional bytes tag = 1; + // required bytes tag = 1; pub fn tag(&self) -> &[u8] { match self.tag.as_ref() { @@ -2608,6 +2647,9 @@ impl ::protobuf::Message for ThpNfcTagTrezor { const NAME: &'static str = "ThpNfcTagTrezor"; fn is_initialized(&self) -> bool { + if self.tag.is_none() { + return false; + } true } @@ -2714,7 +2756,7 @@ impl ThpCredentialRequest { ::std::default::Default::default() } - // optional bytes host_static_pubkey = 1; + // required bytes host_static_pubkey = 1; pub fn host_static_pubkey(&self) -> &[u8] { match self.host_static_pubkey.as_ref() { @@ -2835,6 +2877,9 @@ impl ::protobuf::Message for ThpCredentialRequest { const NAME: &'static str = "ThpCredentialRequest"; fn is_initialized(&self) -> bool { + if self.host_static_pubkey.is_none() { + return false; + } true } @@ -2961,7 +3006,7 @@ impl ThpCredentialResponse { ::std::default::Default::default() } - // optional bytes trezor_static_pubkey = 1; + // required bytes trezor_static_pubkey = 1; pub fn trezor_static_pubkey(&self) -> &[u8] { match self.trezor_static_pubkey.as_ref() { @@ -2997,7 +3042,7 @@ impl ThpCredentialResponse { self.trezor_static_pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) } - // optional bytes credential = 2; + // required bytes credential = 2; pub fn credential(&self) -> &[u8] { match self.credential.as_ref() { @@ -3058,6 +3103,12 @@ impl ::protobuf::Message for ThpCredentialResponse { const NAME: &'static str = "ThpCredentialResponse"; fn is_initialized(&self) -> bool { + if self.trezor_static_pubkey.is_none() { + return false; + } + if self.credential.is_none() { + return false; + } true } @@ -3574,7 +3625,7 @@ impl ThpPairingCredential { ::std::default::Default::default() } - // optional bytes mac = 2; + // required bytes mac = 2; pub fn mac(&self) -> &[u8] { match self.mac.as_ref() { @@ -3635,6 +3686,17 @@ impl ::protobuf::Message for ThpPairingCredential { const NAME: &'static str = "ThpPairingCredential"; fn is_initialized(&self) -> bool { + if self.cred_metadata.is_none() { + return false; + } + if self.mac.is_none() { + return false; + } + for v in &self.cred_metadata { + if !v.is_initialized() { + return false; + } + }; true } @@ -3751,7 +3813,7 @@ impl ThpAuthenticatedCredentialData { ::std::default::Default::default() } - // optional bytes host_static_pubkey = 1; + // required bytes host_static_pubkey = 1; pub fn host_static_pubkey(&self) -> &[u8] { match self.host_static_pubkey.as_ref() { @@ -3812,6 +3874,17 @@ impl ::protobuf::Message for ThpAuthenticatedCredentialData { const NAME: &'static str = "ThpAuthenticatedCredentialData"; fn is_initialized(&self) -> bool { + if self.host_static_pubkey.is_none() { + return false; + } + if self.cred_metadata.is_none() { + return false; + } + for v in &self.cred_metadata { + if !v.is_initialized() { + return false; + } + }; true } @@ -3984,50 +4057,51 @@ impl ThpPairingMethod { static file_descriptor_proto_data: &'static [u8] = b"\ \n\x12messages-thp.proto\x12\x16hw.trezor.messages.thp\x1a\roptions.prot\ - o\"\xa0\x02\n\x13ThpDeviceProperties\x12%\n\x0einternal_model\x18\x01\ - \x20\x01(\tR\rinternalModel\x12#\n\rmodel_variant\x18\x02\x20\x01(\rR\ - \x0cmodelVariant\x124\n\x16protocol_version_major\x18\x03\x20\x01(\rR\ - \x14protocolVersionMajor\x124\n\x16protocol_version_minor\x18\x04\x20\ - \x01(\rR\x14protocolVersionMinor\x12Q\n\x0fpairing_methods\x18\x05\x20\ + o\"\xa3\x02\n\x13ThpDeviceProperties\x12%\n\x0einternal_model\x18\x01\ + \x20\x02(\tR\rinternalModel\x12&\n\rmodel_variant\x18\x02\x20\x01(\r:\ + \x010R\x0cmodelVariant\x124\n\x16protocol_version_major\x18\x03\x20\x02(\ + \rR\x14protocolVersionMajor\x124\n\x16protocol_version_minor\x18\x04\x20\ + \x02(\rR\x14protocolVersionMinor\x12Q\n\x0fpairing_methods\x18\x05\x20\ \x03(\x0e2(.hw.trezor.messages.thp.ThpPairingMethodR\x0epairingMethods\"\ _\n%ThpHandshakeCompletionReqNoisePayload\x126\n\x17host_pairing_credent\ - ial\x18\x01\x20\x01(\x0cR\x15hostPairingCredential\"y\n\x13ThpCreateNewS\ - ession\x12\x1e\n\npassphrase\x18\x01\x20\x01(\tR\npassphrase\x12\x1b\n\t\ - on_device\x18\x02\x20\x01(\x08R\x08onDevice\x12%\n\x0ederive_cardano\x18\ - \x03\x20\x01(\x08R\rderiveCardano\"0\n\x11ThpPairingRequest\x12\x1b\n\th\ - ost_name\x18\x01\x20\x01(\tR\x08hostName\"\x1b\n\x19ThpPairingRequestApp\ - roved\"s\n\x0fThpSelectMethod\x12`\n\x17selected_pairing_method\x18\x01\ - \x20\x01(\x0e2(.hw.trezor.messages.thp.ThpPairingMethodR\x15selectedPair\ - ingMethod\"\x20\n\x1eThpPairingPreparationsFinished\"8\n\x16ThpCodeEntry\ - Commitment\x12\x1e\n\ncommitment\x18\x01\x20\x01(\x0cR\ncommitment\"5\n\ - \x15ThpCodeEntryChallenge\x12\x1c\n\tchallenge\x18\x01\x20\x01(\x0cR\tch\ - allenge\"P\n\x17ThpCodeEntryCpaceTrezor\x125\n\x17cpace_trezor_public_ke\ - y\x18\x01\x20\x01(\x0cR\x14cpaceTrezorPublicKey\"_\n\x18ThpCodeEntryCpac\ - eHostTag\x121\n\x15cpace_host_public_key\x18\x01\x20\x01(\x0cR\x12cpaceH\ - ostPublicKey\x12\x10\n\x03tag\x18\x02\x20\x01(\x0cR\x03tag\",\n\x12ThpCo\ - deEntrySecret\x12\x16\n\x06secret\x18\x01\x20\x01(\x0cR\x06secret\"\x20\ - \n\x0cThpQrCodeTag\x12\x10\n\x03tag\x18\x01\x20\x01(\x0cR\x03tag\")\n\ - \x0fThpQrCodeSecret\x12\x16\n\x06secret\x18\x01\x20\x01(\x0cR\x06secret\ - \"!\n\rThpNfcTagHost\x12\x10\n\x03tag\x18\x01\x20\x01(\x0cR\x03tag\"#\n\ - \x0fThpNfcTagTrezor\x12\x10\n\x03tag\x18\x01\x20\x01(\x0cR\x03tag\"\x86\ - \x01\n\x14ThpCredentialRequest\x12,\n\x12host_static_pubkey\x18\x01\x20\ - \x01(\x0cR\x10hostStaticPubkey\x12\x20\n\x0bautoconnect\x18\x02\x20\x01(\ - \x08R\x0bautoconnect\x12\x1e\n\ncredential\x18\x03\x20\x01(\x0cR\ncreden\ - tial\"i\n\x15ThpCredentialResponse\x120\n\x14trezor_static_pubkey\x18\ - \x01\x20\x01(\x0cR\x12trezorStaticPubkey\x12\x1e\n\ncredential\x18\x02\ - \x20\x01(\x0cR\ncredential\"\x0f\n\rThpEndRequest\"\x10\n\x0eThpEndRespo\ - nse\"\\\n\x15ThpCredentialMetadata\x12\x1b\n\thost_name\x18\x01\x20\x01(\ - \tR\x08hostName\x12\x20\n\x0bautoconnect\x18\x02\x20\x01(\x08R\x0bautoco\ - nnect:\x04\x98\xb2\x19\x01\"\x82\x01\n\x14ThpPairingCredential\x12R\n\rc\ - red_metadata\x18\x01\x20\x01(\x0b2-.hw.trezor.messages.thp.ThpCredential\ - MetadataR\x0ccredMetadata\x12\x10\n\x03mac\x18\x02\x20\x01(\x0cR\x03mac:\ - \x04\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.ThpCrede\ - ntialMetadataR\x0ccredMetadata:\x04\x98\xb2\x19\x01*G\n\x10ThpPairingMet\ - hod\x12\x0f\n\x0bSkipPairing\x10\x01\x12\r\n\tCodeEntry\x10\x02\x12\n\n\ - \x06QrCode\x10\x03\x12\x07\n\x03NFC\x10\x04B;\n#com.satoshilabs.trezor.l\ - ib.protobufB\x10TrezorMessageThp\x80\xa6\x1d\x01\ + ial\x18\x01\x20\x01(\x0cR\x15hostPairingCredential\"\x87\x01\n\x13ThpCre\ + ateNewSession\x12\x1e\n\npassphrase\x18\x01\x20\x01(\tR\npassphrase\x12\ + \"\n\ton_device\x18\x02\x20\x01(\x08:\x05falseR\x08onDevice\x12,\n\x0ede\ + rive_cardano\x18\x03\x20\x01(\x08:\x05falseR\rderiveCardano\"0\n\x11ThpP\ + airingRequest\x12\x1b\n\thost_name\x18\x01\x20\x01(\tR\x08hostName\"\x1b\ + \n\x19ThpPairingRequestApproved\"s\n\x0fThpSelectMethod\x12`\n\x17select\ + ed_pairing_method\x18\x01\x20\x02(\x0e2(.hw.trezor.messages.thp.ThpPairi\ + ngMethodR\x15selectedPairingMethod\"\x20\n\x1eThpPairingPreparationsFini\ + shed\"8\n\x16ThpCodeEntryCommitment\x12\x1e\n\ncommitment\x18\x01\x20\ + \x02(\x0cR\ncommitment\"5\n\x15ThpCodeEntryChallenge\x12\x1c\n\tchalleng\ + e\x18\x01\x20\x02(\x0cR\tchallenge\"P\n\x17ThpCodeEntryCpaceTrezor\x125\ + \n\x17cpace_trezor_public_key\x18\x01\x20\x02(\x0cR\x14cpaceTrezorPublic\ + Key\"_\n\x18ThpCodeEntryCpaceHostTag\x121\n\x15cpace_host_public_key\x18\ + \x01\x20\x02(\x0cR\x12cpaceHostPublicKey\x12\x10\n\x03tag\x18\x02\x20\ + \x02(\x0cR\x03tag\",\n\x12ThpCodeEntrySecret\x12\x16\n\x06secret\x18\x01\ + \x20\x02(\x0cR\x06secret\"\x20\n\x0cThpQrCodeTag\x12\x10\n\x03tag\x18\ + \x01\x20\x02(\x0cR\x03tag\")\n\x0fThpQrCodeSecret\x12\x16\n\x06secret\ + \x18\x01\x20\x02(\x0cR\x06secret\"!\n\rThpNfcTagHost\x12\x10\n\x03tag\ + \x18\x01\x20\x02(\x0cR\x03tag\"#\n\x0fThpNfcTagTrezor\x12\x10\n\x03tag\ + \x18\x01\x20\x02(\x0cR\x03tag\"\x8d\x01\n\x14ThpCredentialRequest\x12,\n\ + \x12host_static_pubkey\x18\x01\x20\x02(\x0cR\x10hostStaticPubkey\x12'\n\ + \x0bautoconnect\x18\x02\x20\x01(\x08:\x05falseR\x0bautoconnect\x12\x1e\n\ + \ncredential\x18\x03\x20\x01(\x0cR\ncredential\"i\n\x15ThpCredentialResp\ + onse\x120\n\x14trezor_static_pubkey\x18\x01\x20\x02(\x0cR\x12trezorStati\ + cPubkey\x12\x1e\n\ncredential\x18\x02\x20\x02(\x0cR\ncredential\"\x0f\n\ + \rThpEndRequest\"\x10\n\x0eThpEndResponse\"\\\n\x15ThpCredentialMetadata\ + \x12\x1b\n\thost_name\x18\x01\x20\x01(\tR\x08hostName\x12\x20\n\x0bautoc\ + onnect\x18\x02\x20\x01(\x08R\x0bautoconnect:\x04\x98\xb2\x19\x01\"\x82\ + \x01\n\x14ThpPairingCredential\x12R\n\rcred_metadata\x18\x01\x20\x02(\ + \x0b2-.hw.trezor.messages.thp.ThpCredentialMetadataR\x0ccredMetadata\x12\ + \x10\n\x03mac\x18\x02\x20\x02(\x0cR\x03mac:\x04\x98\xb2\x19\x01\"\xa8\ + \x01\n\x1eThpAuthenticatedCredentialData\x12,\n\x12host_static_pubkey\ + \x18\x01\x20\x02(\x0cR\x10hostStaticPubkey\x12R\n\rcred_metadata\x18\x02\ + \x20\x02(\x0b2-.hw.trezor.messages.thp.ThpCredentialMetadataR\x0ccredMet\ + adata:\x04\x98\xb2\x19\x01*G\n\x10ThpPairingMethod\x12\x0f\n\x0bSkipPair\ + ing\x10\x01\x12\r\n\tCodeEntry\x10\x02\x12\n\n\x06QrCode\x10\x03\x12\x07\ + \n\x03NFC\x10\x04B;\n#com.satoshilabs.trezor.lib.protobufB\x10TrezorMess\ + ageThp\x80\xa6\x1d\x01\ "; /// `FileDescriptorProto` object which was a source for this generated file