-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathmessages-management.proto
More file actions
885 lines (805 loc) · 27.4 KB
/
messages-management.proto
File metadata and controls
885 lines (805 loc) · 27.4 KB
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
syntax = "proto2";
package hw.trezor.messages.management;
// Sugar for easier handling in Java
option java_package = "com.satoshilabs.trezor.lib.protobuf";
option java_outer_classname = "TrezorMessageManagement";
option (include_in_bitcoin_only) = true;
import "messages.proto";
/**
* Type of the mnemonic backup given/received by the device during reset/recovery.
*/
enum BackupType {
Bip39 = 0; // also called "Single Backup", see BIP-0039
Slip39_Basic = 1; // also called "Shamir Backup", see SLIP-0039
Slip39_Advanced = 2; // also called "Super Shamir" or "Shamir with Groups", see SLIP-0039#two-level-scheme
Slip39_Single_Extendable = 3; // extendable single-share Shamir backup
Slip39_Basic_Extendable = 4; // extendable multi-share Shamir backup
Slip39_Advanced_Extendable = 5; // extendable multi-share Shamir backup with groups
}
/**
* Level of safety checks for unsafe actions like spending from invalid path namespace or setting high transaction fee.
*/
enum SafetyCheckLevel {
Strict = 0; // disallow unsafe actions, this is the default
PromptAlways = 1; // ask user before unsafe action
PromptTemporarily = 2; // like PromptAlways but reverts to Strict after reboot
}
/**
* Request: Reset device to default state and ask for device details
* @start
* @next Features
*/
message Initialize {
optional bytes session_id = 1; // assumed device session id; Trezor clears caches if it is different or empty
optional bool _skip_passphrase = 2 [deprecated=true]; // removed as part of passphrase redesign
optional bool derive_cardano = 3; // whether to derive Cardano Icarus root keys in this session
optional string passphrase_state = 8000;
optional bool is_contains_attach = 8001;
}
/**
* Request: Ask for device details (no device reset)
* @start
* @next Features
*/
message GetFeatures {
}
/**
* Request: Ask for device details (no device reset)
* @start
* @next Features
*/
message OnekeyGetFeatures {
}
enum OneKeyDeviceType {
CLASSIC = 0x00;
CLASSIC1S = 0x01;
MINI = 0x02;
TOUCH = 0x03;
PRO = 0x05;
}
enum OneKeySeType {
THD89 = 0x00;
SE608A = 0x01;
}
enum OneKeySEState {
BOOT = 0x00;
APP = 0x01;
}
// enum PinKeyboardLayout {
// LAYOUT_NORMAL = 0;
// LAYOUT_RANDOMIZED = 1;
// }
/**
* Response: Reports various information about the device
* @end
*/
message Features {
optional string vendor = 1; // name of the manufacturer, e.g. "trezor.io"
required uint32 major_version = 2; // major version of the firmware/bootloader, e.g. 1
required uint32 minor_version = 3; // minor version of the firmware/bootloader, e.g. 0
required uint32 patch_version = 4; // patch version of the firmware/bootloader, e.g. 0
optional bool bootloader_mode = 5; // is device in bootloader mode?
optional string device_id = 6; // device's unique identifier
optional bool pin_protection = 7; // is device protected by PIN?
optional bool passphrase_protection = 8; // is node/mnemonic encrypted using passphrase?
optional string language = 9; // device language
optional string label = 10; // device description label
optional bool initialized = 12; // does device contain seed?
optional bytes revision = 13; // SCM revision of firmware
optional bytes bootloader_hash = 14; // hash of the bootloader
optional bool imported = 15; // was storage imported from an external source?
optional bool unlocked = 16; // is the device unlocked? called "pin_cached" previously
optional bool _passphrase_cached = 17 [deprecated=true]; // is passphrase already cached in session?
optional bool firmware_present = 18; // is valid firmware loaded?
optional bool needs_backup = 19; // does storage need backup? (equals to Storage.needs_backup)
optional uint32 flags = 20; // device flags (equals to Storage.flags)
optional string model = 21; // device hardware model
optional uint32 fw_major = 22; // reported firmware version if in bootloader mode
optional uint32 fw_minor = 23; // reported firmware version if in bootloader mode
optional uint32 fw_patch = 24; // reported firmware version if in bootloader mode
optional string fw_vendor = 25; // reported firmware vendor if in bootloader mode
// optional bytes fw_vendor_keys = 26; // obsoleted, use fw_vendor
optional bool unfinished_backup = 27; // report unfinished backup (equals to Storage.unfinished_backup)
optional bool no_backup = 28; // report no backup (equals to Storage.no_backup)
optional bool recovery_mode = 29; // is recovery mode in progress
repeated Capability capabilities = 30; // list of supported capabilities
enum Capability {
option (has_bitcoin_only_values) = true;
Capability_Bitcoin = 1 [(bitcoin_only) = true];
Capability_Bitcoin_like = 2; // Altcoins based on the Bitcoin source code
Capability_Binance = 3;
Capability_Cardano = 4;
Capability_Crypto = 5 [(bitcoin_only) = true]; // generic crypto operations for GPG, SSH, etc.
Capability_EOS = 6;
Capability_Ethereum = 7;
Capability_Lisk = 8 [deprecated = true];
Capability_Monero = 9;
Capability_NEM = 10;
Capability_Ripple = 11;
Capability_Stellar = 12;
Capability_Tezos = 13;
Capability_U2F = 14;
Capability_Shamir = 15 [(bitcoin_only) = true];
Capability_ShamirGroups = 16 [(bitcoin_only) = true];
Capability_PassphraseEntry = 17 [(bitcoin_only) = true]; // the device is capable of passphrase entry directly on the device
Capability_AttachToPin = 18 [(bitcoin_only) = true]; // OneKey: Attach passphrase to PIN feature
Capability_EthereumTypedData = 1000; // the capability of handling EIP-712 typed data
}
optional BackupType backup_type = 31; // type of device backup (BIP-39 / SLIP-39 basic / SLIP-39 advanced)
optional bool sd_card_present = 32; // is SD card present
optional bool sd_protection = 33; // is SD Protect enabled
optional bool wipe_code_protection = 34; // is wipe code protection enabled
optional bytes session_id = 35;
optional bool passphrase_always_on_device = 36; // device enforces passphrase entry on Trezor
optional SafetyCheckLevel safety_checks = 37; // safety check level, set to Prompt to limit path namespace enforcement
optional uint32 auto_lock_delay_ms = 38; // number of milliseconds after which the device locks itself
optional uint32 display_rotation = 39; // in degrees from North
optional bool experimental_features = 40; // are experimental message types enabled?
optional bool busy = 41; // is the device busy, showing "Do not disconnect"?
optional uint32 offset = 500;
optional string ble_name = 501; // OneKey BLE name
optional string ble_ver = 502;
optional bool ble_enable = 503;
optional bool se_enable = 504;
optional string se_ver = 506;
optional bool backup_only = 507;
optional string onekey_version = 508; // OneKey version
optional string onekey_serial = 509;
optional string bootloader_version = 510;
optional string serial_no= 511;
optional string spi_flash = 512;
optional uint32 initstates = 513; // list of facotry state
optional bytes NFT_voucher = 514;
optional string cpu_info = 515;
optional string pre_firmware = 516;
optional uint32 coin_switch = 517;
optional bytes build_id = 518;
optional string boardloader_version = 519;
reserved 520, 521, 530, 531; // used by battery_level(520) product(521) se_build_id(530) se_hash(531) in another device type
optional uint32 brightness_percent = 522; // current brightness of device
optional bool haptic_feedback = 523; // is the vibration & haptic enabled
optional uint32 auto_shutdown_delay_ms = 524; // number of milliseconds after which the device will poweroff
// optional PinKeyboardLayout pin_keyboard_layout = 524; // the layout of the pin input keyboard
// optional bool usb_lock = 525; // the device will auto lock when usb plug/ununplug with usb lock enabled
optional OneKeyDeviceType onekey_device_type = 600;
optional OneKeySeType onekey_se_type = 601;
optional string onekey_board_version = 602;
optional bytes onekey_board_hash = 603;
optional string onekey_boot_version = 604;
optional bytes onekey_boot_hash = 605;
optional string onekey_se01_version = 606;
optional bytes onekey_se01_hash = 607;
optional string onekey_se01_build_id = 608;
optional string onekey_firmware_version = 609;
optional bytes onekey_firmware_hash = 610;
optional string onekey_firmware_build_id = 611;
optional string onekey_serial_no = 612;
optional string onekey_boot_build_id = 613;
optional string onekey_ble_name = 614;
optional string onekey_ble_version = 615;
optional string onekey_ble_build_id = 616;
optional bytes onekey_ble_hash = 617;
optional string onekey_se02_version = 618;
optional string onekey_se03_version = 619;
optional string onekey_se04_version = 620;
optional OneKeySEState onekey_se01_state = 621;
optional OneKeySEState onekey_se02_state = 622;
optional OneKeySEState onekey_se03_state = 623;
optional OneKeySEState onekey_se04_state = 624;
optional bool attach_to_pin_user = 625;
optional bool unlocked_attach_pin = 626;
}
/**
* Response: Reports various information about the device
* @end
*/
message OnekeyFeatures {
optional OneKeyDeviceType onekey_device_type = 1;
optional string onekey_board_version = 2;
optional string onekey_boot_version = 3;
optional string onekey_firmware_version = 4;
optional bytes onekey_board_hash = 5;
optional bytes onekey_boot_hash = 6;
optional bytes onekey_firmware_hash = 7;
optional string onekey_board_build_id = 8;
optional string onekey_boot_build_id = 9;
optional string onekey_firmware_build_id = 10;
optional string onekey_serial_no = 11;
optional string onekey_ble_name = 12;
optional string onekey_ble_version = 13;
optional string onekey_ble_build_id = 14;
optional bytes onekey_ble_hash = 15;
optional OneKeySeType onekey_se_type = 16;
optional OneKeySEState onekey_se01_state = 17;
optional OneKeySEState onekey_se02_state = 18;
optional OneKeySEState onekey_se03_state = 19;
optional OneKeySEState onekey_se04_state = 20;
optional string onekey_se01_version = 21;
optional string onekey_se02_version = 22;
optional string onekey_se03_version = 23;
optional string onekey_se04_version = 24;
optional bytes onekey_se01_hash = 25;
optional bytes onekey_se02_hash = 26;
optional bytes onekey_se03_hash = 27;
optional bytes onekey_se04_hash = 28;
optional string onekey_se01_build_id = 29;
optional string onekey_se02_build_id = 30;
optional string onekey_se03_build_id = 31;
optional string onekey_se04_build_id = 32;
optional string onekey_se01_boot_version = 33;
optional string onekey_se02_boot_version = 34;
optional string onekey_se03_boot_version = 35;
optional string onekey_se04_boot_version = 36;
optional bytes onekey_se01_boot_hash = 37;
optional bytes onekey_se02_boot_hash = 38;
optional bytes onekey_se03_boot_hash = 39;
optional bytes onekey_se04_boot_hash = 40;
optional string onekey_se01_boot_build_id = 41;
optional string onekey_se02_boot_build_id = 42;
optional string onekey_se03_boot_build_id = 43;
optional string onekey_se04_boot_build_id = 44;
}
/**
* Request: soft-lock the device. Following actions will require PIN. Passphrases remain cached.
* @start
* @next Success
*/
message LockDevice {
}
/**
* Request: Show a "Do not disconnect" dialog instead of the standard homescreen.
* @start
* @next Success
*/
message SetBusy {
optional uint32 expiry_ms = 1; // The time in milliseconds after which the dialog will automatically disappear. Overrides any previously set expiry. If not set, then the dialog is hidden.
}
/**
* Request: end the current sesson. Following actions must call Initialize again.
* Cache for the current session is discarded, other sessions remain intact.
* Device is not PIN-locked.
* @start
* @next Success
*/
message EndSession {
}
/**
* Request: change language and/or label of the device
* @start
* @next Success
* @next Failure
*/
message ApplySettings {
optional string language = 1;
optional string label = 2;
optional bool use_passphrase = 3;
optional bytes homescreen = 4;
optional uint32 _passphrase_source = 5 [deprecated=true]; // ASK = 0; DEVICE = 1; HOST = 2;
optional uint32 auto_lock_delay_ms = 6;
optional uint32 display_rotation = 7; // in degrees from North
optional bool passphrase_always_on_device = 8; // do not prompt for passphrase, enforce device entry
optional SafetyCheckLevel safety_checks = 9; // Safety check level, set to Prompt to limit path namespace enforcement
optional bool experimental_features = 10; // enable experimental message types
reserved 11 to 499;
optional uint32 auto_shutdown_delay_ms = 500;
optional bool change_brightness = 501;
optional bool haptic_feedback = 502;
// optional PinKeyboardLayout keybaord_layout = 503;
// optional bool usb_lock = 504;
}
/**
* Request: set flags of the device
* @start
* @next Success
* @next Failure
*/
message ApplyFlags {
required uint32 flags = 1; // bitmask, can only set bits, not unset
}
/**
* Request: Starts workflow for setting/changing/removing the PIN
* @start
* @next Success
* @next Failure
*/
message ChangePin {
optional bool remove = 1; // is PIN removal requested?
}
/**
* Request: Starts workflow for setting/removing the wipe code
* @start
* @next Success
* @next Failure
*/
message ChangeWipeCode {
optional bool remove = 1; // is wipe code removal requested?
}
/**
* Request: Starts workflow for enabling/regenerating/disabling SD card protection
* @start
* @next Success
* @next Failure
*/
message SdProtect {
required SdProtectOperationType operation = 1;
/**
* Structure representing SD card protection operation
*/
enum SdProtectOperationType {
DISABLE = 0;
ENABLE = 1;
REFRESH = 2;
}
}
/**
* Request: Test if the device is alive, device sends back the message in Success response
* @start
* @next Success
*/
message Ping {
optional string message = 1 [default=""]; // message to send back in Success message
optional bool button_protection = 2; // ask for button press
}
/**
* Request: Abort last operation that required user interaction
* @start
* @next Failure
*/
message Cancel {
}
/**
* Request: Request a sample of random data generated by hardware RNG. May be used for testing.
* @start
* @next Entropy
* @next Failure
*/
message GetEntropy {
required uint32 size = 1; // size of requested entropy
}
/**
* Response: Reply with random data generated by internal RNG
* @end
*/
message Entropy {
required bytes entropy = 1; // chunk of random generated bytes
}
/**
* Request: Get a hash of the installed firmware combined with an optional challenge.
* @start
* @next FirmwareHash
* @next Failure
*/
message GetFirmwareHash {
optional bytes challenge = 1; // Blake2s key up to 32 bytes in length.
}
/**
* Response: Hash of the installed firmware combined with the optional challenge.
* @end
*/
message FirmwareHash {
required bytes hash = 1;
}
/**
* Request: Request device to wipe all sensitive data and settings
* @start
* @next Success
* @next Failure
*/
message WipeDevice {
}
/**
* Request: Load seed and related internal settings from the computer
* @start
* @next Success
* @next Failure
*/
message LoadDevice {
repeated string mnemonics = 1; // seed encoded as mnemonic (12, 18 or 24 words for BIP39, 20 or 33 for SLIP39)
optional string pin = 3; // set PIN protection
optional bool passphrase_protection = 4; // enable master node encryption using passphrase
optional string language = 5 [default='en-US']; // device language (IETF BCP 47 language tag)
optional string label = 6; // device label
optional bool skip_checksum = 7; // do not test mnemonic for valid BIP-39 checksum
optional uint32 u2f_counter = 8; // U2F counter
optional bool needs_backup = 9; // set "needs backup" flag
optional bool no_backup = 10; // indicate that no backup is going to be made
}
/**
* Request: Ask device to do initialization involving user interaction
* @start
* @next EntropyRequest
* @next Failure
*/
message ResetDevice {
optional bool display_random = 1; // display entropy generated by the device before asking for additional entropy
optional uint32 strength = 2 [default=256]; // strength of seed in bits
optional bool passphrase_protection = 3; // enable master node encryption using passphrase
optional bool pin_protection = 4; // enable PIN protection
optional string language = 5 [default='en-US']; // device language (IETF BCP 47 language tag)
optional string label = 6; // device label
optional uint32 u2f_counter = 7; // U2F counter
optional bool skip_backup = 8; // postpone seed backup to BackupDevice workflow
optional bool no_backup = 9; // indicate that no backup is going to be made
optional BackupType backup_type = 10 [default=Bip39]; // type of the mnemonic backup
}
/**
* Request: Perform backup of the device seed if not backed up using ResetDevice
* @start
* @next Success
*/
message BackupDevice {
}
/**
* Response: Ask for additional entropy from host computer
* @next EntropyAck
*/
message EntropyRequest {
}
/**
* Request: Provide additional entropy for seed generation function
* @next Success
*/
message EntropyAck {
required bytes entropy = 1; // 256 bits (32 bytes) of random data
}
/**
* Request: Start recovery workflow asking user for specific words of mnemonic
* Used to recovery device safely even on untrusted computer.
* @start
* @next WordRequest
*/
message RecoveryDevice {
optional uint32 word_count = 1; // number of words in BIP-39 mnemonic
optional bool passphrase_protection = 2; // enable master node encryption using passphrase
optional bool pin_protection = 3; // enable PIN protection
optional string language = 4; // device language (IETF BCP 47 language tag)
optional string label = 5; // device label
optional bool enforce_wordlist = 6; // enforce BIP-39 wordlist during the process
// 7 reserved for unused recovery method
optional RecoveryDeviceType type = 8; // supported recovery type
optional uint32 u2f_counter = 9; // U2F counter
optional bool dry_run = 10; // perform dry-run recovery workflow (for safe mnemonic validation)
/**
* Type of recovery procedure. These should be used as bitmask, e.g.,
* `RecoveryDeviceType_ScrambledWords | RecoveryDeviceType_Matrix`
* listing every method supported by the host computer.
*
* Note that ScrambledWords must be supported by every implementation
* for backward compatibility; there is no way to not support it.
*/
enum RecoveryDeviceType {
// use powers of two when extending this field
RecoveryDeviceType_ScrambledWords = 0; // words in scrambled order
RecoveryDeviceType_Matrix = 1; // matrix recovery type
}
}
/**
* Response: Device is waiting for user to enter word of the mnemonic
* Its position is shown only on device's internal display.
* @next WordAck
*/
message WordRequest {
required WordRequestType type = 1;
/**
* Type of Recovery Word request
*/
enum WordRequestType {
WordRequestType_Plain = 0;
WordRequestType_Matrix9 = 1;
WordRequestType_Matrix6 = 2;
}
}
/**
* Request: Computer replies with word from the mnemonic
* @next WordRequest
* @next Success
* @next Failure
*/
message WordAck {
required string word = 1; // one word of mnemonic on asked position
}
/**
* Request: Set U2F counter
* @start
* @next Success
*/
message SetU2FCounter {
required uint32 u2f_counter = 1;
}
/**
* Request: Set U2F counter
* @start
* @next NextU2FCounter
*/
message GetNextU2FCounter {
}
/**
* Request: Set U2F counter
* @end
*/
message NextU2FCounter {
required uint32 u2f_counter = 1;
}
/**
* Request: Ask device to prepare for a preauthorized operation.
* @start
* @next PreauthorizedRequest
* @next Failure
*/
message DoPreauthorized {
}
/**
* Request: Device awaits a preauthorized operation.
* @start
* @next SignTx
* @next GetOwnershipProof
*/
message PreauthorizedRequest {
}
/**
* Request: Cancel any outstanding authorization in the current session.
* @start
* @next Success
* @next Failure
*/
message CancelAuthorization {
}
/**
* Request: Reboot firmware to bootloader
* @start
* @next Success
*/
message RebootToBootloader {
}
/**
* Request: Reboot firmware to boardloader
* @start
* @next Success
*/
message RebootToBoardloader {
}
/**
* Request: Ask device to generate a random nonce and store it in the session's cache
* @start
* @next Nonce
*/
message GetNonce {
option (experimental_message) = true;
}
/**
* Response: Contains a random nonce
* @end
*/
message Nonce {
option (experimental_message) = true;
required bytes nonce = 1; // a 32-byte random value generated by Trezor
}
/**
* Request: Reboot firmware to bootloader
* @start
* @next Success
*/
message DeviceBackToBoot {
}
/**
* Request: device information settings
* @start
* @next Success
* @next Failure
*/
message DeviceInfoSettings {
optional string serial_no = 1;
optional string cpu_info = 2;
optional string pre_firmware = 3;
}
/**
* Request: Ask for device details (no device reset)
* @start
* @next Features
*/
message GetDeviceInfo {
}
/**
* Response: Reports various information about the device
* @end
*/
message DeviceInfo {
optional string serial_no = 1;
optional string spiFlash_info = 2;
optional string SE_info = 3;
optional bytes NFT_voucher = 4;
optional string cpu_info = 5;
optional string pre_firmware = 6;
}
/**
* Request: Read SE private key
* @end
*/
message WriteSEPrivateKey {
required bytes private_key = 1;
}
/**
* Request: Read SE public key
* @end
*/
message ReadSEPublicKey {
}
/**
* Response: SE public key
* @end
*/
message SEPublicKey {
required bytes public_key = 1;
}
/**
* Request: Write SE public certificate
* @end
*/
message WriteSEPublicCert {
required bytes public_cert = 1;
}
/**
* Request: Read SE public certificate
* @end
*/
message ReadSEPublicCert {
}
/**
* Response: SE public certificate
* @end
*/
message SEPublicCert {
required bytes public_cert = 1;
}
/**
* Request:SE sign message
* @end
*/
message SESignMessage {
required bytes message = 1; // message to be signed
}
/**
* Response: Signed message
* @end
*/
message SEMessageSignature {
required bytes signature = 1; // signature of the message
}
/**
* Request: Ask for uoload resource to device (wallpaper/nft pics, mp4)
* @next ResourceRequest
* @next ZoomRequest
* @next Failure
*/
message ResourceUpload {
required string extension = 1; // the extension of the resource
required uint32 data_length = 2; // total length of the data to be upload
required ResourceType res_type = 3;
optional bytes nft_meta_data = 4;
required uint32 zoom_data_length = 5;
optional string file_name_no_ext = 6; // name template: nft/wp - mac(unique verify) - timestamp(sort)
optional uint32 blur_data_length = 7; // total length of the blur data for wallpaper
enum ResourceType {
WallPaper = 0;
Nft = 1;
}
}
/**
* Response: Device asks for more data
* @next ResourceAck
*/
message ZoomRequest {
optional uint32 offset = 1; // offset of requested data chunk
required uint32 data_length = 2; // length of requested data chunk
}
/**
* Response: Device asks for blur data
* @next ResourceAck
*/
message BlurRequest {
optional uint32 offset = 1; // offset of requested data chunk
required uint32 data_length = 2; // length of requested data chunk
}
/**
* Response: Device asks for more data
* @next ResourceAck
*/
message ResourceRequest {
optional uint32 offset = 1; // offset of requested data chunk
required uint32 data_length = 2; // length of requested data chunk
}
/**
* Request: Send resource in binary form to the device
* @next ResourceRequest
* @next Success
* @next Failure
*/
message ResourceAck {
required bytes data_chunk = 1;
optional bytes hash = 2; // the hash of the data_chunk
}
/**
* Request: Ask for update the internal static resource on device
* @next ResourceRequest
* @next Success
* @next Failure
*/
message ResourceUpdate {
required string file_name = 1;
required uint32 data_length = 2;
required bytes initial_data_chunk = 3; // <= 16K
optional bytes hash = 4;
}
/**
* Request: the path of dir to enum
* @next FileNameList
* @next Failure
*/
message ListResDir {
required string path = 1;
}
/**
* Response: The file info list of the dir
* @end
*/
message FileInfoList {
repeated FileInfo files = 1;
message FileInfo {
required string name = 1;
required uint64 size =2;
}
}
/* Request: Ask device to unlock a subtree of the keychain.
* @start
* @next UnlockedPathRequest
* @next Failure
*/
message UnlockPath {
repeated uint32 address_n = 1; // prefix of the BIP-32 path leading to the account (m / purpose')
optional bytes mac = 2; // the MAC returned by UnlockedPathRequest
}
/**
* Request: Device awaits an operation.
* @start
* @next SignTx
* @next GetPublicKey
* @next GetAddress
*/
message UnlockedPathRequest {
optional bytes mac = 1;
}
/**
* Request: Get current passphrase state
* @start
* @next PassphraseState
*/
message GetPassphraseState {
optional string passphrase_state = 1;
optional bool _only_main_pin = 2;
optional bool allow_create_attach_pin = 3;
}
/**
* Response: Current passphrase state
* @end
*/
message PassphraseState {
optional string passphrase_state = 1;
optional bytes session_id = 2;
optional bool unlocked_attach_pin = 3;
}
/**
* Request: Unlock device
* @start
* @next UnLockDeviceResponse
*/
message UnLockDevice {
}
/**
* Response: Device unlock status
* @end
*/
message UnLockDeviceResponse {
optional bool unlocked = 1;
optional bool unlocked_attach_pin = 2;
optional bool passphrase_protection = 3;
}