-
Notifications
You must be signed in to change notification settings - Fork 44
/
messages.proto
316 lines (276 loc) · 7.35 KB
/
messages.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
import "nanopb.proto";
// Specifies algorithm used for deterministic wallet.
enum Algorithm
{
// See https://en.bitcoin.it/wiki/BIP_0032
BIP32 = 0;
// Note that the BitSafe is unlikely to support Electrum's determinstic
// wallet algorithm.
ELECTRUM = 1;
}
// Reset state of wallet. If a wallet is loaded, this message will unload
// (lock) it.
//
// Direction: Host to Device
// Responses: Features
message Initialize
{
// Arbitrary session identifier, which will be echoed back in the response
// (a Features message).
required bytes session_id = 1 [(nanopb).max_size = 64];
}
// List of features supported by the device.
//
// Direction: Device To Host
// Responses: none
message Features
{
// Echoed from Initialize message.
required bytes echoed_session_id = 1 [(nanopb).max_size = 64];
// Name of the manufacturer eg. "Aperture Science".
optional string vendor = 2;
// Major version number of the device eg. 0.
optional uint32 major_version = 3;
// Minor version number of the device eg. 9.
optional uint32 minor_version = 4;
// Vendor-specific configuration information (eg. firmware build options).
optional string config = 5;
// Whether device is able to use OtpRequest interjections.
optional bool otp = 6;
// Whether device is able to use PinRequest interjections.
optional bool pin = 7;
// Whether device expects supporting transactions to be included when
// signing a transaction.
optional bool spv = 8;
// List of supported deterministic wallet algorithms.
repeated Algorithm algo = 9 [(nanopb).max_count = 2];
// Whether DebugLink is enabled. Production builds will never have
// DebugLink enabled.
optional bool debug_link = 10;
}
// Check whether device is still alive.
//
// Direction: Host to Device
// Responses: PingResponse
message Ping
{
// Arbitrary greeting which will be echoed back in the response
// (PingResponse message).
optional string greeting = 1 [(nanopb).max_size = 64];
}
// Response to Ping message which indicates to the host that the device is
// still alive.
//
// Direction: Device To Host
// Responses: none
message PingResponse
{
// Echoed from Ping message.
optional string echoed_greeting = 1 [(nanopb).max_size = 64];
// Echoed from most recent Initialize message. The host can use this as
// a sanity check to ensure the device hasn't reset itself in the middle
// of a session. If Initialize hasn't been called since reset, this will
// be filled with 00s.
required bytes echoed_session_id = 2 [(nanopb).max_size = 64];
}
// Responses: none
message Success
{
}
// Responses: none
message Failure
{
// Numeric identifier of error.
required uint32 error_code = 1;
// Human-readable description of error.
required string error_message = 2;
}
// Interjection sent from the device to the host specifying that a button
// press (on the device) is required in order to continue.
// Responses: ButtonAck or ButtonCancel
message ButtonRequest
{
}
// Host grants permission for device to wait for button press.
message ButtonAck
{
}
// Host denies permission for device to wait for button press. This will
// probably cause the current action to be cancelled.
message ButtonCancel
{
}
// Interjection sent from the device to the host specifying that an action
// requires a password to be submitted to the device.
message PinRequest
{
}
// Host submits password to the device.
message PinAck
{
required bytes password = 1;
}
// Host does not want to submit password to the device.
message PinCancel
{
}
message OtpRequest
{
}
message OtpAck
{
required string otp = 1 [(nanopb).max_size = 16];
}
message OtpCancel
{
}
// Delete a wallet, making space for another one. Deleting a wallet does not
// require that wallet to be loaded. Thus it is possible to delete a wallet
// that you don't own.
//
// Direction: Host to Device
// Responses: Success or Failure
// Response interjections: ButtonRequest, OtpRequest
message DeleteWallet
{
// Which wallet to delete.
optional uint32 wallet_handle = 1 [default = 0];
}
// Responses: Success or Failure
// Response interjections: ButtonRequest
// wallet_name is stored purely for the convenience of the host. It should be
// a null-terminated UTF-8 encoded string with a maximum length of 40 bytes.
// To create an unencrypted wallet, exclude password.
message NewWallet
{
optional uint32 wallet_number = 1 [default = 0];
optional bytes password = 2;
optional bytes wallet_name = 3 [(nanopb).max_size = 40];
optional bool is_hidden = 4 [default = false];
}
// Responses: Address or Failure
// Response interjections: ButtonRequest
message NewAddress
{
}
// Responses: none
message Address
{
required uint32 address_handle = 1;
required bytes public_key = 2 [(nanopb).max_size = 65];
required bytes address = 3 [(nanopb).max_size = 20];
}
// Responses: NumberOfAddresses or Failure
message GetNumberOfAddresses
{
}
// Responses: none
message NumberOfAddresses
{
required uint32 number_of_addresses = 1;
}
// Responses: Address or Failure
message GetAddressAndPublicKey
{
required uint32 address_handle = 1;
}
// Responses: Signature or Failure
// Response interjections: ButtonRequest
message SignTransaction
{
required uint32 address_handle = 1;
required bytes transaction_data = 2;
}
// Responses: none
message Signature
{
required bytes signature_data = 1 [(nanopb).max_size = 73];
}
// Responses: Success or Failure
// Response interjections: PinRequest
message LoadWallet
{
optional uint32 wallet_number = 1 [default = 0];
}
// Responses: Success or Failure
// Response interjections: ButtonRequest
message FormatWalletArea
{
required bytes initial_entropy_pool = 1 [(nanopb).max_size = 32];
}
// Responses: Success or Failure
// Response interjections: ButtonRequest
// To change the current wallet into an unencrypted wallet,
// exclude password.
message ChangeEncryptionKey
{
optional bytes password = 1;
}
// Responses: Success or Failure
// Response interjections: ButtonRequest
// wallet_name is stored purely for the convenience of the host. It should be
// a null-terminated UTF-8 encoded string with a maximum length of 40 bytes.
message ChangeWalletName
{
required bytes wallet_name = 1 [(nanopb).max_size = 40];
}
// Responses: Wallets or Failure
message ListWallets
{
}
// Responses: none
message WalletInfo
{
required uint32 wallet_number = 1;
required bytes wallet_name = 2 [(nanopb).max_size = 40];
required bytes wallet_uuid = 3 [(nanopb).max_size = 16];
}
// Responses: none
message Wallets
{
repeated WalletInfo wallet_info = 1;
}
// Responses: Success or Failure
// Response interjections: ButtonRequest
message BackupWallet
{
optional bool is_encrypted = 1 [default = false];
optional uint32 device = 2 [default = 0];
}
// Responses: Success or Failure
// Response interjections: ButtonRequest
message RestoreWallet
{
required NewWallet new_wallet = 1;
required bytes seed = 2 [(nanopb).max_size = 64];
}
// Responses: DeviceUUID or Failure
message GetDeviceUUID
{
}
// Responses: none
message DeviceUUID
{
required bytes device_uuid = 1 [(nanopb).max_size = 16];
}
// Responses: Entropy or Failure
message GetEntropy
{
required uint32 number_of_bytes = 1;
}
// Responses: none
message Entropy
{
required bytes entropy = 1;
}
// Responses: MasterPublicKey or Failure
// Response interjections: ButtonRequest
message GetMasterPublicKey
{
}
// Responses: none
message MasterPublicKey
{
required bytes public_key = 1 [(nanopb).max_size = 65];
required bytes chain_code = 2 [(nanopb).max_size = 32];
}