@@ -10,6 +10,44 @@ import "options.proto";
10
10
option (include_in_bitcoin_only) = true ;
11
11
12
12
13
+ /**
14
+ * Mapping between Trezor wire identifier (uint) and a Thp protobuf message
15
+ */
16
+ enum ThpMessageType {
17
+ option (wire_enum) = true ;
18
+
19
+ reserved 0 to 19 ; // Values reserved by other messages, see messages.proto
20
+ ThpMessageType_Cancel = 20 ;
21
+ reserved 21 to 25 ;
22
+ ThpMessageType_ButtonRequest = 26 ;
23
+ reserved 27 to 999 ;
24
+
25
+ reserved 1000 ; // MessageType_ThpCreateNewSession
26
+ reserved 1001 to 1005 ; // never appeared in a release, reserved for future use
27
+ ThpMessageType_ThpPairingRequest = 1006 ;
28
+ ThpMessageType_ThpPairingRequestApproved = 1007 ;
29
+ ThpMessageType_ThpSelectMethod = 1008 ;
30
+ ThpMessageType_ThpPairingPreparationsFinished = 1009 ;
31
+ ThpMessageType_ThpCredentialRequest = 1010 ;
32
+ ThpMessageType_ThpCredentialResponse = 1011 ;
33
+ ThpMessageType_ThpEndRequest = 1012 ;
34
+ ThpMessageType_ThpEndResponse = 1013 ;
35
+ reserved 1014 to 1015 ; // reserved for future use
36
+ ThpMessageType_ThpCodeEntryCommitment = 1016 ;
37
+ ThpMessageType_ThpCodeEntryChallenge = 1017 ;
38
+ ThpMessageType_ThpCodeEntryCpaceTrezor = 1018 ;
39
+ ThpMessageType_ThpCodeEntryCpaceHostTag = 1019 ;
40
+ ThpMessageType_ThpCodeEntrySecret = 1020 ;
41
+ reserved 1021 to 1023 ; // reserved for future use
42
+ ThpMessageType_ThpQrCodeTag = 1024 ;
43
+ ThpMessageType_ThpQrCodeSecret = 1025 ;
44
+ reserved 1026 to 1031 ; // reserved for future use
45
+ ThpMessageType_ThpNfcTagHost = 1032 ;
46
+ ThpMessageType_ThpNfcTagTrezor = 1033 ;
47
+
48
+ reserved 1100 to 2147483647 ; // Values reserved by other messages, see messages.proto
49
+ }
50
+
13
51
/**
14
52
* Numeric identifiers of pairing methods.
15
53
* @embed
@@ -25,10 +63,10 @@ enum ThpPairingMethod {
25
63
* @embed
26
64
*/
27
65
message ThpDeviceProperties {
28
- optional string internal_model = 1 ; // Internal model name e.g. "T2B1".
29
- optional uint32 model_variant = 2 ; // Encodes the device properties such as color.
30
- optional uint32 protocol_version_major = 3 ; // The major version of the communication protocol used by the firmware.
31
- optional uint32 protocol_version_minor = 4 ; // The minor version of the communication protocol used by the firmware.
66
+ required string internal_model = 1 ; // Internal model name e.g. "T2B1".
67
+ optional uint32 model_variant = 2 [ default = 0 ]; // Encodes the device properties such as color.
68
+ required uint32 protocol_version_major = 3 ; // The major version of the communication protocol used by the firmware.
69
+ required uint32 protocol_version_minor = 4 ; // The minor version of the communication protocol used by the firmware.
32
70
repeated ThpPairingMethod pairing_methods = 5 ; // The pairing methods supported by the Trezor.
33
71
}
34
72
@@ -44,10 +82,10 @@ message ThpHandshakeCompletionReqNoisePayload {
44
82
* @start
45
83
* @next Success
46
84
*/
47
- message ThpCreateNewSession {
85
+ message ThpCreateNewSession {
48
86
optional string passphrase = 1 ;
49
- optional bool on_device = 2 ; // User wants to enter passphrase on the device
50
- optional bool derive_cardano = 3 ; // If True, Cardano keys will be derived. Ignored with BTC-only
87
+ optional bool on_device = 2 [ default = false ]; // User wants to enter passphrase on the device
88
+ optional bool derive_cardano = 3 [ default = false ]; // If True, Cardano keys will be derived. Ignored with BTC-only
51
89
}
52
90
53
91
@@ -56,7 +94,7 @@ message ThpCreateNewSession{
56
94
* @start
57
95
* @next ThpPairingRequestApproved
58
96
*/
59
- message ThpPairingRequest {
97
+ message ThpPairingRequest {
60
98
optional string host_name = 1 ; // Human-readable host name
61
99
}
62
100
@@ -65,7 +103,7 @@ message ThpPairingRequest{
65
103
* @start
66
104
* @next ThpSelectMethod
67
105
*/
68
- message ThpPairingRequestApproved {
106
+ message ThpPairingRequestApproved {
69
107
}
70
108
71
109
/**
@@ -75,7 +113,7 @@ message ThpPairingRequestApproved{
75
113
* @next ThpCodeEntryCommitment
76
114
*/
77
115
message ThpSelectMethod {
78
- optional ThpPairingMethod selected_pairing_method = 1 ;
116
+ required ThpPairingMethod selected_pairing_method = 1 ;
79
117
}
80
118
81
119
/**
@@ -84,40 +122,40 @@ message ThpSelectMethod {
84
122
* @next ThpQrCodeTag
85
123
* @next ThpNfcTagHost
86
124
*/
87
- message ThpPairingPreparationsFinished {
125
+ message ThpPairingPreparationsFinished {
88
126
}
89
127
90
128
/**
91
129
* Response: If Code Entry is an allowed pairing option, Trezor responds with a commitment.
92
130
* @next ThpCodeEntryChallenge
93
131
*/
94
132
message ThpCodeEntryCommitment {
95
- optional bytes commitment = 1 ; // SHA-256 of Trezor's random 32-byte secret
133
+ required bytes commitment = 1 ; // SHA-256 of Trezor's random 32-byte secret
96
134
}
97
135
98
136
/**
99
137
* Response: Host responds to Trezor's Code Entry commitment with a challenge.
100
138
* @next ThpCodeEntryCpaceTrezor
101
139
*/
102
140
message ThpCodeEntryChallenge {
103
- optional bytes challenge = 1 ; // Host's random 32-byte challenge
141
+ required bytes challenge = 1 ; // Host's random 32-byte challenge
104
142
}
105
143
106
144
/**
107
145
* Response: Trezor continues with the CPACE protocol.
108
146
* @next ThpCodeEntryCpaceHostTag
109
147
*/
110
148
message ThpCodeEntryCpaceTrezor {
111
- optional bytes cpace_trezor_public_key = 1 ; // Trezor's ephemeral CPace public key
149
+ required bytes cpace_trezor_public_key = 1 ; // Trezor's ephemeral CPace public key
112
150
}
113
151
114
152
/**
115
153
* Request: User selected Code Entry option in Host. Host starts CPACE protocol with Trezor.
116
154
* @next ThpCodeEntrySecret
117
155
*/
118
156
message ThpCodeEntryCpaceHostTag {
119
- optional bytes cpace_host_public_key = 1 ; // Host's ephemeral CPace public key
120
- optional bytes tag = 2 ; // SHA-256 of shared secret
157
+ required bytes cpace_host_public_key = 1 ; // Host's ephemeral CPace public key
158
+ required bytes tag = 2 ; // SHA-256 of shared secret
121
159
122
160
}
123
161
@@ -127,15 +165,15 @@ message ThpCodeEntryCpaceTrezor {
127
165
* @next ThpEndRequest
128
166
*/
129
167
message ThpCodeEntrySecret {
130
- optional bytes secret = 1 ; // Trezor's secret
168
+ required bytes secret = 1 ; // Trezor's secret
131
169
}
132
170
133
171
/**
134
172
* Request: User selected QR Code pairing option. Host sends a QR Tag.
135
173
* @next ThpQrCodeSecret
136
174
*/
137
175
message ThpQrCodeTag {
138
- optional bytes tag = 1 ; // SHA-256 of shared secret
176
+ required bytes tag = 1 ; // SHA-256 of shared secret
139
177
}
140
178
141
179
/**
@@ -144,15 +182,15 @@ message ThpQrCodeTag {
144
182
* @next ThpEndRequest
145
183
*/
146
184
message ThpQrCodeSecret {
147
- optional bytes secret = 1 ; // Trezor's secret
185
+ required bytes secret = 1 ; // Trezor's secret
148
186
}
149
187
150
188
/**
151
189
* Request: User selected Unidirectional NFC pairing option. Host sends an Unidirectional NFC Tag.
152
190
* @next ThpNfcTagTrezor
153
191
*/
154
192
message ThpNfcTagHost {
155
- optional bytes tag = 1 ; // Host's tag
193
+ required bytes tag = 1 ; // Host's tag
156
194
}
157
195
158
196
/**
@@ -161,7 +199,7 @@ message ThpNfcTagHost {
161
199
* @next ThpEndRequest
162
200
*/
163
201
message ThpNfcTagTrezor {
164
- optional bytes tag = 1 ; // Trezor's tag
202
+ required bytes tag = 1 ; // Trezor's tag
165
203
}
166
204
167
205
/**
@@ -170,9 +208,9 @@ message ThpNfcTagTrezor {
170
208
* @next ThpCredentialResponse
171
209
*/
172
210
message ThpCredentialRequest {
173
- optional bytes host_static_pubkey = 1 ; // Host's static public key identifying the credential.
174
- optional bool autoconnect = 2 ; // Whether host wants to autoconnect without user confirmation
175
- optional bytes credential = 3 ; // Host's previous credential
211
+ required bytes host_static_pubkey = 1 ; // Host's static public key identifying the credential.
212
+ optional bool autoconnect = 2 [ default = false ]; // Whether host wants to autoconnect without user confirmation
213
+ optional bytes credential = 3 ; // Host's previous credential
176
214
}
177
215
178
216
/**
@@ -181,8 +219,8 @@ message ThpCredentialRequest {
181
219
* @next ThpEndRequest
182
220
*/
183
221
message ThpCredentialResponse {
184
- optional bytes trezor_static_pubkey = 1 ; // Trezor's static public key used in the handshake.
185
- optional bytes credential = 2 ; // The pairing credential issued by the Trezor to the host.
222
+ required bytes trezor_static_pubkey = 1 ; // Trezor's static public key used in the handshake.
223
+ required bytes credential = 2 ; // The pairing credential issued by the Trezor to the host.
186
224
}
187
225
188
226
/**
@@ -214,8 +252,8 @@ message ThpEndResponse {}
214
252
*/
215
253
message ThpPairingCredential {
216
254
option (internal_only) = true ;
217
- optional ThpCredentialMetadata cred_metadata = 1 ; // Credential metadata
218
- optional bytes mac = 2 ; // Message authentication code generated by the Trezor
255
+ required ThpCredentialMetadata cred_metadata = 1 ; // Credential metadata
256
+ required bytes mac = 2 ; // Message authentication code generated by the Trezor
219
257
}
220
258
221
259
/**
@@ -224,6 +262,6 @@ message ThpEndResponse {}
224
262
*/
225
263
message ThpAuthenticatedCredentialData {
226
264
option (internal_only) = true ;
227
- optional bytes host_static_pubkey = 1 ; // Host's static public key used in the handshake
228
- optional ThpCredentialMetadata cred_metadata = 2 ; // Credential metadata
265
+ required bytes host_static_pubkey = 1 ; // Host's static public key used in the handshake
266
+ required ThpCredentialMetadata cred_metadata = 2 ; // Credential metadata
229
267
}
0 commit comments