@onekeyfe/hd-core 1.2.0-alpha.12 → 1.2.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/protocol-v2-bootloader-mode.test.ts +37 -0
- package/__tests__/protocol-v2.test.ts +126 -52
- package/__tests__/protocolV2FileWrite.test.ts +12 -0
- package/dist/api/FirmwareUpdateV4.d.ts +2 -0
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/helpers/protocolV2FileWrite.d.ts.map +1 -1
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceUploadWallpaper.d.ts.map +1 -1
- package/dist/api/protocol-v2/helpers.d.ts.map +1 -1
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/deviceProfile/buildDeviceFeatures.d.ts.map +1 -1
- package/dist/index.d.ts +4 -8
- package/dist/index.js +481 -145
- package/dist/inject.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +1 -2
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/protocolV2.d.ts +0 -4
- package/dist/types/api/protocolV2.d.ts.map +1 -1
- package/dist/types/device.d.ts +2 -1
- package/dist/types/device.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/FirmwareUpdateV4.ts +46 -6
- package/src/api/cardano/CardanoSignMessage.ts +1 -1
- package/src/api/cardano/CardanoSignTransaction.ts +1 -1
- package/src/api/helpers/protocolV2FileWrite.ts +10 -6
- package/src/api/index.ts +0 -1
- package/src/api/protocol-v2/DeviceUploadWallpaper.ts +9 -3
- package/src/api/protocol-v2/helpers.ts +0 -3
- package/src/data/messages/messages-protocol-v2.json +422 -16
- package/src/data/messages/messages.json +0 -8
- package/src/device/Device.ts +7 -17
- package/src/deviceProfile/buildDeviceFeatures.ts +8 -0
- package/src/inject.ts +0 -2
- package/src/types/api/index.ts +0 -2
- package/src/types/api/protocolV2.ts +0 -6
- package/src/types/device.ts +5 -1
- package/dist/api/protocol-v2/FilesystemDiskControl.d.ts +0 -13
- package/dist/api/protocol-v2/FilesystemDiskControl.d.ts.map +0 -1
- package/src/api/protocol-v2/FilesystemDiskControl.ts +0 -50
package/dist/index.js
CHANGED
|
@@ -172,7 +172,6 @@ const createCoreApi = (call) => ({
|
|
|
172
172
|
filesystemDirRemove: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'filesystemDirRemove' })),
|
|
173
173
|
filesystemPathInfoQuery: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'filesystemPathInfoQuery' })),
|
|
174
174
|
filesystemFormat: connectId => call({ connectId, method: 'filesystemFormat' }),
|
|
175
|
-
filesystemDiskControl: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'filesystemDiskControl' })),
|
|
176
175
|
deviceRecovery: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceRecovery' })),
|
|
177
176
|
deviceReset: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceReset' })),
|
|
178
177
|
deviceSettings: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceSettings' })),
|
|
@@ -9288,14 +9287,6 @@ var nested$2 = {
|
|
|
9288
9287
|
passphrase_state: {
|
|
9289
9288
|
type: "string",
|
|
9290
9289
|
id: 1
|
|
9291
|
-
},
|
|
9292
|
-
_only_main_pin: {
|
|
9293
|
-
type: "bool",
|
|
9294
|
-
id: 2
|
|
9295
|
-
},
|
|
9296
|
-
allow_create_attach_pin: {
|
|
9297
|
-
type: "bool",
|
|
9298
|
-
id: 3
|
|
9299
9290
|
}
|
|
9300
9291
|
}
|
|
9301
9292
|
},
|
|
@@ -25791,7 +25782,6 @@ var nested = {
|
|
|
25791
25782
|
MessageType_DeviceSessionGet: 60606,
|
|
25792
25783
|
MessageType_DeviceSession: 60607,
|
|
25793
25784
|
MessageType_DeviceSessionAskPin: 60608,
|
|
25794
|
-
MessageType_DeviceSessionPinResult: 60609,
|
|
25795
25785
|
MessageType_FilesystemPermissionFix: 60800,
|
|
25796
25786
|
MessageType_FilesystemPathInfo: 60801,
|
|
25797
25787
|
MessageType_FilesystemPathInfoQuery: 60802,
|
|
@@ -31485,6 +31475,33 @@ var nested = {
|
|
|
31485
31475
|
PromptTemporarily: 2
|
|
31486
31476
|
}
|
|
31487
31477
|
},
|
|
31478
|
+
Initialize: {
|
|
31479
|
+
fields: {
|
|
31480
|
+
session_id: {
|
|
31481
|
+
type: "bytes",
|
|
31482
|
+
id: 1
|
|
31483
|
+
},
|
|
31484
|
+
_skip_passphrase: {
|
|
31485
|
+
type: "bool",
|
|
31486
|
+
id: 2,
|
|
31487
|
+
options: {
|
|
31488
|
+
deprecated: true
|
|
31489
|
+
}
|
|
31490
|
+
},
|
|
31491
|
+
derive_cardano: {
|
|
31492
|
+
type: "bool",
|
|
31493
|
+
id: 3
|
|
31494
|
+
},
|
|
31495
|
+
passphrase_state: {
|
|
31496
|
+
type: "string",
|
|
31497
|
+
id: 8000
|
|
31498
|
+
},
|
|
31499
|
+
is_contains_attach: {
|
|
31500
|
+
type: "bool",
|
|
31501
|
+
id: 8001
|
|
31502
|
+
}
|
|
31503
|
+
}
|
|
31504
|
+
},
|
|
31488
31505
|
StartSession: {
|
|
31489
31506
|
fields: {
|
|
31490
31507
|
session_id: {
|
|
@@ -31508,6 +31525,14 @@ var nested = {
|
|
|
31508
31525
|
fields: {
|
|
31509
31526
|
}
|
|
31510
31527
|
},
|
|
31528
|
+
GetFeatures: {
|
|
31529
|
+
fields: {
|
|
31530
|
+
}
|
|
31531
|
+
},
|
|
31532
|
+
OnekeyGetFeatures: {
|
|
31533
|
+
fields: {
|
|
31534
|
+
}
|
|
31535
|
+
},
|
|
31511
31536
|
OneKeyDeviceType: {
|
|
31512
31537
|
values: {
|
|
31513
31538
|
CLASSIC: 0,
|
|
@@ -31529,6 +31554,388 @@ var nested = {
|
|
|
31529
31554
|
APP: 1
|
|
31530
31555
|
}
|
|
31531
31556
|
},
|
|
31557
|
+
Features: {
|
|
31558
|
+
fields: {
|
|
31559
|
+
vendor: {
|
|
31560
|
+
type: "string",
|
|
31561
|
+
id: 1
|
|
31562
|
+
},
|
|
31563
|
+
major_version: {
|
|
31564
|
+
rule: "required",
|
|
31565
|
+
type: "uint32",
|
|
31566
|
+
id: 2
|
|
31567
|
+
},
|
|
31568
|
+
minor_version: {
|
|
31569
|
+
rule: "required",
|
|
31570
|
+
type: "uint32",
|
|
31571
|
+
id: 3
|
|
31572
|
+
},
|
|
31573
|
+
patch_version: {
|
|
31574
|
+
rule: "required",
|
|
31575
|
+
type: "uint32",
|
|
31576
|
+
id: 4
|
|
31577
|
+
},
|
|
31578
|
+
bootloader_mode: {
|
|
31579
|
+
type: "bool",
|
|
31580
|
+
id: 5
|
|
31581
|
+
},
|
|
31582
|
+
device_id: {
|
|
31583
|
+
type: "string",
|
|
31584
|
+
id: 6
|
|
31585
|
+
},
|
|
31586
|
+
pin_protection: {
|
|
31587
|
+
type: "bool",
|
|
31588
|
+
id: 7
|
|
31589
|
+
},
|
|
31590
|
+
passphrase_protection: {
|
|
31591
|
+
type: "bool",
|
|
31592
|
+
id: 8
|
|
31593
|
+
},
|
|
31594
|
+
language: {
|
|
31595
|
+
type: "string",
|
|
31596
|
+
id: 9
|
|
31597
|
+
},
|
|
31598
|
+
label: {
|
|
31599
|
+
type: "string",
|
|
31600
|
+
id: 10
|
|
31601
|
+
},
|
|
31602
|
+
initialized: {
|
|
31603
|
+
type: "bool",
|
|
31604
|
+
id: 12
|
|
31605
|
+
},
|
|
31606
|
+
revision: {
|
|
31607
|
+
type: "bytes",
|
|
31608
|
+
id: 13
|
|
31609
|
+
},
|
|
31610
|
+
bootloader_hash: {
|
|
31611
|
+
type: "bytes",
|
|
31612
|
+
id: 14
|
|
31613
|
+
},
|
|
31614
|
+
imported: {
|
|
31615
|
+
type: "bool",
|
|
31616
|
+
id: 15
|
|
31617
|
+
},
|
|
31618
|
+
unlocked: {
|
|
31619
|
+
type: "bool",
|
|
31620
|
+
id: 16
|
|
31621
|
+
},
|
|
31622
|
+
_passphrase_cached: {
|
|
31623
|
+
type: "bool",
|
|
31624
|
+
id: 17,
|
|
31625
|
+
options: {
|
|
31626
|
+
deprecated: true
|
|
31627
|
+
}
|
|
31628
|
+
},
|
|
31629
|
+
firmware_present: {
|
|
31630
|
+
type: "bool",
|
|
31631
|
+
id: 18
|
|
31632
|
+
},
|
|
31633
|
+
needs_backup: {
|
|
31634
|
+
type: "bool",
|
|
31635
|
+
id: 19
|
|
31636
|
+
},
|
|
31637
|
+
flags: {
|
|
31638
|
+
type: "uint32",
|
|
31639
|
+
id: 20
|
|
31640
|
+
},
|
|
31641
|
+
model: {
|
|
31642
|
+
type: "string",
|
|
31643
|
+
id: 21
|
|
31644
|
+
},
|
|
31645
|
+
fw_major: {
|
|
31646
|
+
type: "uint32",
|
|
31647
|
+
id: 22
|
|
31648
|
+
},
|
|
31649
|
+
fw_minor: {
|
|
31650
|
+
type: "uint32",
|
|
31651
|
+
id: 23
|
|
31652
|
+
},
|
|
31653
|
+
fw_patch: {
|
|
31654
|
+
type: "uint32",
|
|
31655
|
+
id: 24
|
|
31656
|
+
},
|
|
31657
|
+
fw_vendor: {
|
|
31658
|
+
type: "string",
|
|
31659
|
+
id: 25
|
|
31660
|
+
},
|
|
31661
|
+
unfinished_backup: {
|
|
31662
|
+
type: "bool",
|
|
31663
|
+
id: 27
|
|
31664
|
+
},
|
|
31665
|
+
no_backup: {
|
|
31666
|
+
type: "bool",
|
|
31667
|
+
id: 28
|
|
31668
|
+
},
|
|
31669
|
+
recovery_mode: {
|
|
31670
|
+
type: "bool",
|
|
31671
|
+
id: 29
|
|
31672
|
+
},
|
|
31673
|
+
capabilities: {
|
|
31674
|
+
rule: "repeated",
|
|
31675
|
+
type: "Capability",
|
|
31676
|
+
id: 30,
|
|
31677
|
+
options: {
|
|
31678
|
+
packed: false
|
|
31679
|
+
}
|
|
31680
|
+
},
|
|
31681
|
+
backup_type: {
|
|
31682
|
+
type: "BackupType",
|
|
31683
|
+
id: 31
|
|
31684
|
+
},
|
|
31685
|
+
sd_card_present: {
|
|
31686
|
+
type: "bool",
|
|
31687
|
+
id: 32
|
|
31688
|
+
},
|
|
31689
|
+
sd_protection: {
|
|
31690
|
+
type: "bool",
|
|
31691
|
+
id: 33
|
|
31692
|
+
},
|
|
31693
|
+
wipe_code_protection: {
|
|
31694
|
+
type: "bool",
|
|
31695
|
+
id: 34
|
|
31696
|
+
},
|
|
31697
|
+
session_id: {
|
|
31698
|
+
type: "bytes",
|
|
31699
|
+
id: 35
|
|
31700
|
+
},
|
|
31701
|
+
passphrase_always_on_device: {
|
|
31702
|
+
type: "bool",
|
|
31703
|
+
id: 36
|
|
31704
|
+
},
|
|
31705
|
+
safety_checks: {
|
|
31706
|
+
type: "SafetyCheckLevel",
|
|
31707
|
+
id: 37
|
|
31708
|
+
},
|
|
31709
|
+
auto_lock_delay_ms: {
|
|
31710
|
+
type: "uint32",
|
|
31711
|
+
id: 38
|
|
31712
|
+
},
|
|
31713
|
+
display_rotation: {
|
|
31714
|
+
type: "uint32",
|
|
31715
|
+
id: 39
|
|
31716
|
+
},
|
|
31717
|
+
experimental_features: {
|
|
31718
|
+
type: "bool",
|
|
31719
|
+
id: 40
|
|
31720
|
+
},
|
|
31721
|
+
offset: {
|
|
31722
|
+
type: "uint32",
|
|
31723
|
+
id: 500
|
|
31724
|
+
},
|
|
31725
|
+
coprocessor_bt_name: {
|
|
31726
|
+
type: "string",
|
|
31727
|
+
id: 501
|
|
31728
|
+
},
|
|
31729
|
+
coprocessor_version: {
|
|
31730
|
+
type: "string",
|
|
31731
|
+
id: 502
|
|
31732
|
+
},
|
|
31733
|
+
coprocessor_bt_enable: {
|
|
31734
|
+
type: "bool",
|
|
31735
|
+
id: 503
|
|
31736
|
+
},
|
|
31737
|
+
se_enable: {
|
|
31738
|
+
type: "bool",
|
|
31739
|
+
id: 504
|
|
31740
|
+
},
|
|
31741
|
+
se_ver: {
|
|
31742
|
+
type: "string",
|
|
31743
|
+
id: 506
|
|
31744
|
+
},
|
|
31745
|
+
backup_only: {
|
|
31746
|
+
type: "bool",
|
|
31747
|
+
id: 507
|
|
31748
|
+
},
|
|
31749
|
+
onekey_version: {
|
|
31750
|
+
type: "string",
|
|
31751
|
+
id: 508
|
|
31752
|
+
},
|
|
31753
|
+
onekey_serial: {
|
|
31754
|
+
type: "string",
|
|
31755
|
+
id: 509
|
|
31756
|
+
},
|
|
31757
|
+
bootloader_version: {
|
|
31758
|
+
type: "string",
|
|
31759
|
+
id: 510
|
|
31760
|
+
},
|
|
31761
|
+
serial_no: {
|
|
31762
|
+
type: "string",
|
|
31763
|
+
id: 511
|
|
31764
|
+
},
|
|
31765
|
+
spi_flash: {
|
|
31766
|
+
type: "string",
|
|
31767
|
+
id: 512
|
|
31768
|
+
},
|
|
31769
|
+
initstates: {
|
|
31770
|
+
type: "uint32",
|
|
31771
|
+
id: 513
|
|
31772
|
+
},
|
|
31773
|
+
NFT_voucher: {
|
|
31774
|
+
type: "bytes",
|
|
31775
|
+
id: 514
|
|
31776
|
+
},
|
|
31777
|
+
cpu_info: {
|
|
31778
|
+
type: "string",
|
|
31779
|
+
id: 515
|
|
31780
|
+
},
|
|
31781
|
+
pre_firmware: {
|
|
31782
|
+
type: "string",
|
|
31783
|
+
id: 516
|
|
31784
|
+
},
|
|
31785
|
+
coin_switch: {
|
|
31786
|
+
type: "uint32",
|
|
31787
|
+
id: 517
|
|
31788
|
+
},
|
|
31789
|
+
build_id: {
|
|
31790
|
+
type: "bytes",
|
|
31791
|
+
id: 518
|
|
31792
|
+
},
|
|
31793
|
+
romloader_version: {
|
|
31794
|
+
type: "string",
|
|
31795
|
+
id: 519
|
|
31796
|
+
},
|
|
31797
|
+
busy: {
|
|
31798
|
+
type: "bool",
|
|
31799
|
+
id: 41
|
|
31800
|
+
},
|
|
31801
|
+
onekey_device_type: {
|
|
31802
|
+
type: "OneKeyDeviceType",
|
|
31803
|
+
id: 600
|
|
31804
|
+
},
|
|
31805
|
+
onekey_se_type: {
|
|
31806
|
+
type: "OneKeySeType",
|
|
31807
|
+
id: 601
|
|
31808
|
+
},
|
|
31809
|
+
onekey_romloader_version: {
|
|
31810
|
+
type: "string",
|
|
31811
|
+
id: 602
|
|
31812
|
+
},
|
|
31813
|
+
onekey_romloader_hash: {
|
|
31814
|
+
type: "bytes",
|
|
31815
|
+
id: 603
|
|
31816
|
+
},
|
|
31817
|
+
onekey_bootloader_version: {
|
|
31818
|
+
type: "string",
|
|
31819
|
+
id: 604
|
|
31820
|
+
},
|
|
31821
|
+
onekey_bootloader_hash: {
|
|
31822
|
+
type: "bytes",
|
|
31823
|
+
id: 605
|
|
31824
|
+
},
|
|
31825
|
+
onekey_se01_version: {
|
|
31826
|
+
type: "string",
|
|
31827
|
+
id: 606
|
|
31828
|
+
},
|
|
31829
|
+
onekey_se01_hash: {
|
|
31830
|
+
type: "bytes",
|
|
31831
|
+
id: 607
|
|
31832
|
+
},
|
|
31833
|
+
onekey_se01_build_id: {
|
|
31834
|
+
type: "string",
|
|
31835
|
+
id: 608
|
|
31836
|
+
},
|
|
31837
|
+
onekey_firmware_version: {
|
|
31838
|
+
type: "string",
|
|
31839
|
+
id: 609
|
|
31840
|
+
},
|
|
31841
|
+
onekey_firmware_hash: {
|
|
31842
|
+
type: "bytes",
|
|
31843
|
+
id: 610
|
|
31844
|
+
},
|
|
31845
|
+
onekey_firmware_build_id: {
|
|
31846
|
+
type: "string",
|
|
31847
|
+
id: 611
|
|
31848
|
+
},
|
|
31849
|
+
onekey_serial_no: {
|
|
31850
|
+
type: "string",
|
|
31851
|
+
id: 612
|
|
31852
|
+
},
|
|
31853
|
+
onekey_bootloader_build_id: {
|
|
31854
|
+
type: "string",
|
|
31855
|
+
id: 613
|
|
31856
|
+
},
|
|
31857
|
+
onekey_coprocessor_bt_name: {
|
|
31858
|
+
type: "string",
|
|
31859
|
+
id: 614
|
|
31860
|
+
},
|
|
31861
|
+
onekey_coprocessor_version: {
|
|
31862
|
+
type: "string",
|
|
31863
|
+
id: 615
|
|
31864
|
+
},
|
|
31865
|
+
onekey_coprocessor_build_id: {
|
|
31866
|
+
type: "string",
|
|
31867
|
+
id: 616
|
|
31868
|
+
},
|
|
31869
|
+
onekey_coprocessor_hash: {
|
|
31870
|
+
type: "bytes",
|
|
31871
|
+
id: 617
|
|
31872
|
+
},
|
|
31873
|
+
onekey_se02_version: {
|
|
31874
|
+
type: "string",
|
|
31875
|
+
id: 618
|
|
31876
|
+
},
|
|
31877
|
+
onekey_se03_version: {
|
|
31878
|
+
type: "string",
|
|
31879
|
+
id: 619
|
|
31880
|
+
},
|
|
31881
|
+
onekey_se04_version: {
|
|
31882
|
+
type: "string",
|
|
31883
|
+
id: 620
|
|
31884
|
+
},
|
|
31885
|
+
onekey_se01_state: {
|
|
31886
|
+
type: "OneKeySEState",
|
|
31887
|
+
id: 621
|
|
31888
|
+
},
|
|
31889
|
+
onekey_se02_state: {
|
|
31890
|
+
type: "OneKeySEState",
|
|
31891
|
+
id: 622
|
|
31892
|
+
},
|
|
31893
|
+
onekey_se03_state: {
|
|
31894
|
+
type: "OneKeySEState",
|
|
31895
|
+
id: 623
|
|
31896
|
+
},
|
|
31897
|
+
onekey_se04_state: {
|
|
31898
|
+
type: "OneKeySEState",
|
|
31899
|
+
id: 624
|
|
31900
|
+
},
|
|
31901
|
+
attach_to_pin_user: {
|
|
31902
|
+
type: "bool",
|
|
31903
|
+
id: 625
|
|
31904
|
+
},
|
|
31905
|
+
unlocked_attach_pin: {
|
|
31906
|
+
type: "bool",
|
|
31907
|
+
id: 626
|
|
31908
|
+
}
|
|
31909
|
+
},
|
|
31910
|
+
nested: {
|
|
31911
|
+
Capability: {
|
|
31912
|
+
options: {
|
|
31913
|
+
"(has_bitcoin_only_values)": true
|
|
31914
|
+
},
|
|
31915
|
+
values: {
|
|
31916
|
+
Capability_Bitcoin: 1,
|
|
31917
|
+
Capability_Bitcoin_like: 2,
|
|
31918
|
+
Capability_Binance: 3,
|
|
31919
|
+
Capability_Cardano: 4,
|
|
31920
|
+
Capability_Crypto: 5,
|
|
31921
|
+
Capability_EOS: 6,
|
|
31922
|
+
Capability_Ethereum: 7,
|
|
31923
|
+
Capability_Lisk: 8,
|
|
31924
|
+
Capability_Monero: 9,
|
|
31925
|
+
Capability_NEM: 10,
|
|
31926
|
+
Capability_Ripple: 11,
|
|
31927
|
+
Capability_Stellar: 12,
|
|
31928
|
+
Capability_Tezos: 13,
|
|
31929
|
+
Capability_U2F: 14,
|
|
31930
|
+
Capability_Shamir: 15,
|
|
31931
|
+
Capability_ShamirGroups: 16,
|
|
31932
|
+
Capability_PassphraseEntry: 17,
|
|
31933
|
+
Capability_AttachToPin: 18,
|
|
31934
|
+
Capability_EthereumTypedData: 1000
|
|
31935
|
+
}
|
|
31936
|
+
}
|
|
31937
|
+
}
|
|
31938
|
+
},
|
|
31532
31939
|
OnekeyFeatures: {
|
|
31533
31940
|
fields: {
|
|
31534
31941
|
onekey_device_type: {
|
|
@@ -36518,7 +36925,10 @@ var nested = {
|
|
|
36518
36925
|
ViewSignLayout: {
|
|
36519
36926
|
values: {
|
|
36520
36927
|
LayoutDefault: 0,
|
|
36521
|
-
LayoutSafeTxCreate: 1
|
|
36928
|
+
LayoutSafeTxCreate: 1,
|
|
36929
|
+
LayoutFinalConfirm: 2,
|
|
36930
|
+
Layout7702: 3,
|
|
36931
|
+
LayoutFlat: 4
|
|
36522
36932
|
}
|
|
36523
36933
|
},
|
|
36524
36934
|
ViewSignPage: {
|
|
@@ -37379,20 +37789,9 @@ var nested = {
|
|
|
37379
37789
|
fields: {
|
|
37380
37790
|
}
|
|
37381
37791
|
},
|
|
37382
|
-
|
|
37383
|
-
|
|
37384
|
-
|
|
37385
|
-
type: "bool",
|
|
37386
|
-
id: 1
|
|
37387
|
-
},
|
|
37388
|
-
unlocked_attach_pin: {
|
|
37389
|
-
type: "bool",
|
|
37390
|
-
id: 2
|
|
37391
|
-
},
|
|
37392
|
-
passphrase_protection: {
|
|
37393
|
-
type: "bool",
|
|
37394
|
-
id: 3
|
|
37395
|
-
}
|
|
37792
|
+
DeviceSessionAskPin_FailureSubCodes: {
|
|
37793
|
+
values: {
|
|
37794
|
+
UserCancel: 1
|
|
37396
37795
|
}
|
|
37397
37796
|
},
|
|
37398
37797
|
DeviceStatus: {
|
|
@@ -41391,53 +41790,10 @@ const buildProtocolV1FeaturesPayload = (protocolV1Features, previous) => {
|
|
|
41391
41790
|
const bleName = features.onekey_ble_name || features.ble_name || null;
|
|
41392
41791
|
const deviceType = getProtocolV1DeviceType(features);
|
|
41393
41792
|
const sessionId = (_b = (_a = features.session_id) !== null && _a !== void 0 ? _a : previous === null || previous === void 0 ? void 0 : previous.sessionId) !== null && _b !== void 0 ? _b : null;
|
|
41394
|
-
return {
|
|
41395
|
-
protocol: 'V1',
|
|
41396
|
-
protocolVersion: (_d = (_c = features.protocol_version) !== null && _c !== void 0 ? _c : previous === null || previous === void 0 ? void 0 : previous.protocolVersion) !== null && _d !== void 0 ? _d : 1,
|
|
41397
|
-
deviceType,
|
|
41398
|
-
firmwareType: getProtocolV1FirmwareType(features),
|
|
41399
|
-
model: (_e = features.model) !== null && _e !== void 0 ? _e : null,
|
|
41400
|
-
vendor: (_f = features.vendor) !== null && _f !== void 0 ? _f : null,
|
|
41401
|
-
deviceId: (_g = features.device_id) !== null && _g !== void 0 ? _g : null,
|
|
41402
|
-
serialNo,
|
|
41403
|
-
label: getProtocolV1Label(features, deviceType, bleName),
|
|
41404
|
-
bleName,
|
|
41405
|
-
capabilities: (_h = features.capabilities) !== null && _h !== void 0 ? _h : [],
|
|
41406
|
-
mode: getProtocolV1Mode(features),
|
|
41407
|
-
initialized: (_j = features.initialized) !== null && _j !== void 0 ? _j : null,
|
|
41408
|
-
bootloaderMode: (_k = features.bootloader_mode) !== null && _k !== void 0 ? _k : null,
|
|
41409
|
-
unlocked: (_l = features.unlocked) !== null && _l !== void 0 ? _l : true,
|
|
41410
|
-
firmwarePresent: (_m = features.firmware_present) !== null && _m !== void 0 ? _m : null,
|
|
41411
|
-
passphraseProtection: (_o = features.passphrase_protection) !== null && _o !== void 0 ? _o : null,
|
|
41412
|
-
pinProtection: (_p = features.pin_protection) !== null && _p !== void 0 ? _p : null,
|
|
41413
|
-
backupRequired: (_q = features.needs_backup) !== null && _q !== void 0 ? _q : null,
|
|
41414
|
-
noBackup: (_r = features.no_backup) !== null && _r !== void 0 ? _r : null,
|
|
41415
|
-
unfinishedBackup: (_s = features.unfinished_backup) !== null && _s !== void 0 ? _s : null,
|
|
41416
|
-
recoveryMode: (_t = features.recovery_mode) !== null && _t !== void 0 ? _t : null,
|
|
41417
|
-
language: (_u = features.language) !== null && _u !== void 0 ? _u : null,
|
|
41418
|
-
bleEnabled: (_v = features.ble_enable) !== null && _v !== void 0 ? _v : null,
|
|
41419
|
-
sdCardPresent: (_w = features.sd_card_present) !== null && _w !== void 0 ? _w : null,
|
|
41420
|
-
sdProtection: (_x = features.sd_protection) !== null && _x !== void 0 ? _x : null,
|
|
41421
|
-
wipeCodeProtection: (_y = features.wipe_code_protection) !== null && _y !== void 0 ? _y : null,
|
|
41422
|
-
passphraseAlwaysOnDevice: (_z = features.passphrase_always_on_device) !== null && _z !== void 0 ? _z : null,
|
|
41423
|
-
safetyChecks: (_0 = features.safety_checks) !== null && _0 !== void 0 ? _0 : null,
|
|
41424
|
-
autoLockDelayMs: (_1 = features.auto_lock_delay_ms) !== null && _1 !== void 0 ? _1 : null,
|
|
41425
|
-
displayRotation: (_2 = features.display_rotation) !== null && _2 !== void 0 ? _2 : null,
|
|
41426
|
-
experimentalFeatures: (_3 = features.experimental_features) !== null && _3 !== void 0 ? _3 : null,
|
|
41427
|
-
firmwareVersion,
|
|
41793
|
+
return Object.assign(Object.assign({}, features), { protocol: 'V1', protocolVersion: (_d = (_c = features.protocol_version) !== null && _c !== void 0 ? _c : previous === null || previous === void 0 ? void 0 : previous.protocolVersion) !== null && _d !== void 0 ? _d : 1, deviceType, firmwareType: getProtocolV1FirmwareType(features), model: (_e = features.model) !== null && _e !== void 0 ? _e : null, vendor: (_f = features.vendor) !== null && _f !== void 0 ? _f : null, deviceId: (_g = features.device_id) !== null && _g !== void 0 ? _g : null, serialNo, label: getProtocolV1Label(features, deviceType, bleName), bleName, capabilities: (_h = features.capabilities) !== null && _h !== void 0 ? _h : [], mode: getProtocolV1Mode(features), initialized: (_j = features.initialized) !== null && _j !== void 0 ? _j : null, bootloaderMode: (_k = features.bootloader_mode) !== null && _k !== void 0 ? _k : null, unlocked: (_l = features.unlocked) !== null && _l !== void 0 ? _l : true, firmwarePresent: (_m = features.firmware_present) !== null && _m !== void 0 ? _m : null, passphraseProtection: (_o = features.passphrase_protection) !== null && _o !== void 0 ? _o : null, pinProtection: (_p = features.pin_protection) !== null && _p !== void 0 ? _p : null, backupRequired: (_q = features.needs_backup) !== null && _q !== void 0 ? _q : null, noBackup: (_r = features.no_backup) !== null && _r !== void 0 ? _r : null, unfinishedBackup: (_s = features.unfinished_backup) !== null && _s !== void 0 ? _s : null, recoveryMode: (_t = features.recovery_mode) !== null && _t !== void 0 ? _t : null, language: (_u = features.language) !== null && _u !== void 0 ? _u : null, bleEnabled: (_v = features.ble_enable) !== null && _v !== void 0 ? _v : null, sdCardPresent: (_w = features.sd_card_present) !== null && _w !== void 0 ? _w : null, sdProtection: (_x = features.sd_protection) !== null && _x !== void 0 ? _x : null, wipeCodeProtection: (_y = features.wipe_code_protection) !== null && _y !== void 0 ? _y : null, passphraseAlwaysOnDevice: (_z = features.passphrase_always_on_device) !== null && _z !== void 0 ? _z : null, safetyChecks: (_0 = features.safety_checks) !== null && _0 !== void 0 ? _0 : null, autoLockDelayMs: (_1 = features.auto_lock_delay_ms) !== null && _1 !== void 0 ? _1 : null, displayRotation: (_2 = features.display_rotation) !== null && _2 !== void 0 ? _2 : null, experimentalFeatures: (_3 = features.experimental_features) !== null && _3 !== void 0 ? _3 : null, firmwareVersion,
|
|
41428
41794
|
bootloaderVersion,
|
|
41429
41795
|
boardVersion,
|
|
41430
|
-
bleVersion,
|
|
41431
|
-
se01Version: firstMeaningfulVersion(features.onekey_se01_version),
|
|
41432
|
-
se02Version: firstMeaningfulVersion(features.onekey_se02_version),
|
|
41433
|
-
se03Version: firstMeaningfulVersion(features.onekey_se03_version),
|
|
41434
|
-
se04Version: firstMeaningfulVersion(features.onekey_se04_version),
|
|
41435
|
-
se01BootVersion: firstMeaningfulVersion(features.onekey_se01_boot_version),
|
|
41436
|
-
se02BootVersion: firstMeaningfulVersion(features.onekey_se02_boot_version),
|
|
41437
|
-
se03BootVersion: firstMeaningfulVersion(features.onekey_se03_boot_version),
|
|
41438
|
-
se04BootVersion: firstMeaningfulVersion(features.onekey_se04_boot_version),
|
|
41439
|
-
seVersion: (_4 = features.se_ver) !== null && _4 !== void 0 ? _4 : null,
|
|
41440
|
-
verify: {
|
|
41796
|
+
bleVersion, se01Version: firstMeaningfulVersion(features.onekey_se01_version), se02Version: firstMeaningfulVersion(features.onekey_se02_version), se03Version: firstMeaningfulVersion(features.onekey_se03_version), se04Version: firstMeaningfulVersion(features.onekey_se04_version), se01BootVersion: firstMeaningfulVersion(features.onekey_se01_boot_version), se02BootVersion: firstMeaningfulVersion(features.onekey_se02_boot_version), se03BootVersion: firstMeaningfulVersion(features.onekey_se03_boot_version), se04BootVersion: firstMeaningfulVersion(features.onekey_se04_boot_version), seVersion: (_4 = features.se_ver) !== null && _4 !== void 0 ? _4 : null, verify: {
|
|
41441
41797
|
firmwareBuildId: features.onekey_firmware_build_id,
|
|
41442
41798
|
firmwareHash: features.onekey_firmware_hash,
|
|
41443
41799
|
bootloaderBuildId: features.onekey_boot_build_id,
|
|
@@ -41462,15 +41818,12 @@ const buildProtocolV1FeaturesPayload = (protocolV1Features, previous) => {
|
|
|
41462
41818
|
se03BootHash: features.onekey_se03_boot_hash,
|
|
41463
41819
|
se04BootBuildId: features.onekey_se04_boot_build_id,
|
|
41464
41820
|
se04BootHash: features.onekey_se04_boot_hash,
|
|
41465
|
-
},
|
|
41466
|
-
sessionId,
|
|
41467
|
-
raw: {
|
|
41821
|
+
}, sessionId, session_id: sessionId !== null && sessionId !== void 0 ? sessionId : undefined, raw: {
|
|
41468
41822
|
protocolV1Features,
|
|
41469
|
-
}
|
|
41470
|
-
};
|
|
41823
|
+
} });
|
|
41471
41824
|
};
|
|
41472
41825
|
const buildProtocolV2FeaturesPayload = (deviceInfo, previous) => {
|
|
41473
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _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;
|
|
41826
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _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;
|
|
41474
41827
|
const info = deviceInfo;
|
|
41475
41828
|
const fwApplication = (_a = info === null || info === void 0 ? void 0 : info.fw) === null || _a === void 0 ? void 0 : _a.application;
|
|
41476
41829
|
const fwBootloader = (_b = info === null || info === void 0 ? void 0 : info.fw) === null || _b === void 0 ? void 0 : _b.bootloader;
|
|
@@ -41582,6 +41935,12 @@ const buildProtocolV2FeaturesPayload = (deviceInfo, previous) => {
|
|
|
41582
41935
|
se04BootHash: (_67 = getImageHash((_66 = info === null || info === void 0 ? void 0 : info.se4) === null || _66 === void 0 ? void 0 : _66.bootloader)) !== null && _67 !== void 0 ? _67 : (_68 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _68 === void 0 ? void 0 : _68.se04BootHash,
|
|
41583
41936
|
},
|
|
41584
41937
|
sessionId: (_69 = previous === null || previous === void 0 ? void 0 : previous.sessionId) !== null && _69 !== void 0 ? _69 : null,
|
|
41938
|
+
device_id: deviceId !== null && deviceId !== void 0 ? deviceId : undefined,
|
|
41939
|
+
session_id: (_70 = previous === null || previous === void 0 ? void 0 : previous.sessionId) !== null && _70 !== void 0 ? _70 : undefined,
|
|
41940
|
+
ble_name: bleName !== null && bleName !== void 0 ? bleName : undefined,
|
|
41941
|
+
onekey_device_type: 'PRO2',
|
|
41942
|
+
passphrase_protection: passphraseProtection !== null && passphraseProtection !== void 0 ? passphraseProtection : undefined,
|
|
41943
|
+
bootloader_mode: bootloaderMode,
|
|
41585
41944
|
passphraseState: previous === null || previous === void 0 ? void 0 : previous.passphraseState,
|
|
41586
41945
|
unlockedAttachPin,
|
|
41587
41946
|
raw: {
|
|
@@ -42310,7 +42669,7 @@ class Device extends events.exports {
|
|
|
42310
42669
|
}
|
|
42311
42670
|
hasUnexpectedMode(allow, require) {
|
|
42312
42671
|
if (!this.isUnacquired()) {
|
|
42313
|
-
if (this.isBootloader() && !allow.includes(UI_REQUEST.BOOTLOADER)) {
|
|
42672
|
+
if (this.isBootloader() && !this.isProtocolV2() && !allow.includes(UI_REQUEST.BOOTLOADER)) {
|
|
42314
42673
|
return UI_REQUEST.BOOTLOADER;
|
|
42315
42674
|
}
|
|
42316
42675
|
if (!this.isInitialized() && !allow.includes(UI_REQUEST.NOT_INITIALIZE)) {
|
|
@@ -42356,9 +42715,8 @@ class Device extends events.exports {
|
|
|
42356
42715
|
var _a, _b, _c;
|
|
42357
42716
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42358
42717
|
if (this.isProtocolV2()) {
|
|
42359
|
-
let pinResult;
|
|
42360
42718
|
try {
|
|
42361
|
-
|
|
42719
|
+
yield this.commands.typedCall('DeviceSessionAskPin', 'Success');
|
|
42362
42720
|
}
|
|
42363
42721
|
catch (error) {
|
|
42364
42722
|
const errorText = error instanceof Error
|
|
@@ -42369,16 +42727,7 @@ class Device extends events.exports {
|
|
|
42369
42727
|
}
|
|
42370
42728
|
throw error;
|
|
42371
42729
|
}
|
|
42372
|
-
const status = {};
|
|
42373
|
-
if (pinResult.unlocked != null) {
|
|
42374
|
-
status.unlocked = pinResult.unlocked;
|
|
42375
|
-
}
|
|
42376
|
-
if (pinResult.unlocked_attach_pin != null) {
|
|
42377
|
-
status.unlocked_by_attach_to_pin = pinResult.unlocked_attach_pin;
|
|
42378
|
-
}
|
|
42379
|
-
if (pinResult.passphrase_protection != null) {
|
|
42380
|
-
status.passphrase_enabled = pinResult.passphrase_protection;
|
|
42381
|
-
}
|
|
42730
|
+
const { message: status } = yield this.commands.typedCall('DeviceStatusGet', 'DeviceStatus', {});
|
|
42382
42731
|
return this.updateProtocolV2Status(status);
|
|
42383
42732
|
}
|
|
42384
42733
|
const firmwareVersion = (_c = this.getCurrentFirmwareVersionString()) !== null && _c !== void 0 ? _c : '0.0.0';
|
|
@@ -45988,9 +46337,6 @@ const isProtocolV2DeviceDisconnectedError = (error) => {
|
|
|
45988
46337
|
message.includes('connection has timed out unexpectedly') ||
|
|
45989
46338
|
message.includes('connection error has occured') ||
|
|
45990
46339
|
message.includes('connection error has occurred') ||
|
|
45991
|
-
message.includes('transferIn') ||
|
|
45992
|
-
message.includes('transferin') ||
|
|
45993
|
-
message.includes('usbdevice') ||
|
|
45994
46340
|
message.includes('multiplatformbleadapter') ||
|
|
45995
46341
|
message.includes('multipalformebleadapter') ||
|
|
45996
46342
|
compactMessage.includes('rxerrorerror6') ||
|
|
@@ -46286,6 +46632,16 @@ const parseProtocolV2OkppHeader = (bytes) => {
|
|
|
46286
46632
|
headerHash: bytesToHex(bytes.slice(PROTOCOL_V2_OKPP_HEADER_HASH_OFFSET, PROTOCOL_V2_OKPP_HEADER_HASH_OFFSET + PROTOCOL_V2_OKPP_HASH_SIZE)),
|
|
46287
46633
|
};
|
|
46288
46634
|
};
|
|
46635
|
+
const assertProtocolV2ReconnectIdentity = (expectedDeviceId, actualDeviceId) => {
|
|
46636
|
+
if (!expectedDeviceId)
|
|
46637
|
+
return;
|
|
46638
|
+
if (!actualDeviceId) {
|
|
46639
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound, 'Protocol V2 reconnect identity unavailable');
|
|
46640
|
+
}
|
|
46641
|
+
if (actualDeviceId !== expectedDeviceId) {
|
|
46642
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound, `Protocol V2 reconnect identity mismatch: expected ${expectedDeviceId}, received ${actualDeviceId}`);
|
|
46643
|
+
}
|
|
46644
|
+
};
|
|
46289
46645
|
class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
46290
46646
|
init() {
|
|
46291
46647
|
this.allowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -46362,11 +46718,12 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46362
46718
|
});
|
|
46363
46719
|
}
|
|
46364
46720
|
runProtocolV2() {
|
|
46365
|
-
var _a, _b;
|
|
46721
|
+
var _a, _b, _c;
|
|
46366
46722
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46367
46723
|
const deviceFeatures = yield this.getProtocolV2DeviceFeatures();
|
|
46724
|
+
this.protocolV2ExpectedDeviceId = (_a = deviceFeatures.deviceId) !== null && _a !== void 0 ? _a : undefined;
|
|
46368
46725
|
const deviceFirmwareType = getFirmwareType(deviceFeatures);
|
|
46369
|
-
const firmwareType = (
|
|
46726
|
+
const firmwareType = (_b = this.params.firmwareType) !== null && _b !== void 0 ? _b : deviceFirmwareType;
|
|
46370
46727
|
let fwBinaryMap = [];
|
|
46371
46728
|
let bootloaderBinary = null;
|
|
46372
46729
|
let installItems;
|
|
@@ -46383,7 +46740,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46383
46740
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.FinishDownloadFirmware);
|
|
46384
46741
|
}
|
|
46385
46742
|
catch (err) {
|
|
46386
|
-
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, (
|
|
46743
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, (_c = err.message) !== null && _c !== void 0 ? _c : err);
|
|
46387
46744
|
}
|
|
46388
46745
|
const resourceBundles = this.prepareProtocolV2ResourceBundles(firmwareType, deviceFeatures);
|
|
46389
46746
|
if (!bootloaderBinary && fwBinaryMap.length === 0 && !(resourceBundles === null || resourceBundles === void 0 ? void 0 : resourceBundles.length)) {
|
|
@@ -46712,6 +47069,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46712
47069
|
});
|
|
46713
47070
|
}
|
|
46714
47071
|
waitForProtocolV2BootloaderMode(timeout = PROTOCOL_V2_BOOTLOADER_RECONNECT_TIMEOUT, retryInterval = 1000) {
|
|
47072
|
+
var _a;
|
|
46715
47073
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46716
47074
|
const startTime = Date.now();
|
|
46717
47075
|
let lastError;
|
|
@@ -46723,6 +47081,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46723
47081
|
timeoutMs: PROTOCOL_V2_SHORT_RESPONSE_TIMEOUT,
|
|
46724
47082
|
});
|
|
46725
47083
|
const features = this.device.updateProtocolV2Features(deviceInfo);
|
|
47084
|
+
assertProtocolV2ReconnectIdentity(this.protocolV2ExpectedDeviceId, (_a = features.deviceId) !== null && _a !== void 0 ? _a : undefined);
|
|
46726
47085
|
if (features === null || features === void 0 ? void 0 : features.bootloaderMode) {
|
|
46727
47086
|
return features;
|
|
46728
47087
|
}
|
|
@@ -46858,6 +47217,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46858
47217
|
return !!features && !features.bootloaderMode && features.mode !== 'bootloader';
|
|
46859
47218
|
}
|
|
46860
47219
|
probeProtocolV2NormalMode() {
|
|
47220
|
+
var _a;
|
|
46861
47221
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46862
47222
|
const deviceInfo = yield requestProtocolV2DeviceInfo({
|
|
46863
47223
|
commands: this.device.getCommands(),
|
|
@@ -46865,6 +47225,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46865
47225
|
request: PROTOCOL_V2_VERSIONS_DEVICE_INFO_REQUEST,
|
|
46866
47226
|
});
|
|
46867
47227
|
const features = this.device.updateProtocolV2Features(deviceInfo);
|
|
47228
|
+
assertProtocolV2ReconnectIdentity(this.protocolV2ExpectedDeviceId, (_a = features.deviceId) !== null && _a !== void 0 ? _a : undefined);
|
|
46868
47229
|
if (this.isProtocolV2NormalModeFeatures(features)) {
|
|
46869
47230
|
Log$5.log('Protocol V2 firmware install finished; device is back in normal mode');
|
|
46870
47231
|
return true;
|
|
@@ -46984,6 +47345,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46984
47345
|
});
|
|
46985
47346
|
}
|
|
46986
47347
|
waitForProtocolV2ReconnectAndFeatures(timeout) {
|
|
47348
|
+
var _a;
|
|
46987
47349
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46988
47350
|
const startTime = Date.now();
|
|
46989
47351
|
let lastError;
|
|
@@ -46996,6 +47358,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46996
47358
|
request: PROTOCOL_V2_VERSIONS_DEVICE_INFO_REQUEST,
|
|
46997
47359
|
});
|
|
46998
47360
|
const features = this.device.updateProtocolV2Features(deviceInfo);
|
|
47361
|
+
assertProtocolV2ReconnectIdentity(this.protocolV2ExpectedDeviceId, (_a = features.deviceId) !== null && _a !== void 0 ? _a : undefined);
|
|
46999
47362
|
if (features.bootloaderMode || features.mode === 'bootloader') {
|
|
47000
47363
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound, 'Protocol V2 device is still in bootloader mode');
|
|
47001
47364
|
}
|
|
@@ -47026,6 +47389,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
47026
47389
|
this.device.commands.disposed = false;
|
|
47027
47390
|
this.device.getCommands().mainId = (_c = this.device.mainId) !== null && _c !== void 0 ? _c : '';
|
|
47028
47391
|
yield this.device.initialize();
|
|
47392
|
+
assertProtocolV2ReconnectIdentity(this.protocolV2ExpectedDeviceId, this.device.getCurrentDeviceId());
|
|
47029
47393
|
return;
|
|
47030
47394
|
}
|
|
47031
47395
|
const { deviceList } = yield DevicePool.getDevices(devicesDescriptor, undefined, {
|
|
@@ -47040,6 +47404,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
47040
47404
|
this.device.commands.disposed = false;
|
|
47041
47405
|
this.device.getCommands().mainId = (_d = this.device.mainId) !== null && _d !== void 0 ? _d : '';
|
|
47042
47406
|
yield this.device.initialize();
|
|
47407
|
+
assertProtocolV2ReconnectIdentity(this.protocolV2ExpectedDeviceId, this.device.getCurrentDeviceId());
|
|
47043
47408
|
});
|
|
47044
47409
|
}
|
|
47045
47410
|
protocolV2CommonUpdateProcess(params) {
|
|
@@ -47078,11 +47443,10 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
47078
47443
|
const overwrite = offset === 0;
|
|
47079
47444
|
const progress = getProtocolV2DeviceTransferProgress((processedSize !== null && processedSize !== void 0 ? processedSize : 0) + offset, (processedSize !== null && processedSize !== void 0 ? processedSize : 0) + chunkEnd, totalSize !== null && totalSize !== void 0 ? totalSize : payload.byteLength);
|
|
47080
47445
|
const writeRes = yield this.fileWriteChunk(filePath, payload.byteLength, offset, chunk, overwrite, progress);
|
|
47081
|
-
const
|
|
47082
|
-
const
|
|
47083
|
-
|
|
47084
|
-
|
|
47085
|
-
if (nextOffset <= offset || nextOffset > payload.byteLength) {
|
|
47446
|
+
const rawProcessedByte = writeRes.message.processed_byte;
|
|
47447
|
+
const processedByte = Number(rawProcessedByte);
|
|
47448
|
+
const nextOffset = rawProcessedByte === undefined ? offset + chunkLength : processedByte;
|
|
47449
|
+
if (!Number.isFinite(nextOffset) || nextOffset <= offset || nextOffset > chunkEnd) {
|
|
47086
47450
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.EmmcFileWriteFirmwareError, `invalid processed_byte ${writeRes.message.processed_byte} for offset ${offset}`);
|
|
47087
47451
|
}
|
|
47088
47452
|
offset = nextOffset;
|
|
@@ -47721,14 +48085,16 @@ function writeProtocolV2File(options) {
|
|
|
47721
48085
|
}, { timeoutMs: options.timeoutMs });
|
|
47722
48086
|
(_g = options.throwIfAborted) === null || _g === void 0 ? void 0 : _g.call(options);
|
|
47723
48087
|
lastMessage = response.message;
|
|
47724
|
-
const
|
|
47725
|
-
|
|
47726
|
-
|
|
47727
|
-
|
|
47728
|
-
|
|
47729
|
-
|
|
48088
|
+
const rawProcessedByte = (_h = response.message) === null || _h === void 0 ? void 0 : _h.processed_byte;
|
|
48089
|
+
const processedByte = Number(rawProcessedByte);
|
|
48090
|
+
if (rawProcessedByte !== undefined &&
|
|
48091
|
+
(!Number.isFinite(processedByte) ||
|
|
48092
|
+
processedByte <= offset ||
|
|
48093
|
+
processedByte > offset + chunk.byteLength)) {
|
|
47730
48094
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `FilesystemFileWrite invalid processed_byte ${processedByte}`);
|
|
47731
48095
|
}
|
|
48096
|
+
written =
|
|
48097
|
+
rawProcessedByte === undefined ? written + chunk.byteLength : processedByte - startOffset;
|
|
47732
48098
|
chunks += 1;
|
|
47733
48099
|
const elapsedMs = Date.now() - startTime;
|
|
47734
48100
|
const transferredBytes = Math.min(written, dataLength);
|
|
@@ -47803,7 +48169,7 @@ class DeviceUploadWallpaper extends BaseMethod {
|
|
|
47803
48169
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47804
48170
|
if (this.uploaded)
|
|
47805
48171
|
return;
|
|
47806
|
-
const encoded = this
|
|
48172
|
+
const { encoded } = this;
|
|
47807
48173
|
if (!encoded)
|
|
47808
48174
|
throw invalidParameter('Wallpaper data has not been initialized.');
|
|
47809
48175
|
yield writeProtocolV2File({
|
|
@@ -47815,6 +48181,11 @@ class DeviceUploadWallpaper extends BaseMethod {
|
|
|
47815
48181
|
overwrite: true,
|
|
47816
48182
|
append: false,
|
|
47817
48183
|
throwIfAborted: () => this.throwIfAborted(),
|
|
48184
|
+
onProgress: payload => {
|
|
48185
|
+
if (typeof this.postMessage === 'function') {
|
|
48186
|
+
this.postMessage(createUiMessage(UI_REQUEST.DEVICE_PROGRESS, payload));
|
|
48187
|
+
}
|
|
48188
|
+
},
|
|
47818
48189
|
});
|
|
47819
48190
|
this.uploaded = true;
|
|
47820
48191
|
});
|
|
@@ -47822,7 +48193,7 @@ class DeviceUploadWallpaper extends BaseMethod {
|
|
|
47822
48193
|
run() {
|
|
47823
48194
|
var _a;
|
|
47824
48195
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47825
|
-
const encoded = this
|
|
48196
|
+
const { encoded } = this;
|
|
47826
48197
|
if (!encoded)
|
|
47827
48198
|
throw invalidParameter('Wallpaper data has not been initialized.');
|
|
47828
48199
|
yield this.ensureDirectory();
|
|
@@ -47873,40 +48244,6 @@ class FilesystemFormat extends BaseMethod {
|
|
|
47873
48244
|
}
|
|
47874
48245
|
}
|
|
47875
48246
|
|
|
47876
|
-
function normalizeDiskControlEnable(value) {
|
|
47877
|
-
if (value === undefined || value === null)
|
|
47878
|
-
return 0;
|
|
47879
|
-
if (typeof value === 'boolean')
|
|
47880
|
-
return value ? 1 : 0;
|
|
47881
|
-
if (value === 0 || value === '0')
|
|
47882
|
-
return 0;
|
|
47883
|
-
if (value === 1 || value === '1')
|
|
47884
|
-
return 1;
|
|
47885
|
-
throw invalidParameter('Parameter [enable] must be a boolean or 0 | 1.');
|
|
47886
|
-
}
|
|
47887
|
-
class FilesystemDiskControl extends BaseMethod {
|
|
47888
|
-
init() {
|
|
47889
|
-
this.requireProtocolV2 = true;
|
|
47890
|
-
this.skipForceUpdateCheck = true;
|
|
47891
|
-
this.useDevicePassphraseState = false;
|
|
47892
|
-
this.params = {
|
|
47893
|
-
enable: normalizeDiskControlEnable(this.payload.enable),
|
|
47894
|
-
timeoutMs: validateOptionalNonNegativeInteger(this.payload.timeoutMs, 'timeoutMs'),
|
|
47895
|
-
};
|
|
47896
|
-
}
|
|
47897
|
-
run() {
|
|
47898
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
47899
|
-
const typedCall = this.device.commands.typedCall;
|
|
47900
|
-
const res = yield typedCall('FilesystemDiskControl', 'Success', {
|
|
47901
|
-
enable: this.params.enable,
|
|
47902
|
-
}, {
|
|
47903
|
-
timeoutMs: this.params.timeoutMs,
|
|
47904
|
-
});
|
|
47905
|
-
return Promise.resolve(res.message);
|
|
47906
|
-
});
|
|
47907
|
-
}
|
|
47908
|
-
}
|
|
47909
|
-
|
|
47910
48247
|
const MIN_FILE_READ_CHUNK_SIZE = 64;
|
|
47911
48248
|
function getProtocolV2FileReadChunkLimit() {
|
|
47912
48249
|
const env = DataManager.getSettings('env');
|
|
@@ -54465,7 +54802,7 @@ class CardanoSignTransaction extends BaseMethod {
|
|
|
54465
54802
|
var _a;
|
|
54466
54803
|
this.checkDeviceId = true;
|
|
54467
54804
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
54468
|
-
this.allowUsePreInitialize =
|
|
54805
|
+
this.allowUsePreInitialize = false;
|
|
54469
54806
|
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
54470
54807
|
const { payload } = this;
|
|
54471
54808
|
if (payload.auxiliaryData && payload.auxiliaryData.governanceRegistrationParameters) {
|
|
@@ -54701,7 +55038,7 @@ class CardanoSignMessage extends BaseMethod {
|
|
|
54701
55038
|
init() {
|
|
54702
55039
|
this.checkDeviceId = true;
|
|
54703
55040
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
54704
|
-
this.allowUsePreInitialize =
|
|
55041
|
+
this.allowUsePreInitialize = false;
|
|
54705
55042
|
const { payload } = this;
|
|
54706
55043
|
validateParams(payload, [
|
|
54707
55044
|
{ name: 'path', type: 'string', required: true },
|
|
@@ -57428,7 +57765,6 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
|
57428
57765
|
deviceUploadWallpaper: DeviceUploadWallpaper,
|
|
57429
57766
|
filesystemPermissionFix: FilesystemPermissionFix,
|
|
57430
57767
|
filesystemFormat: FilesystemFormat,
|
|
57431
|
-
filesystemDiskControl: FilesystemDiskControl,
|
|
57432
57768
|
fileRead: FileRead,
|
|
57433
57769
|
fileWrite: FileWrite,
|
|
57434
57770
|
fileDelete: FileDelete,
|