@onekeyfe/hd-core 1.2.0-alpha.99 → 1.2.0
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__/AllNetworkGetAddressBase.tracing.test.ts +20 -4
- package/__tests__/DeviceCommands.test.ts +203 -27
- package/__tests__/base64Data.test.ts +69 -0
- package/__tests__/check-all-firmware-release-protocol-v2.test.ts +48 -2
- package/__tests__/check-firmware-release-protocol-v2.test.ts +82 -13
- package/__tests__/device-connector-protocol.test.ts +21 -0
- package/__tests__/device-lifecycle-events.test.ts +427 -7
- package/__tests__/device-pool-state.test.ts +25 -0
- package/__tests__/device-settings.test.ts +237 -9
- package/__tests__/device-state-events.test.ts +2 -2
- package/__tests__/device-state-mapper.test.ts +61 -5
- package/__tests__/device-utils.test.ts +15 -1
- package/__tests__/device-wallet-session-store.test.ts +147 -21
- package/__tests__/deviceSettings.test.ts +7 -3
- package/__tests__/deviceUploadNft.test.ts +36 -4
- package/__tests__/firmware-update/device-update-bootloader.test.ts +13 -3
- package/__tests__/firmware-update/firmware-artifact-source.test.ts +61 -9
- package/__tests__/firmware-update/firmware-prepared-host-digest.test.ts +19 -9
- package/__tests__/firmware-update/firmware-prepared-resource-archive.test.ts +21 -0
- package/__tests__/firmware-update/firmware-update-bootloader-poll.test.ts +63 -0
- package/__tests__/firmware-update/firmware-update-plan.test.ts +59 -55
- package/__tests__/firmware-update/firmware-update-prepared-plan.test.ts +19 -5
- package/__tests__/firmware-update/firmware-update-v3-reconnect.test.ts +116 -0
- package/__tests__/firmware-update/firmware-update-v4-install-poll.test.ts +678 -0
- package/__tests__/firmware-update/firmware-update-v4-parameters.test.ts +85 -0
- package/__tests__/get-device-state.test.ts +60 -21
- package/__tests__/logBlockEvent.test.ts +13 -1
- package/__tests__/open-wallet-session.test.ts +127 -1
- package/__tests__/protocol-v2-firmware-targets.test.ts +23 -0
- package/__tests__/protocol-v2-resources.test.ts +185 -88
- package/__tests__/protocol-v2-unlock-policy.test.ts +235 -2
- package/__tests__/protocol-v2.test.ts +2198 -486
- package/__tests__/refresh-device-state.test.ts +3 -1
- package/__tests__/resourceBase64Boundary.test.ts +48 -0
- package/__tests__/search-devices.test.ts +79 -32
- package/__tests__/ton-sign-message.test.ts +84 -0
- package/dist/api/BaseMethod.d.ts +2 -1
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
- package/dist/api/CheckBootloaderRelease.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +19 -6
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/OpenWalletSession.d.ts.map +1 -1
- package/dist/api/SearchDevices.d.ts.map +1 -1
- package/dist/api/UploadPortfolio.d.ts +1 -1
- package/dist/api/UploadPortfolio.d.ts.map +1 -1
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
- package/dist/api/device/DeviceChangePin.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBoardloader.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBootloader.d.ts.map +1 -1
- package/dist/api/device/DeviceSettings.d.ts.map +1 -1
- package/dist/api/device/DeviceVerify.d.ts +1 -0
- package/dist/api/device/DeviceVerify.d.ts.map +1 -1
- package/dist/api/device/DeviceWipe.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareArtifactSource.d.ts +5 -1
- package/dist/api/firmware/FirmwareArtifactSource.d.ts.map +1 -1
- package/dist/api/firmware/FirmwarePreparedResourceArchive.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +2 -2
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts +0 -15
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts.map +1 -1
- package/dist/api/firmware/getBinary.d.ts +3 -2
- package/dist/api/firmware/getBinary.d.ts.map +1 -1
- package/dist/api/firmware/protocolV2Release.d.ts.map +1 -1
- package/dist/api/helpers/base64Data.d.ts +16 -0
- package/dist/api/helpers/base64Data.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts +3 -1
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceInfoGet.d.ts +1 -1
- package/dist/api/protocol-v2/DeviceInfoGet.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceReboot.d.ts +1 -1
- package/dist/api/protocol-v2/DeviceReboot.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceUploadNft.d.ts +2 -3
- package/dist/api/protocol-v2/DeviceUploadNft.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceUploadWallpaper.d.ts +2 -3
- package/dist/api/protocol-v2/DeviceUploadWallpaper.d.ts.map +1 -1
- package/dist/api/protocol-v2/helpers.d.ts.map +1 -1
- package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
- package/dist/core/index.d.ts +6 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +4 -3
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/data-manager/TransportManager.d.ts.map +1 -1
- package/dist/device/Device.d.ts +16 -3
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +4 -4
- package/dist/device/DeviceCommands.d.ts.map +1 -1
- package/dist/device/DeviceConnector.d.ts +1 -1
- package/dist/device/DeviceConnector.d.ts.map +1 -1
- package/dist/device/DevicePool.d.ts.map +1 -1
- package/dist/device/DeviceStateMapper.d.ts.map +1 -1
- package/dist/deviceProfile/buildDeviceFeatures.d.ts.map +1 -1
- package/dist/events/logBlockEvent.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +3 -0
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/index.d.ts +54 -84
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2135 -1470
- package/dist/protocols/protocol-v2/features.d.ts +13 -5
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/index.d.ts +2 -2
- package/dist/protocols/protocol-v2/index.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/resources.d.ts +12 -7
- package/dist/protocols/protocol-v2/resources.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/unlockPolicyRunner.d.ts +3 -1
- package/dist/protocols/protocol-v2/unlockPolicyRunner.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/walletSession.d.ts +3 -0
- package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdatePlan.d.ts +2 -2
- package/dist/types/api/firmwareUpdatePlan.d.ts.map +1 -1
- package/dist/types/api/protocolV2.d.ts +1 -1
- package/dist/types/api/protocolV2.d.ts.map +1 -1
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/settings.d.ts +3 -31
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesCompat.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +3 -0
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
- package/dist/utils/deviceSettings.d.ts +1 -0
- package/dist/utils/deviceSettings.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/dist/utils/pro2Nft.d.ts +7 -0
- package/dist/utils/pro2Nft.d.ts.map +1 -1
- package/package.json +6 -4
- package/src/api/BaseMethod.ts +8 -1
- package/src/api/CheckAllFirmwareRelease.ts +2 -4
- package/src/api/CheckBLEFirmwareRelease.ts +2 -2
- package/src/api/CheckBootloaderRelease.ts +3 -2
- package/src/api/CheckFirmwareRelease.ts +2 -2
- package/src/api/FirmwareUpdateV2.ts +12 -9
- package/src/api/FirmwareUpdateV3.ts +29 -19
- package/src/api/FirmwareUpdateV4.ts +918 -741
- package/src/api/OpenWalletSession.ts +39 -9
- package/src/api/PromptWebDeviceAccess.ts +2 -2
- package/src/api/SearchDevices.ts +6 -3
- package/src/api/UploadPortfolio.ts +9 -2
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +2 -1
- package/src/api/device/DeviceChangePin.ts +4 -1
- package/src/api/device/DeviceRebootToBoardloader.ts +3 -1
- package/src/api/device/DeviceRebootToBootloader.ts +3 -1
- package/src/api/device/DeviceSettings.ts +34 -20
- package/src/api/device/DeviceVerify.ts +25 -0
- package/src/api/device/DeviceWipe.ts +4 -1
- package/src/api/firmware/FirmwareArtifactSource.ts +41 -14
- package/src/api/firmware/FirmwarePreparedResourceArchive.ts +16 -27
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +9 -3
- package/src/api/firmware/FirmwareUpdatePlan.ts +37 -77
- package/src/api/firmware/FirmwareUpdatePreparedPlan.ts +10 -6
- package/src/api/firmware/protocolV2Release.ts +7 -2
- package/src/api/helpers/base64Data.ts +85 -0
- package/src/api/protocol-v2/DeviceFactoryInfoSet.ts +1 -1
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +6 -28
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +7 -1
- package/src/api/protocol-v2/DeviceInfoGet.ts +3 -3
- package/src/api/protocol-v2/DeviceReboot.ts +5 -0
- package/src/api/protocol-v2/DeviceUploadNft.ts +61 -9
- package/src/api/protocol-v2/DeviceUploadWallpaper.ts +53 -19
- package/src/api/protocol-v2/helpers.ts +8 -0
- package/src/api/ton/TonSignMessage.ts +5 -3
- package/src/core/index.ts +264 -55
- package/src/data/messages/messages-protocol-v2.json +140 -13
- package/src/data-manager/DataManager.ts +46 -39
- package/src/data-manager/TransportManager.ts +3 -1
- package/src/device/Device.ts +210 -44
- package/src/device/DeviceCommands.ts +27 -18
- package/src/device/DeviceConnector.ts +17 -3
- package/src/device/DevicePool.ts +9 -2
- package/src/device/DeviceStateMapper.ts +30 -24
- package/src/deviceProfile/buildDeviceFeatures.ts +10 -5
- package/src/events/logBlockEvent.ts +14 -1
- package/src/events/ui-request.ts +3 -0
- package/src/index.ts +0 -10
- package/src/protocols/protocol-v2/features.ts +22 -5
- package/src/protocols/protocol-v2/index.ts +2 -0
- package/src/protocols/protocol-v2/resources.ts +110 -147
- package/src/protocols/protocol-v2/unlockPolicyRunner.ts +13 -1
- package/src/protocols/protocol-v2/walletSession.ts +65 -22
- package/src/types/api/firmwareUpdate.ts +1 -1
- package/src/types/api/firmwareUpdatePlan.ts +2 -2
- package/src/types/api/protocolV2.ts +1 -1
- package/src/types/device.ts +2 -1
- package/src/types/settings.ts +6 -34
- package/src/utils/deviceFeaturesCompat.ts +9 -4
- package/src/utils/deviceFeaturesUtils.ts +4 -0
- package/src/utils/deviceInfoUtils.ts +9 -2
- package/src/utils/deviceSettings.ts +11 -4
- package/src/utils/index.ts +1 -0
- package/src/utils/pro2Nft.ts +31 -8
- package/__tests__/firmware-memory-host.test.ts +0 -126
- package/dist/api/firmware/FirmwareMemoryHost.d.ts +0 -22
- package/dist/api/firmware/FirmwareMemoryHost.d.ts.map +0 -1
- package/src/api/firmware/FirmwareMemoryHost.ts +0 -143
|
@@ -446,6 +446,9 @@
|
|
|
446
446
|
"MessageType_DeviceCertificateSignature": 60423,
|
|
447
447
|
"MessageType_DeviceCertificateSign": 60424,
|
|
448
448
|
"MessageType_DeviceMiscUsbMscControl": 60440,
|
|
449
|
+
"MessageType_DeviceFindMyTokenState": 60450,
|
|
450
|
+
"MessageType_DeviceFindMyTokenUpdate": 60451,
|
|
451
|
+
"MessageType_DeviceFindMyTokenStateGet": 60452,
|
|
449
452
|
"MessageType_DeviceInfoGet": 60600,
|
|
450
453
|
"MessageType_DeviceInfo": 60601,
|
|
451
454
|
"MessageType_DeviceStatusGet": 60602,
|
|
@@ -462,9 +465,10 @@
|
|
|
462
465
|
"MessageType_FilesystemDirMake": 60809,
|
|
463
466
|
"MessageType_FilesystemDirRemove": 60810,
|
|
464
467
|
"MessageType_FilesystemFormat": 60811,
|
|
465
|
-
"
|
|
466
|
-
"
|
|
467
|
-
"
|
|
468
|
+
"MessageType_DeviceFirmwareUpdateStage": 61000,
|
|
469
|
+
"MessageType_DeviceFirmwareUpdateRequest": 61001,
|
|
470
|
+
"MessageType_DeviceFirmwareUpdateStatusGet": 61002,
|
|
471
|
+
"MessageType_DeviceFirmwareUpdateStatus": 61003,
|
|
468
472
|
"MessageType_DeviceSessionGet": 61200,
|
|
469
473
|
"MessageType_DeviceSession": 61201,
|
|
470
474
|
"MessageType_DeviceSessionAskPin": 61202,
|
|
@@ -5403,6 +5407,10 @@
|
|
|
5403
5407
|
"request_id": {
|
|
5404
5408
|
"type": "bytes",
|
|
5405
5409
|
"id": 5
|
|
5410
|
+
},
|
|
5411
|
+
"source_fingerprint": {
|
|
5412
|
+
"type": "uint32",
|
|
5413
|
+
"id": 6
|
|
5406
5414
|
}
|
|
5407
5415
|
}
|
|
5408
5416
|
},
|
|
@@ -5538,6 +5546,14 @@
|
|
|
5538
5546
|
"tx_type": {
|
|
5539
5547
|
"type": "uint32",
|
|
5540
5548
|
"id": 10
|
|
5549
|
+
},
|
|
5550
|
+
"expected_address": {
|
|
5551
|
+
"type": "bytes",
|
|
5552
|
+
"id": 12
|
|
5553
|
+
},
|
|
5554
|
+
"source_fingerprint": {
|
|
5555
|
+
"type": "uint32",
|
|
5556
|
+
"id": 13
|
|
5541
5557
|
}
|
|
5542
5558
|
}
|
|
5543
5559
|
},
|
|
@@ -5618,6 +5634,14 @@
|
|
|
5618
5634
|
"rule": "repeated",
|
|
5619
5635
|
"type": "EthereumAccessListOneKey",
|
|
5620
5636
|
"id": 11
|
|
5637
|
+
},
|
|
5638
|
+
"expected_address": {
|
|
5639
|
+
"type": "bytes",
|
|
5640
|
+
"id": 12
|
|
5641
|
+
},
|
|
5642
|
+
"source_fingerprint": {
|
|
5643
|
+
"type": "uint32",
|
|
5644
|
+
"id": 13
|
|
5621
5645
|
}
|
|
5622
5646
|
}
|
|
5623
5647
|
},
|
|
@@ -5794,6 +5818,10 @@
|
|
|
5794
5818
|
"chain_id": {
|
|
5795
5819
|
"type": "uint64",
|
|
5796
5820
|
"id": 3
|
|
5821
|
+
},
|
|
5822
|
+
"source_fingerprint": {
|
|
5823
|
+
"type": "uint32",
|
|
5824
|
+
"id": 4
|
|
5797
5825
|
}
|
|
5798
5826
|
}
|
|
5799
5827
|
},
|
|
@@ -9473,6 +9501,10 @@
|
|
|
9473
9501
|
"rule": "required",
|
|
9474
9502
|
"type": "bytes",
|
|
9475
9503
|
"id": 2
|
|
9504
|
+
},
|
|
9505
|
+
"source_fingerprint": {
|
|
9506
|
+
"type": "uint32",
|
|
9507
|
+
"id": 3
|
|
9476
9508
|
}
|
|
9477
9509
|
}
|
|
9478
9510
|
},
|
|
@@ -9517,6 +9549,10 @@
|
|
|
9517
9549
|
"application_domain": {
|
|
9518
9550
|
"type": "bytes",
|
|
9519
9551
|
"id": 5
|
|
9552
|
+
},
|
|
9553
|
+
"source_fingerprint": {
|
|
9554
|
+
"type": "uint32",
|
|
9555
|
+
"id": 6
|
|
9520
9556
|
}
|
|
9521
9557
|
}
|
|
9522
9558
|
},
|
|
@@ -9534,6 +9570,10 @@
|
|
|
9534
9570
|
"rule": "required",
|
|
9535
9571
|
"type": "bytes",
|
|
9536
9572
|
"id": 2
|
|
9573
|
+
},
|
|
9574
|
+
"source_fingerprint": {
|
|
9575
|
+
"type": "uint32",
|
|
9576
|
+
"id": 3
|
|
9537
9577
|
}
|
|
9538
9578
|
}
|
|
9539
9579
|
},
|
|
@@ -11763,6 +11803,27 @@
|
|
|
11763
11803
|
}
|
|
11764
11804
|
}
|
|
11765
11805
|
},
|
|
11806
|
+
"DeviceFindMyTokenUpdate": {
|
|
11807
|
+
"fields": {
|
|
11808
|
+
"token": {
|
|
11809
|
+
"rule": "required",
|
|
11810
|
+
"type": "bytes",
|
|
11811
|
+
"id": 1
|
|
11812
|
+
}
|
|
11813
|
+
}
|
|
11814
|
+
},
|
|
11815
|
+
"DeviceFindMyTokenStateGet": {
|
|
11816
|
+
"fields": {}
|
|
11817
|
+
},
|
|
11818
|
+
"DeviceFindMyTokenState": {
|
|
11819
|
+
"fields": {
|
|
11820
|
+
"burned": {
|
|
11821
|
+
"rule": "required",
|
|
11822
|
+
"type": "bool",
|
|
11823
|
+
"id": 1
|
|
11824
|
+
}
|
|
11825
|
+
}
|
|
11826
|
+
},
|
|
11766
11827
|
"DeviceFactoryAck": {
|
|
11767
11828
|
"values": {
|
|
11768
11829
|
"FACTORY_ACK_SUCCESS": 0,
|
|
@@ -11813,14 +11874,14 @@
|
|
|
11813
11874
|
"type": "string",
|
|
11814
11875
|
"id": 2
|
|
11815
11876
|
},
|
|
11816
|
-
"burn_in_completed": {
|
|
11817
|
-
"type": "bool",
|
|
11818
|
-
"id": 3
|
|
11819
|
-
},
|
|
11820
11877
|
"factory_test_completed": {
|
|
11821
11878
|
"type": "bool",
|
|
11822
11879
|
"id": 4
|
|
11823
11880
|
},
|
|
11881
|
+
"factory_burn_in_completed": {
|
|
11882
|
+
"type": "bool",
|
|
11883
|
+
"id": 3
|
|
11884
|
+
},
|
|
11824
11885
|
"manufacture_time": {
|
|
11825
11886
|
"type": "DeviceFactoryInfoManufactureTime",
|
|
11826
11887
|
"id": 5
|
|
@@ -11892,6 +11953,13 @@
|
|
|
11892
11953
|
"FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS": 10
|
|
11893
11954
|
}
|
|
11894
11955
|
},
|
|
11956
|
+
"DeviceFirmwareUpdatePhase": {
|
|
11957
|
+
"values": {
|
|
11958
|
+
"FW_MGMT_UPDATER_PHASE_PREPARE": 0,
|
|
11959
|
+
"FW_MGMT_UPDATER_PHASE_INSTALL": 1,
|
|
11960
|
+
"FW_MGMT_UPDATER_PHASE_VERIFY": 2
|
|
11961
|
+
}
|
|
11962
|
+
},
|
|
11895
11963
|
"DeviceFirmwareTarget": {
|
|
11896
11964
|
"fields": {
|
|
11897
11965
|
"target_id": {
|
|
@@ -11906,7 +11974,7 @@
|
|
|
11906
11974
|
}
|
|
11907
11975
|
}
|
|
11908
11976
|
},
|
|
11909
|
-
"
|
|
11977
|
+
"DeviceFirmwareUpdateStage": {
|
|
11910
11978
|
"fields": {
|
|
11911
11979
|
"targets": {
|
|
11912
11980
|
"rule": "repeated",
|
|
@@ -11915,6 +11983,28 @@
|
|
|
11915
11983
|
}
|
|
11916
11984
|
}
|
|
11917
11985
|
},
|
|
11986
|
+
"DeviceFirmwareUpdateRequest": {
|
|
11987
|
+
"fields": {
|
|
11988
|
+
"reboot_after_update": {
|
|
11989
|
+
"type": "bool",
|
|
11990
|
+
"id": 1
|
|
11991
|
+
}
|
|
11992
|
+
}
|
|
11993
|
+
},
|
|
11994
|
+
"DeviceFirmwareUpdatePhaseInfo": {
|
|
11995
|
+
"fields": {
|
|
11996
|
+
"phase": {
|
|
11997
|
+
"rule": "required",
|
|
11998
|
+
"type": "DeviceFirmwareUpdatePhase",
|
|
11999
|
+
"id": 1
|
|
12000
|
+
},
|
|
12001
|
+
"progress_percent": {
|
|
12002
|
+
"rule": "required",
|
|
12003
|
+
"type": "uint32",
|
|
12004
|
+
"id": 2
|
|
12005
|
+
}
|
|
12006
|
+
}
|
|
12007
|
+
},
|
|
11918
12008
|
"DeviceFirmwareUpdateRecord": {
|
|
11919
12009
|
"fields": {
|
|
11920
12010
|
"target_id": {
|
|
@@ -11926,6 +12016,14 @@
|
|
|
11926
12016
|
"type": "DeviceFirmwareUpdateTaskStatus",
|
|
11927
12017
|
"id": 10
|
|
11928
12018
|
},
|
|
12019
|
+
"progress_percent": {
|
|
12020
|
+
"type": "uint32",
|
|
12021
|
+
"id": 11
|
|
12022
|
+
},
|
|
12023
|
+
"phase_info": {
|
|
12024
|
+
"type": "DeviceFirmwareUpdatePhaseInfo",
|
|
12025
|
+
"id": 12
|
|
12026
|
+
},
|
|
11929
12027
|
"payload_version": {
|
|
11930
12028
|
"type": "uint32",
|
|
11931
12029
|
"id": 20
|
|
@@ -11942,6 +12040,14 @@
|
|
|
11942
12040
|
"type": "bool",
|
|
11943
12041
|
"id": 10
|
|
11944
12042
|
},
|
|
12043
|
+
"progress_percent": {
|
|
12044
|
+
"type": "bool",
|
|
12045
|
+
"id": 11
|
|
12046
|
+
},
|
|
12047
|
+
"phase_info": {
|
|
12048
|
+
"type": "bool",
|
|
12049
|
+
"id": 12
|
|
12050
|
+
},
|
|
11945
12051
|
"payload_version": {
|
|
11946
12052
|
"type": "bool",
|
|
11947
12053
|
"id": 20
|
|
@@ -12096,7 +12202,7 @@
|
|
|
12096
12202
|
"type": "bool",
|
|
12097
12203
|
"id": 100
|
|
12098
12204
|
},
|
|
12099
|
-
"
|
|
12205
|
+
"main_mcu": {
|
|
12100
12206
|
"type": "bool",
|
|
12101
12207
|
"id": 200
|
|
12102
12208
|
},
|
|
@@ -12165,7 +12271,7 @@
|
|
|
12165
12271
|
"type": "DeviceHardwareInfo",
|
|
12166
12272
|
"id": 100
|
|
12167
12273
|
},
|
|
12168
|
-
"
|
|
12274
|
+
"main_mcu": {
|
|
12169
12275
|
"type": "DeviceMainMcuInfo",
|
|
12170
12276
|
"id": 200
|
|
12171
12277
|
},
|
|
@@ -12703,9 +12809,16 @@
|
|
|
12703
12809
|
"id": 1
|
|
12704
12810
|
},
|
|
12705
12811
|
"text": {
|
|
12706
|
-
"rule": "required",
|
|
12707
12812
|
"type": "string",
|
|
12708
12813
|
"id": 2
|
|
12814
|
+
},
|
|
12815
|
+
"text_id": {
|
|
12816
|
+
"type": "uint32",
|
|
12817
|
+
"id": 3
|
|
12818
|
+
},
|
|
12819
|
+
"text_arg": {
|
|
12820
|
+
"type": "string",
|
|
12821
|
+
"id": 4
|
|
12709
12822
|
}
|
|
12710
12823
|
}
|
|
12711
12824
|
},
|
|
@@ -12736,7 +12849,6 @@
|
|
|
12736
12849
|
"ViewSignPage": {
|
|
12737
12850
|
"fields": {
|
|
12738
12851
|
"title": {
|
|
12739
|
-
"rule": "required",
|
|
12740
12852
|
"type": "string",
|
|
12741
12853
|
"id": 1
|
|
12742
12854
|
},
|
|
@@ -12770,13 +12882,20 @@
|
|
|
12770
12882
|
"options": {
|
|
12771
12883
|
"default": "LayoutDefault"
|
|
12772
12884
|
}
|
|
12885
|
+
},
|
|
12886
|
+
"title_id": {
|
|
12887
|
+
"type": "uint32",
|
|
12888
|
+
"id": 8
|
|
12889
|
+
},
|
|
12890
|
+
"title_arg": {
|
|
12891
|
+
"type": "string",
|
|
12892
|
+
"id": 9
|
|
12773
12893
|
}
|
|
12774
12894
|
}
|
|
12775
12895
|
},
|
|
12776
12896
|
"ViewVerifyPage": {
|
|
12777
12897
|
"fields": {
|
|
12778
12898
|
"title": {
|
|
12779
|
-
"rule": "required",
|
|
12780
12899
|
"type": "string",
|
|
12781
12900
|
"id": 1
|
|
12782
12901
|
},
|
|
@@ -12801,6 +12920,14 @@
|
|
|
12801
12920
|
"value_key": {
|
|
12802
12921
|
"type": "uint32",
|
|
12803
12922
|
"id": 6
|
|
12923
|
+
},
|
|
12924
|
+
"title_id": {
|
|
12925
|
+
"type": "uint32",
|
|
12926
|
+
"id": 7
|
|
12927
|
+
},
|
|
12928
|
+
"chain_id": {
|
|
12929
|
+
"type": "uint32",
|
|
12930
|
+
"id": 8
|
|
12804
12931
|
}
|
|
12805
12932
|
}
|
|
12806
12933
|
},
|
|
@@ -26,7 +26,7 @@ import type {
|
|
|
26
26
|
Features,
|
|
27
27
|
IDeviceBLEFirmwareStatus,
|
|
28
28
|
IDeviceFirmwareStatus,
|
|
29
|
-
|
|
29
|
+
IFirmwareReleaseInfo,
|
|
30
30
|
ITransportStatus,
|
|
31
31
|
IVersionArray,
|
|
32
32
|
RemoteConfigResponse,
|
|
@@ -407,6 +407,37 @@ export default class DataManager {
|
|
|
407
407
|
return enrichedData;
|
|
408
408
|
}
|
|
409
409
|
|
|
410
|
+
private static enrichProtocolV2FirmwareReleaseInfo(
|
|
411
|
+
deviceData: DeviceTypeMap[keyof DeviceTypeMap] | undefined,
|
|
412
|
+
onResourcesError: (error: Error) => void
|
|
413
|
+
): NonNullable<DeviceTypeMap[keyof DeviceTypeMap]> {
|
|
414
|
+
const enrichedData = this.enrichFirmwareReleaseInfo(deviceData);
|
|
415
|
+
const releases = enrichedData['firmware-v1'];
|
|
416
|
+
if (!Array.isArray(releases)) {
|
|
417
|
+
return enrichedData;
|
|
418
|
+
}
|
|
419
|
+
const latestRelease = findLatestRelease(releases);
|
|
420
|
+
|
|
421
|
+
return {
|
|
422
|
+
...enrichedData,
|
|
423
|
+
'firmware-v1': releases.map(release => {
|
|
424
|
+
const { resources: rawResources, ...releaseWithoutResources } = release;
|
|
425
|
+
try {
|
|
426
|
+
const resources = parseProtocolV2Resources(rawResources);
|
|
427
|
+
return {
|
|
428
|
+
...releaseWithoutResources,
|
|
429
|
+
...(resources ? { resources } : undefined),
|
|
430
|
+
};
|
|
431
|
+
} catch (error) {
|
|
432
|
+
if (release === latestRelease) {
|
|
433
|
+
onResourcesError(error instanceof Error ? error : new Error(String(error)));
|
|
434
|
+
}
|
|
435
|
+
return releaseWithoutResources;
|
|
436
|
+
}
|
|
437
|
+
}),
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
|
|
410
441
|
static async load(settings: ConnectSettings): Promise<boolean> {
|
|
411
442
|
this.settings = settings;
|
|
412
443
|
this.protocolV2ResourcesConfigError = undefined;
|
|
@@ -450,7 +481,7 @@ export default class DataManager {
|
|
|
450
481
|
Log.debug('[DataConfig] Trying SDK-managed config request...');
|
|
451
482
|
try {
|
|
452
483
|
const response = await axios.get<RemoteConfigResponse>(urlWithCache, {
|
|
453
|
-
//
|
|
484
|
+
// Keep the config request below the 20-second iframe initialization timeout.
|
|
454
485
|
timeout: 7000,
|
|
455
486
|
});
|
|
456
487
|
data = response.data;
|
|
@@ -471,32 +502,16 @@ export default class DataManager {
|
|
|
471
502
|
}
|
|
472
503
|
|
|
473
504
|
private static applyRemoteConfig(data: RemoteConfigResponse) {
|
|
474
|
-
|
|
475
|
-
let neoResources: IProtocolV2Resources | undefined;
|
|
476
|
-
try {
|
|
477
|
-
pro2Resources = parseProtocolV2Resources(
|
|
478
|
-
(data.pro2 as { resources?: unknown } | undefined)?.resources
|
|
479
|
-
);
|
|
480
|
-
} catch (error) {
|
|
505
|
+
const pro2Config = this.enrichProtocolV2FirmwareReleaseInfo(data.pro2, error => {
|
|
481
506
|
// Firmware resource metadata is not required for base communication. If the
|
|
482
|
-
//
|
|
483
|
-
this.protocolV2ResourcesConfigError =
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
);
|
|
491
|
-
} catch (error) {
|
|
492
|
-
this.protocolV2NeoResourcesConfigError =
|
|
493
|
-
error instanceof Error ? error : new Error(String(error));
|
|
494
|
-
Log.warn('[DataConfig] Ignoring invalid Neo resources config:', error);
|
|
495
|
-
}
|
|
496
|
-
const enrichedPro2Config = this.enrichFirmwareReleaseInfo(data.pro2);
|
|
497
|
-
const enrichedNeoConfig = this.enrichFirmwareReleaseInfo(data.neo);
|
|
498
|
-
const { resources: _unvalidatedResources, ...pro2Config } = enrichedPro2Config;
|
|
499
|
-
const { resources: _unvalidatedNeoResources, ...neoConfig } = enrichedNeoConfig;
|
|
507
|
+
// The selected release is incomplete, so disable its resource update only.
|
|
508
|
+
this.protocolV2ResourcesConfigError = error;
|
|
509
|
+
Log.warn('[DataConfig] Ignoring invalid Pro2 release resources config:', error);
|
|
510
|
+
});
|
|
511
|
+
const neoConfig = this.enrichProtocolV2FirmwareReleaseInfo(data.neo, error => {
|
|
512
|
+
this.protocolV2NeoResourcesConfigError = error;
|
|
513
|
+
Log.warn('[DataConfig] Ignoring invalid Neo release resources config:', error);
|
|
514
|
+
});
|
|
500
515
|
this.deviceMap = {
|
|
501
516
|
[EDeviceType.Classic]: this.enrichFirmwareReleaseInfo(data.classic),
|
|
502
517
|
[EDeviceType.Classic1s]: this.enrichFirmwareReleaseInfo(data.classic1s),
|
|
@@ -504,14 +519,8 @@ export default class DataManager {
|
|
|
504
519
|
[EDeviceType.Mini]: this.enrichFirmwareReleaseInfo(data.mini),
|
|
505
520
|
[EDeviceType.Touch]: this.enrichFirmwareReleaseInfo(data.touch),
|
|
506
521
|
[EDeviceType.Pro]: this.enrichFirmwareReleaseInfo(data.pro),
|
|
507
|
-
[EDeviceType.Pro2]:
|
|
508
|
-
|
|
509
|
-
...(pro2Resources ? { resources: pro2Resources } : undefined),
|
|
510
|
-
},
|
|
511
|
-
[EDeviceType.Neo]: {
|
|
512
|
-
...neoConfig,
|
|
513
|
-
...(neoResources ? { resources: neoResources } : undefined),
|
|
514
|
-
},
|
|
522
|
+
[EDeviceType.Pro2]: pro2Config,
|
|
523
|
+
[EDeviceType.Neo]: neoConfig,
|
|
515
524
|
};
|
|
516
525
|
this.assets = {
|
|
517
526
|
bridge: data.bridge,
|
|
@@ -589,10 +598,8 @@ export default class DataManager {
|
|
|
589
598
|
this.lastCheckTimestamp = getTimeStamp();
|
|
590
599
|
}
|
|
591
600
|
|
|
592
|
-
static getProtocolV2ResourceSource(
|
|
593
|
-
|
|
594
|
-
) {
|
|
595
|
-
return this.deviceMap[deviceType]?.resources?.source;
|
|
601
|
+
static getProtocolV2ResourceSource(release: IFirmwareReleaseInfo | undefined) {
|
|
602
|
+
return release?.resources?.source;
|
|
596
603
|
}
|
|
597
604
|
|
|
598
605
|
static getProtobufMessages(schema: ProtobufMessageSchema = 'v1CurrentSchema'): JSON {
|
|
@@ -69,7 +69,9 @@ export default class TransportManager {
|
|
|
69
69
|
} else if (env === 'desktop-web-ble') {
|
|
70
70
|
await this.transport.init(WebBleLogger, DevicePool.emitter);
|
|
71
71
|
} else if (env === 'webusb' || env === 'desktop-webusb') {
|
|
72
|
-
|
|
72
|
+
// The emitter is what turns a navigator.usb 'disconnect' into a
|
|
73
|
+
// DEVICE.DISCONNECT; without it WebUSB never reports device removal.
|
|
74
|
+
await this.transport.init(WebUsbLogger, DevicePool.emitter);
|
|
73
75
|
} else {
|
|
74
76
|
await this.transport.init(HttpLogger);
|
|
75
77
|
}
|