@onekeyfe/hd-core 1.2.0-alpha.30 → 1.2.0-alpha.32
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__/check-all-firmware-release-protocol-v2.test.ts +251 -0
- package/__tests__/connectSettings.test.ts +5 -47
- package/__tests__/device-state-mapper.test.ts +10 -1
- package/__tests__/firmware-update/firmware-update-v2-download-before-boot.test.ts +31 -59
- package/__tests__/networkUtils.test.ts +20 -0
- package/__tests__/open-wallet-session.test.ts +19 -5
- package/__tests__/protocol-v2-firmware-targets.test.ts +18 -0
- package/__tests__/protocol-v2.test.ts +58 -240
- package/__tests__/public-device-state-api.test.ts +10 -1
- package/dist/api/CheckAllFirmwareRelease.d.ts +24 -1
- package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV2.d.ts +0 -11
- package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV3.d.ts +3 -7
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +6 -22
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/OpenWalletSession.d.ts.map +1 -1
- package/dist/api/PromptWebDeviceAccess.d.ts.map +1 -1
- package/dist/api/device/DeviceUpdateBootloader.d.ts +1 -5
- package/dist/api/device/DeviceUpdateBootloader.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +0 -7
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
- package/dist/api/firmware/getBinary.d.ts +0 -7
- package/dist/api/firmware/getBinary.d.ts.map +1 -1
- package/dist/api/firmware/updateBootloader.d.ts +0 -2
- package/dist/api/firmware/updateBootloader.d.ts.map +1 -1
- package/dist/api/firmware/uploadFirmware.d.ts +1 -9
- package/dist/api/firmware/uploadFirmware.d.ts.map +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts +1 -1
- package/dist/data-manager/DataManager.d.ts +0 -1
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/data-manager/connectSettings.d.ts.map +1 -1
- package/dist/device/DeviceStateMapper.d.ts.map +1 -1
- package/dist/index.d.ts +43 -179
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1048 -2606
- package/dist/inject.d.ts.map +1 -1
- package/dist/lowLevelInject.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -1
- package/dist/topLevelInject.d.ts.map +1 -1
- package/dist/types/api/checkAllFirmwareRelease.d.ts +25 -7
- package/dist/types/api/checkAllFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/deviceUpdateBootloader.d.ts +0 -6
- package/dist/types/api/deviceUpdateBootloader.d.ts.map +1 -1
- package/dist/types/api/export.d.ts +2 -4
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +0 -69
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +3 -10
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/openWalletSession.d.ts +9 -3
- package/dist/types/api/openWalletSession.d.ts.map +1 -1
- package/dist/types/device.d.ts +6 -0
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/settings.d.ts +1 -13
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/networkUtils.d.ts +1 -0
- package/dist/utils/networkUtils.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/CheckAllFirmwareRelease.ts +368 -50
- package/src/api/FirmwareUpdateV2.ts +120 -298
- package/src/api/FirmwareUpdateV3.ts +56 -258
- package/src/api/FirmwareUpdateV4.ts +328 -765
- package/src/api/OpenWalletSession.ts +12 -8
- package/src/api/PromptWebDeviceAccess.ts +2 -6
- package/src/api/device/DeviceUpdateBootloader.ts +6 -122
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +0 -50
- package/src/api/firmware/updateBootloader.ts +4 -19
- package/src/api/firmware/uploadFirmware.ts +22 -140
- package/src/data/messages/messages-protocol-v2.json +4 -0
- package/src/data-manager/DataManager.ts +33 -33
- package/src/data-manager/connectSettings.ts +0 -11
- package/src/device/DeviceStateMapper.ts +6 -0
- package/src/index.ts +0 -5
- package/src/inject.ts +2 -22
- package/src/lowLevelInject.ts +1 -5
- package/src/protocols/protocol-v2/walletSession.ts +2 -1
- package/src/topLevelInject.ts +1 -5
- package/src/types/api/checkAllFirmwareRelease.ts +46 -7
- package/src/types/api/deviceUpdateBootloader.ts +0 -6
- package/src/types/api/export.ts +5 -18
- package/src/types/api/firmwareUpdate.ts +0 -76
- package/src/types/api/index.ts +6 -15
- package/src/types/api/openWalletSession.ts +12 -3
- package/src/types/device.ts +6 -0
- package/src/types/settings.ts +3 -13
- package/src/utils/networkUtils.ts +5 -3
- package/__tests__/firmware-update/check-all-firmware-release.test.ts +0 -174
- package/__tests__/firmware-update/firmware-artifact-source.test.ts +0 -119
- package/__tests__/firmware-update/firmware-host-binding.test.ts +0 -70
- package/__tests__/firmware-update/firmware-preparation-error.test.ts +0 -27
- package/__tests__/firmware-update/firmware-update-capabilities.test.ts +0 -13
- package/__tests__/firmware-update/firmware-update-plan.test.ts +0 -593
- package/__tests__/firmware-update/firmware-update-prepared-plan.test.ts +0 -213
- package/__tests__/firmware-update/firmware-upload-source.test.ts +0 -70
- package/dist/api/firmware/FirmwareArtifactSource.d.ts +0 -25
- package/dist/api/firmware/FirmwareArtifactSource.d.ts.map +0 -1
- package/dist/api/firmware/FirmwareHostBinding.d.ts +0 -6
- package/dist/api/firmware/FirmwareHostBinding.d.ts.map +0 -1
- package/dist/api/firmware/FirmwarePreparationError.d.ts +0 -3
- package/dist/api/firmware/FirmwarePreparationError.d.ts.map +0 -1
- package/dist/api/firmware/FirmwareUpdateCapabilities.d.ts +0 -3
- package/dist/api/firmware/FirmwareUpdateCapabilities.d.ts.map +0 -1
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts +0 -25
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts.map +0 -1
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts +0 -30
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts.map +0 -1
- package/dist/types/api/firmwareUpdateCapabilities.d.ts +0 -9
- package/dist/types/api/firmwareUpdateCapabilities.d.ts.map +0 -1
- package/dist/types/api/firmwareUpdatePlan.d.ts +0 -28
- package/dist/types/api/firmwareUpdatePlan.d.ts.map +0 -1
- package/dist/types/api/firmwareUpdatePreparedPlan.d.ts +0 -42
- package/dist/types/api/firmwareUpdatePreparedPlan.d.ts.map +0 -1
- package/src/api/firmware/FirmwareArtifactSource.ts +0 -278
- package/src/api/firmware/FirmwareHostBinding.ts +0 -100
- package/src/api/firmware/FirmwarePreparationError.ts +0 -12
- package/src/api/firmware/FirmwareUpdateCapabilities.ts +0 -9
- package/src/api/firmware/FirmwareUpdatePlan.ts +0 -745
- package/src/api/firmware/FirmwareUpdatePreparedPlan.ts +0 -392
- package/src/types/api/firmwareUpdateCapabilities.ts +0 -9
- package/src/types/api/firmwareUpdatePlan.ts +0 -38
- package/src/types/api/firmwareUpdatePreparedPlan.ts +0 -53
|
@@ -82,7 +82,6 @@ import {
|
|
|
82
82
|
getMethodVersionRange,
|
|
83
83
|
} from '../src/utils';
|
|
84
84
|
import { getDeviceFirmwareVersion } from '../src/utils/deviceVersionUtils';
|
|
85
|
-
import { openFirmwareByteSource } from '../src/api/firmware/FirmwareArtifactSource';
|
|
86
85
|
import {
|
|
87
86
|
getPassphraseState,
|
|
88
87
|
getPassphraseStateWithRefreshDeviceInfo,
|
|
@@ -948,7 +947,9 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
948
947
|
});
|
|
949
948
|
|
|
950
949
|
expect(promptPassphrase).toHaveBeenCalled();
|
|
951
|
-
expect(typedCall).toHaveBeenCalledWith('DeviceSessionAskPassphrase', 'Success', {
|
|
950
|
+
expect(typedCall).toHaveBeenCalledWith('DeviceSessionAskPassphrase', 'Success', {
|
|
951
|
+
on_device: true,
|
|
952
|
+
});
|
|
952
953
|
expect(typedCall).toHaveBeenCalledWith('DeviceSessionGet', 'DeviceSession', {});
|
|
953
954
|
});
|
|
954
955
|
|
|
@@ -1163,7 +1164,7 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
1163
1164
|
});
|
|
1164
1165
|
expect(typedCall.mock.calls).toEqual([
|
|
1165
1166
|
['ProtocolInfoRequest', 'ProtocolInfo', { eventless_wallet_session: true }],
|
|
1166
|
-
['DeviceSessionAskPassphrase', 'Success', {}],
|
|
1167
|
+
['DeviceSessionAskPassphrase', 'Success', { on_device: true }],
|
|
1167
1168
|
]);
|
|
1168
1169
|
});
|
|
1169
1170
|
|
|
@@ -1420,6 +1421,7 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
1420
1421
|
expect(promptPassphrase).toHaveBeenCalledWith(
|
|
1421
1422
|
{
|
|
1422
1423
|
existsAttachPinUser: false,
|
|
1424
|
+
deviceOnly: true,
|
|
1423
1425
|
source: 'wallet-session-coordinator',
|
|
1424
1426
|
reason: 'open-wallet',
|
|
1425
1427
|
},
|
|
@@ -1741,7 +1743,9 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
1741
1743
|
);
|
|
1742
1744
|
|
|
1743
1745
|
expect(device.getInternalState()).toBeUndefined();
|
|
1744
|
-
expect(typedCall).toHaveBeenNthCalledWith(2, 'DeviceSessionAskPassphrase', 'Success', {
|
|
1746
|
+
expect(typedCall).toHaveBeenNthCalledWith(2, 'DeviceSessionAskPassphrase', 'Success', {
|
|
1747
|
+
on_device: true,
|
|
1748
|
+
});
|
|
1745
1749
|
});
|
|
1746
1750
|
|
|
1747
1751
|
test('useEmptyPassphrase ignores a stale hidden-wallet state during Protocol V2 safety check', async () => {
|
|
@@ -2948,7 +2952,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
2948
2952
|
});
|
|
2949
2953
|
});
|
|
2950
2954
|
|
|
2951
|
-
test('
|
|
2955
|
+
test('enters Protocol V2 bootloader before upload', async () => {
|
|
2952
2956
|
const method = new FirmwareUpdateV4({
|
|
2953
2957
|
id: 1,
|
|
2954
2958
|
payload: {
|
|
@@ -2983,7 +2987,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
2983
2987
|
|
|
2984
2988
|
await method.run();
|
|
2985
2989
|
|
|
2986
|
-
expect((method as any).enterProtocolV2BootloaderMode).
|
|
2990
|
+
expect((method as any).enterProtocolV2BootloaderMode).toHaveBeenCalledTimes(1);
|
|
2987
2991
|
expect((method as any).executeProtocolV2Update).toHaveBeenCalledWith({
|
|
2988
2992
|
fwBinaryMap: [
|
|
2989
2993
|
{
|
|
@@ -3302,9 +3306,9 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3302
3306
|
const typedCall = jest
|
|
3303
3307
|
.fn()
|
|
3304
3308
|
.mockRejectedValue(
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3309
|
+
new DOMException(
|
|
3310
|
+
"Failed to execute 'open' on 'USBDevice': The device was disconnected",
|
|
3311
|
+
'NotFoundError'
|
|
3308
3312
|
)
|
|
3309
3313
|
);
|
|
3310
3314
|
|
|
@@ -3392,7 +3396,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3392
3396
|
expect(method.postProgressMessage).toHaveBeenCalledWith(100, 'installingFirmware');
|
|
3393
3397
|
});
|
|
3394
3398
|
|
|
3395
|
-
test('
|
|
3399
|
+
test('accepts a missing firmware status handler as an app reboot signal', async () => {
|
|
3396
3400
|
const method = new FirmwareUpdateV4({
|
|
3397
3401
|
id: 1,
|
|
3398
3402
|
payload: {
|
|
@@ -3411,88 +3415,12 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3411
3415
|
(method as any).verifyProtocolV2ReconnectIdentity = jest.fn().mockResolvedValue(undefined);
|
|
3412
3416
|
method.postProgressMessage = jest.fn();
|
|
3413
3417
|
|
|
3414
|
-
await
|
|
3415
|
-
|
|
3416
|
-
{ target_id: 4, path: 'vol0:/application_p1.bin' },
|
|
3417
|
-
])
|
|
3418
|
-
).rejects.toThrow('Protocol V2 firmware install status is unavailable');
|
|
3419
|
-
|
|
3420
|
-
expect(reconnectProtocolV2Device).toHaveBeenCalledTimes(1);
|
|
3421
|
-
expect(typedCall.mock.calls.map(call => call[0])).toEqual([
|
|
3422
|
-
'DeviceFirmwareUpdateStatusGet',
|
|
3423
|
-
'DeviceInfoGet',
|
|
3418
|
+
await (method as any).waitForProtocolV2FirmwareUpdateComplete([
|
|
3419
|
+
{ target_id: 4, path: 'vol0:/application_p1.bin' },
|
|
3424
3420
|
]);
|
|
3425
|
-
});
|
|
3426
|
-
|
|
3427
|
-
test('rejects a finished target whose payload version conflicts with the plan', () => {
|
|
3428
|
-
const method = new FirmwareUpdateV4({
|
|
3429
|
-
id: 1,
|
|
3430
|
-
payload: {
|
|
3431
|
-
method: 'firmwareUpdateV4',
|
|
3432
|
-
platform: 'desktop',
|
|
3433
|
-
expectedTargetVersions: {
|
|
3434
|
-
app_v1: '2.0.0',
|
|
3435
|
-
},
|
|
3436
|
-
},
|
|
3437
|
-
});
|
|
3438
|
-
method.init();
|
|
3439
|
-
method.postProgressMessage = jest.fn();
|
|
3440
|
-
|
|
3441
|
-
expect(() =>
|
|
3442
|
-
(method as any).assertProtocolV2TargetStatus(
|
|
3443
|
-
[{ target_id: 4, status: 2, payload_version: 0x010000 }],
|
|
3444
|
-
new Set([4])
|
|
3445
|
-
)
|
|
3446
|
-
).toThrow('expected 131072');
|
|
3447
|
-
});
|
|
3448
|
-
|
|
3449
|
-
test('does not fail a completed multi-app install when final app versions are unobservable', () => {
|
|
3450
|
-
const method = new FirmwareUpdateV4({
|
|
3451
|
-
id: 1,
|
|
3452
|
-
payload: {
|
|
3453
|
-
method: 'firmwareUpdateV4',
|
|
3454
|
-
platform: 'desktop',
|
|
3455
|
-
targetsToUpdate: ['app_v1', 'app_v2'],
|
|
3456
|
-
expectedTargetVersions: {
|
|
3457
|
-
app_v1: '1.0.0',
|
|
3458
|
-
app_v2: '2.0.0',
|
|
3459
|
-
},
|
|
3460
|
-
},
|
|
3461
|
-
});
|
|
3462
|
-
method.init();
|
|
3463
|
-
(method as any).protocolV2LatestFinalFeatures = {
|
|
3464
|
-
major_version: 3,
|
|
3465
|
-
minor_version: 0,
|
|
3466
|
-
patch_version: 0,
|
|
3467
|
-
};
|
|
3468
|
-
(method as any).protocolV2FinalStatusVerified = true;
|
|
3469
|
-
|
|
3470
|
-
expect(() => (method as any).assertExpectedProtocolV2Versions()).not.toThrow();
|
|
3471
|
-
});
|
|
3472
3421
|
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
id: 1,
|
|
3476
|
-
payload: {
|
|
3477
|
-
method: 'firmwareUpdateV4',
|
|
3478
|
-
platform: 'desktop',
|
|
3479
|
-
targetsToUpdate: ['app_v1', 'app_v2'],
|
|
3480
|
-
expectedTargetVersions: {
|
|
3481
|
-
app_v1: '1.0.0',
|
|
3482
|
-
app_v2: '2.0.0',
|
|
3483
|
-
},
|
|
3484
|
-
},
|
|
3485
|
-
});
|
|
3486
|
-
method.init();
|
|
3487
|
-
(method as any).protocolV2LatestFinalFeatures = {
|
|
3488
|
-
major_version: 3,
|
|
3489
|
-
minor_version: 0,
|
|
3490
|
-
patch_version: 0,
|
|
3491
|
-
};
|
|
3492
|
-
|
|
3493
|
-
expect(() => (method as any).assertExpectedProtocolV2Versions()).toThrow(
|
|
3494
|
-
'has no observable final version after status fallback'
|
|
3495
|
-
);
|
|
3422
|
+
expect(reconnectProtocolV2Device).toHaveBeenCalledTimes(1);
|
|
3423
|
+
expect(typedCall.mock.calls.map(call => call[0])).toEqual(['DeviceFirmwareUpdateStatusGet']);
|
|
3496
3424
|
});
|
|
3497
3425
|
|
|
3498
3426
|
test('polls target status after update ACK and finishes when all targets complete', async () => {
|
|
@@ -3671,14 +3599,10 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3671
3599
|
const writtenPaths: string[] = [];
|
|
3672
3600
|
method.postTipMessage = jest.fn();
|
|
3673
3601
|
method.postProgressMessage = jest.fn();
|
|
3674
|
-
(method as any).
|
|
3602
|
+
(method as any).protocolV2CommonUpdateProcess = jest.fn().mockImplementation(params => {
|
|
3675
3603
|
writtenPaths.push(params.filePath);
|
|
3676
|
-
return Number(params.processedSize ?? 0) + Number(params.
|
|
3604
|
+
return Number(params.processedSize ?? 0) + Number(params.payload.byteLength);
|
|
3677
3605
|
});
|
|
3678
|
-
(method as any).enterProtocolV2BootloaderMode = jest.fn().mockResolvedValue(undefined);
|
|
3679
|
-
(method as any).exitProtocolV2BootloaderToNormal = jest.fn().mockResolvedValue(undefined);
|
|
3680
|
-
(method as any).waitForProtocolV2FinalFeatures = jest.fn().mockResolvedValue({});
|
|
3681
|
-
(method as any).completeProtocolV2FinalVerification = jest.fn().mockResolvedValue({});
|
|
3682
3606
|
(method as any).verifyProtocolV2StagedFile = jest.fn().mockResolvedValue(undefined);
|
|
3683
3607
|
(method as any).protocolV2StartFirmwareUpdate = jest.fn().mockResolvedValue(undefined);
|
|
3684
3608
|
(method as any).waitForProtocolV2FirmwareUpdateComplete = jest
|
|
@@ -3718,12 +3642,10 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3718
3642
|
'vol0:/coprocessor.bin',
|
|
3719
3643
|
1
|
|
3720
3644
|
);
|
|
3721
|
-
expect((method as any).protocolV2StartFirmwareUpdate).toHaveBeenCalledTimes(
|
|
3722
|
-
expect((method as any).protocolV2StartFirmwareUpdate).
|
|
3723
|
-
targets: [{ target_id: 3, path: 'vol0:/bootloader.bin' }],
|
|
3724
|
-
});
|
|
3725
|
-
expect((method as any).protocolV2StartFirmwareUpdate).toHaveBeenNthCalledWith(2, {
|
|
3645
|
+
expect((method as any).protocolV2StartFirmwareUpdate).toHaveBeenCalledTimes(1);
|
|
3646
|
+
expect((method as any).protocolV2StartFirmwareUpdate).toHaveBeenCalledWith({
|
|
3726
3647
|
targets: [
|
|
3648
|
+
{ target_id: 3, path: 'vol0:/bootloader.bin' },
|
|
3727
3649
|
{ target_id: 6, path: 'vol0:/coprocessor.bin' },
|
|
3728
3650
|
{ target_id: 7, path: 'vol0:/se01.bin' },
|
|
3729
3651
|
{ target_id: 4, path: 'vol0:/application_p1.bin' },
|
|
@@ -3733,7 +3655,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3733
3655
|
expect((method as any).waitForProtocolV2FirmwareUpdateComplete).toHaveBeenCalled();
|
|
3734
3656
|
});
|
|
3735
3657
|
|
|
3736
|
-
test('announces
|
|
3658
|
+
test('announces one transfer when syncing resource bundles and staging firmware', async () => {
|
|
3737
3659
|
const method = new FirmwareUpdateV4({
|
|
3738
3660
|
id: 1,
|
|
3739
3661
|
payload: {
|
|
@@ -3743,14 +3665,11 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3743
3665
|
|
|
3744
3666
|
method.postTipMessage = jest.fn();
|
|
3745
3667
|
method.postProgressMessage = jest.fn();
|
|
3746
|
-
(method as any).
|
|
3668
|
+
(method as any).protocolV2CommonUpdateProcess = jest
|
|
3747
3669
|
.fn()
|
|
3748
3670
|
.mockImplementation(params =>
|
|
3749
|
-
Promise.resolve(Number(params.processedSize ?? 0) + Number(params.
|
|
3671
|
+
Promise.resolve(Number(params.processedSize ?? 0) + Number(params.payload.byteLength))
|
|
3750
3672
|
);
|
|
3751
|
-
(method as any).enterProtocolV2BootloaderMode = jest.fn().mockResolvedValue(undefined);
|
|
3752
|
-
(method as any).exitProtocolV2BootloaderToNormal = jest.fn().mockResolvedValue(undefined);
|
|
3753
|
-
(method as any).completeProtocolV2FinalVerification = jest.fn().mockResolvedValue({});
|
|
3754
3673
|
(method as any).verifyProtocolV2StagedFile = jest.fn().mockResolvedValue(undefined);
|
|
3755
3674
|
(method as any).protocolV2StartFirmwareUpdate = jest.fn().mockResolvedValue(undefined);
|
|
3756
3675
|
(method as any).waitForProtocolV2FirmwareUpdateComplete = jest
|
|
@@ -3770,22 +3689,21 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3770
3689
|
{
|
|
3771
3690
|
fileName: 'application_p1.bin',
|
|
3772
3691
|
binary: new Uint8Array([3]).buffer,
|
|
3773
|
-
targetId:
|
|
3692
|
+
targetId: 3,
|
|
3774
3693
|
},
|
|
3775
3694
|
],
|
|
3776
3695
|
});
|
|
3777
3696
|
|
|
3778
|
-
expect(method.postTipMessage).toHaveBeenCalledTimes(
|
|
3697
|
+
expect(method.postTipMessage).toHaveBeenCalledTimes(2);
|
|
3779
3698
|
expect(method.postTipMessage).toHaveBeenNthCalledWith(1, 'StartTransferData');
|
|
3780
|
-
expect(method.postTipMessage).toHaveBeenNthCalledWith(2, '
|
|
3781
|
-
expect(method.
|
|
3782
|
-
expect((method as any).protocolV2SourceUpdateProcess).toHaveBeenNthCalledWith(
|
|
3699
|
+
expect(method.postTipMessage).toHaveBeenNthCalledWith(2, 'ConfirmOnDevice');
|
|
3700
|
+
expect((method as any).protocolV2CommonUpdateProcess).toHaveBeenNthCalledWith(
|
|
3783
3701
|
1,
|
|
3784
|
-
expect.objectContaining({ processedSize: 0, totalSize:
|
|
3702
|
+
expect.objectContaining({ processedSize: 0, totalSize: 3 })
|
|
3785
3703
|
);
|
|
3786
|
-
expect((method as any).
|
|
3704
|
+
expect((method as any).protocolV2CommonUpdateProcess).toHaveBeenNthCalledWith(
|
|
3787
3705
|
2,
|
|
3788
|
-
expect.objectContaining({ processedSize:
|
|
3706
|
+
expect.objectContaining({ processedSize: 2, totalSize: 3 })
|
|
3789
3707
|
);
|
|
3790
3708
|
});
|
|
3791
3709
|
|
|
@@ -3799,8 +3717,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3799
3717
|
|
|
3800
3718
|
method.postTipMessage = jest.fn();
|
|
3801
3719
|
method.postProgressMessage = jest.fn();
|
|
3802
|
-
(method as any).
|
|
3803
|
-
(method as any).enterProtocolV2BootloaderMode = jest.fn().mockResolvedValue(undefined);
|
|
3720
|
+
(method as any).protocolV2CommonUpdateProcess = jest.fn().mockResolvedValue(3);
|
|
3804
3721
|
(method as any).device = stubDevice({
|
|
3805
3722
|
getCommands: () => ({
|
|
3806
3723
|
typedCall: jest.fn().mockResolvedValue({
|
|
@@ -3846,14 +3763,11 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3846
3763
|
|
|
3847
3764
|
method.postTipMessage = jest.fn();
|
|
3848
3765
|
method.postProgressMessage = jest.fn();
|
|
3849
|
-
(method as any).
|
|
3766
|
+
(method as any).protocolV2CommonUpdateProcess = jest
|
|
3850
3767
|
.fn()
|
|
3851
3768
|
.mockImplementation(params =>
|
|
3852
|
-
Promise.resolve(Number(params.processedSize ?? 0) + Number(params.
|
|
3769
|
+
Promise.resolve(Number(params.processedSize ?? 0) + Number(params.payload.byteLength))
|
|
3853
3770
|
);
|
|
3854
|
-
(method as any).enterProtocolV2BootloaderMode = jest.fn().mockResolvedValue(undefined);
|
|
3855
|
-
(method as any).exitProtocolV2BootloaderToNormal = jest.fn().mockResolvedValue(undefined);
|
|
3856
|
-
(method as any).completeProtocolV2FinalVerification = jest.fn().mockResolvedValue({});
|
|
3857
3771
|
(method as any).verifyProtocolV2StagedFile = jest.fn().mockResolvedValue(undefined);
|
|
3858
3772
|
(method as any).protocolV2StartFirmwareUpdate = jest.fn().mockResolvedValue(undefined);
|
|
3859
3773
|
(method as any).waitForProtocolV2FirmwareUpdateComplete = jest
|
|
@@ -4120,58 +4034,6 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4120
4034
|
getFirmwareLatestReleaseSpy.mockRestore();
|
|
4121
4035
|
});
|
|
4122
4036
|
|
|
4123
|
-
test('rejects prepared RESC bundle paths before opening an artifact source', async () => {
|
|
4124
|
-
const method = new FirmwareUpdateV4({
|
|
4125
|
-
id: 1,
|
|
4126
|
-
payload: {
|
|
4127
|
-
method: 'firmwareUpdateV4',
|
|
4128
|
-
},
|
|
4129
|
-
});
|
|
4130
|
-
const openPreparedSource = jest.fn();
|
|
4131
|
-
(method as any).params = {
|
|
4132
|
-
targetsToUpdate: ['resource'],
|
|
4133
|
-
resourceBundleArtifacts: [
|
|
4134
|
-
{
|
|
4135
|
-
name: 'images',
|
|
4136
|
-
artifact: {
|
|
4137
|
-
artifactRef: `fw:${'a'.repeat(64)}`,
|
|
4138
|
-
size: 1,
|
|
4139
|
-
sha256: 'a'.repeat(64),
|
|
4140
|
-
},
|
|
4141
|
-
},
|
|
4142
|
-
],
|
|
4143
|
-
};
|
|
4144
|
-
(method as any).openProtocolV2PreparedSource = openPreparedSource;
|
|
4145
|
-
const getFirmwareLatestReleaseSpy = jest
|
|
4146
|
-
.spyOn(DataManager, 'getFirmwareLatestRelease')
|
|
4147
|
-
.mockReturnValue({
|
|
4148
|
-
required: false,
|
|
4149
|
-
version: [1, 0, 0],
|
|
4150
|
-
url: '',
|
|
4151
|
-
resourceBundles: [
|
|
4152
|
-
{
|
|
4153
|
-
name: 'images',
|
|
4154
|
-
url: 'https://example.com/images.okpkg',
|
|
4155
|
-
devicePath: 'vol0:/resource/../images.okpkg',
|
|
4156
|
-
},
|
|
4157
|
-
],
|
|
4158
|
-
fingerprint: '',
|
|
4159
|
-
changelog: {
|
|
4160
|
-
'zh-CN': '',
|
|
4161
|
-
'en-US': '',
|
|
4162
|
-
},
|
|
4163
|
-
});
|
|
4164
|
-
|
|
4165
|
-
await expect(
|
|
4166
|
-
(method as any).prepareProtocolV2ResourceSources('universal', {
|
|
4167
|
-
deviceType: 'pro2',
|
|
4168
|
-
})
|
|
4169
|
-
).rejects.toThrow('resourceBundles[].devicePath');
|
|
4170
|
-
expect(openPreparedSource).not.toHaveBeenCalled();
|
|
4171
|
-
|
|
4172
|
-
getFirmwareLatestReleaseSpy.mockRestore();
|
|
4173
|
-
});
|
|
4174
|
-
|
|
4175
4037
|
test('downloads and validates remote RESC bundles before entering bootloader', async () => {
|
|
4176
4038
|
const method = new FirmwareUpdateV4({
|
|
4177
4039
|
id: 1,
|
|
@@ -4224,9 +4086,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4224
4086
|
order.push('bootloader');
|
|
4225
4087
|
return Promise.resolve(true);
|
|
4226
4088
|
});
|
|
4227
|
-
|
|
4228
|
-
(method as any).executeProtocolV2TransferPhase = jest.fn().mockResolvedValue(undefined);
|
|
4229
|
-
(method as any).completeProtocolV2FinalVerification = jest.fn().mockResolvedValue(undefined);
|
|
4089
|
+
(method as any).executeProtocolV2Update = jest.fn().mockResolvedValue(undefined);
|
|
4230
4090
|
(method as any).exitProtocolV2BootloaderToNormal = jest.fn().mockResolvedValue(undefined);
|
|
4231
4091
|
(method as any).waitForProtocolV2FinalFeatures = jest.fn().mockResolvedValue({
|
|
4232
4092
|
bootloaderVersion: '1.0.0',
|
|
@@ -4238,7 +4098,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4238
4098
|
await method.run();
|
|
4239
4099
|
|
|
4240
4100
|
expect(order).toEqual(['download', 'bootloader']);
|
|
4241
|
-
expect(
|
|
4101
|
+
expect((method as any).executeProtocolV2Update).toHaveBeenCalledWith({
|
|
4242
4102
|
bootloaderBinary: null,
|
|
4243
4103
|
fwBinaryMap: [],
|
|
4244
4104
|
resourceBundles: [
|
|
@@ -4251,7 +4111,6 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4251
4111
|
],
|
|
4252
4112
|
});
|
|
4253
4113
|
|
|
4254
|
-
executeProtocolV2UpdateSpy.mockRestore();
|
|
4255
4114
|
getSysResourceBinarySpy.mockRestore();
|
|
4256
4115
|
getFirmwareLatestReleaseSpy.mockRestore();
|
|
4257
4116
|
});
|
|
@@ -4540,10 +4399,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4540
4399
|
|
|
4541
4400
|
method.postTipMessage = jest.fn();
|
|
4542
4401
|
method.postProgressMessage = jest.fn();
|
|
4543
|
-
(method as any).
|
|
4544
|
-
(method as any).enterProtocolV2BootloaderMode = jest.fn().mockResolvedValue(undefined);
|
|
4545
|
-
(method as any).completeProtocolV2FinalVerification = jest.fn().mockResolvedValue({});
|
|
4546
|
-
(method as any).verifyProtocolV2StagedFile = jest.fn().mockResolvedValue(undefined);
|
|
4402
|
+
(method as any).protocolV2CommonUpdateProcess = jest.fn().mockResolvedValue(3);
|
|
4547
4403
|
(method as any).protocolV2StartFirmwareUpdate = jest.fn();
|
|
4548
4404
|
(method as any).waitForProtocolV2FirmwareUpdateComplete = jest.fn();
|
|
4549
4405
|
|
|
@@ -4559,7 +4415,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4559
4415
|
fwBinaryMap: [],
|
|
4560
4416
|
});
|
|
4561
4417
|
|
|
4562
|
-
expect((method as any).
|
|
4418
|
+
expect((method as any).protocolV2CommonUpdateProcess).toHaveBeenCalledTimes(1);
|
|
4563
4419
|
expect((method as any).protocolV2StartFirmwareUpdate).not.toHaveBeenCalled();
|
|
4564
4420
|
expect((method as any).waitForProtocolV2FirmwareUpdateComplete).not.toHaveBeenCalled();
|
|
4565
4421
|
});
|
|
@@ -4590,19 +4446,12 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4590
4446
|
});
|
|
4591
4447
|
method.postProgressMessage = jest.fn();
|
|
4592
4448
|
|
|
4593
|
-
|
|
4594
|
-
|
|
4449
|
+
await (method as any).protocolV2CommonUpdateProcess({
|
|
4450
|
+
payload: new Uint8Array(4097).buffer,
|
|
4451
|
+
filePath: 'vol1:firmware.bin',
|
|
4452
|
+
processedSize: 0,
|
|
4453
|
+
totalSize: 4097,
|
|
4595
4454
|
});
|
|
4596
|
-
try {
|
|
4597
|
-
await (method as any).protocolV2SourceUpdateProcess({
|
|
4598
|
-
source,
|
|
4599
|
-
filePath: 'vol1:firmware.bin',
|
|
4600
|
-
processedSize: 0,
|
|
4601
|
-
totalSize: 4097,
|
|
4602
|
-
});
|
|
4603
|
-
} finally {
|
|
4604
|
-
await source?.close();
|
|
4605
|
-
}
|
|
4606
4455
|
|
|
4607
4456
|
const writePayloads = typedCall.mock.calls.map(call => call[2]);
|
|
4608
4457
|
expect(writePayloads.map(payload => payload.file.offset)).toEqual([0, 4000]);
|
|
@@ -4653,16 +4502,12 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4653
4502
|
method.postProgressMessage = jest.fn();
|
|
4654
4503
|
|
|
4655
4504
|
try {
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
});
|
|
4659
|
-
await (method as any).protocolV2SourceUpdateProcess({
|
|
4660
|
-
source,
|
|
4505
|
+
await (method as any).protocolV2CommonUpdateProcess({
|
|
4506
|
+
payload: new Uint8Array(8001).buffer,
|
|
4661
4507
|
filePath: 'vol0:/firmware.bin',
|
|
4662
4508
|
processedSize: 0,
|
|
4663
4509
|
totalSize: 8001,
|
|
4664
4510
|
});
|
|
4665
|
-
await source?.close();
|
|
4666
4511
|
} finally {
|
|
4667
4512
|
setTimeoutSpy.mockRestore();
|
|
4668
4513
|
}
|
|
@@ -4694,21 +4539,16 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4694
4539
|
});
|
|
4695
4540
|
method.postProgressMessage = jest.fn();
|
|
4696
4541
|
method.postTipMessage = jest.fn();
|
|
4697
|
-
(method as any).recoverProtocolV2FileTransfer = jest.fn().mockResolvedValue(undefined);
|
|
4698
4542
|
|
|
4699
|
-
const source = await openFirmwareByteSource({
|
|
4700
|
-
binary: new Uint8Array(4097).buffer,
|
|
4701
|
-
});
|
|
4702
4543
|
await expect(
|
|
4703
|
-
(method as any).
|
|
4704
|
-
|
|
4544
|
+
(method as any).protocolV2WriteWholeFile({
|
|
4545
|
+
payload: new Uint8Array(4097).buffer,
|
|
4705
4546
|
filePath: 'vol0:/firmware.bin',
|
|
4706
4547
|
processedSize: 0,
|
|
4707
4548
|
totalSize: 4097,
|
|
4708
4549
|
})
|
|
4709
4550
|
).rejects.toMatchObject({ errorCode: HardwareErrorCode.EmmcFileWriteFirmwareError });
|
|
4710
|
-
|
|
4711
|
-
expect(typedCall).toHaveBeenCalledTimes(6);
|
|
4551
|
+
expect(typedCall).toHaveBeenCalledTimes(2);
|
|
4712
4552
|
});
|
|
4713
4553
|
|
|
4714
4554
|
test('caps native BLE firmware upload chunks below the WebUSB limit', async () => {
|
|
@@ -4741,19 +4581,12 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4741
4581
|
});
|
|
4742
4582
|
method.postProgressMessage = jest.fn();
|
|
4743
4583
|
|
|
4744
|
-
|
|
4745
|
-
|
|
4584
|
+
await (method as any).protocolV2CommonUpdateProcess({
|
|
4585
|
+
payload: new Uint8Array(1801).buffer,
|
|
4586
|
+
filePath: 'vol1:ble-firmware.bin',
|
|
4587
|
+
processedSize: 0,
|
|
4588
|
+
totalSize: 1801,
|
|
4746
4589
|
});
|
|
4747
|
-
try {
|
|
4748
|
-
await (method as any).protocolV2SourceUpdateProcess({
|
|
4749
|
-
source,
|
|
4750
|
-
filePath: 'vol1:ble-firmware.bin',
|
|
4751
|
-
processedSize: 0,
|
|
4752
|
-
totalSize: 1801,
|
|
4753
|
-
});
|
|
4754
|
-
} finally {
|
|
4755
|
-
await source?.close();
|
|
4756
|
-
}
|
|
4757
4590
|
|
|
4758
4591
|
const writePayloads = typedCall.mock.calls.map(call => call[2]);
|
|
4759
4592
|
expect(writePayloads.map(payload => payload.file.offset)).toEqual([0, 1800]);
|
|
@@ -4870,9 +4703,9 @@ describe('Protocol V2 firmware update method', () => {
|
|
|
4870
4703
|
const typedCall = jest
|
|
4871
4704
|
.fn()
|
|
4872
4705
|
.mockRejectedValue(
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4706
|
+
new DOMException(
|
|
4707
|
+
"Failed to execute 'open' on 'USBDevice': The device was disconnected",
|
|
4708
|
+
'NotFoundError'
|
|
4876
4709
|
)
|
|
4877
4710
|
);
|
|
4878
4711
|
|
|
@@ -5037,21 +4870,6 @@ describe('Protocol V2 firmware update method', () => {
|
|
|
5037
4870
|
});
|
|
5038
4871
|
|
|
5039
4872
|
describe('Protocol V2 firmware reconnect identity', () => {
|
|
5040
|
-
test('keeps the host plan identity as the V4 reconnect anchor', () => {
|
|
5041
|
-
const method = new FirmwareUpdateV4({
|
|
5042
|
-
id: 1,
|
|
5043
|
-
payload: {
|
|
5044
|
-
method: 'firmwareUpdateV4',
|
|
5045
|
-
platform: 'native',
|
|
5046
|
-
expectedDeviceId: 'persisted-device-id',
|
|
5047
|
-
},
|
|
5048
|
-
});
|
|
5049
|
-
|
|
5050
|
-
method.init();
|
|
5051
|
-
|
|
5052
|
-
expect((method as any).params.expectedDeviceId).toBe('persisted-device-id');
|
|
5053
|
-
});
|
|
5054
|
-
|
|
5055
4873
|
test('rejects a different physical serial before firmware transfer resumes', () => {
|
|
5056
4874
|
expect(() => assertProtocolV2ReconnectIdentity('expected-serial', 'other-serial')).toThrow(
|
|
5057
4875
|
'identity mismatch'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EFirmwareType, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
2
2
|
|
|
3
3
|
import * as publicMethods from '../src/api';
|
|
4
|
+
import * as publicTypes from '../src/types';
|
|
4
5
|
import GetFeatures from '../src/api/GetFeatures';
|
|
5
6
|
import GetOnekeyFeatures from '../src/api/GetOnekeyFeatures';
|
|
6
7
|
import DeviceInfoGet from '../src/api/protocol-v2/DeviceInfoGet';
|
|
@@ -17,6 +18,14 @@ jest.mock('../src/data/config', () => ({
|
|
|
17
18
|
}));
|
|
18
19
|
|
|
19
20
|
describe('public device state API boundary', () => {
|
|
21
|
+
test('exports canonical wallet session modes', () => {
|
|
22
|
+
expect((publicTypes as Record<string, unknown>).OpenWalletSessionMode).toEqual({
|
|
23
|
+
Standard: 'standard',
|
|
24
|
+
SelectHidden: 'select-hidden',
|
|
25
|
+
ResumeHidden: 'resume-hidden',
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
20
29
|
test('exposes canonical device state operations without raw settings methods', () => {
|
|
21
30
|
const api = createCoreApi(jest.fn() as CoreApi['call']) as Record<string, unknown>;
|
|
22
31
|
|
|
@@ -74,7 +83,7 @@ describe('public device state API boundary', () => {
|
|
|
74
83
|
useEmptyPassphrase: false,
|
|
75
84
|
});
|
|
76
85
|
await api.openWalletSession('device-2', {
|
|
77
|
-
mode:
|
|
86
|
+
mode: publicTypes.OpenWalletSessionMode.ResumeHidden,
|
|
78
87
|
deviceId: 'wallet-device-1',
|
|
79
88
|
passphraseState: 'wallet-state-1',
|
|
80
89
|
});
|
|
@@ -1,7 +1,30 @@
|
|
|
1
|
+
import { EFirmwareType } from '@onekeyfe/hd-shared';
|
|
1
2
|
import { BaseMethod } from './BaseMethod';
|
|
2
|
-
import type { AllFirmwareRelease } from '../types/api/checkAllFirmwareRelease';
|
|
3
|
+
import type { AllFirmwareRelease, ProtocolV2FirmwareComponentRelease, ProtocolV2FirmwareReleaseStatus } from '../types/api/checkAllFirmwareRelease';
|
|
4
|
+
import type { FirmwareUpdateV4Target } from '../types/api/firmwareUpdate';
|
|
5
|
+
import type { DeviceFeaturesVerify, DeviceStateVersions, IFirmwareReleaseInfo } from '../types';
|
|
6
|
+
type ProtocolV2FirmwareReleasePlan = {
|
|
7
|
+
firmwareType: EFirmwareType;
|
|
8
|
+
status: ProtocolV2FirmwareReleaseStatus;
|
|
9
|
+
hasUpgrade: boolean;
|
|
10
|
+
required: boolean;
|
|
11
|
+
currentVersions: DeviceStateVersions;
|
|
12
|
+
components: ProtocolV2FirmwareComponentRelease[];
|
|
13
|
+
targetsToUpdate: FirmwareUpdateV4Target[];
|
|
14
|
+
release: IFirmwareReleaseInfo | undefined;
|
|
15
|
+
};
|
|
16
|
+
export declare function buildProtocolV2FirmwareRelease({ currentVersions, currentVerification, remotePayloadHashes, firmwareType, release, }: {
|
|
17
|
+
currentVersions: DeviceStateVersions;
|
|
18
|
+
currentVerification?: Partial<DeviceFeaturesVerify>;
|
|
19
|
+
remotePayloadHashes?: Readonly<Record<string, string | null>>;
|
|
20
|
+
firmwareType: EFirmwareType;
|
|
21
|
+
release: IFirmwareReleaseInfo | undefined;
|
|
22
|
+
}): ProtocolV2FirmwareReleasePlan;
|
|
3
23
|
export default class CheckAllFirmwareRelease extends BaseMethod {
|
|
24
|
+
getSupportedProtocols(): readonly ["V1", "V2"];
|
|
4
25
|
init(): void;
|
|
5
26
|
run(): Promise<AllFirmwareRelease | null>;
|
|
27
|
+
private runProtocolV2;
|
|
6
28
|
}
|
|
29
|
+
export {};
|
|
7
30
|
//# sourceMappingURL=CheckAllFirmwareRelease.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckAllFirmwareRelease.d.ts","sourceRoot":"","sources":["../../src/api/CheckAllFirmwareRelease.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CheckAllFirmwareRelease.d.ts","sourceRoot":"","sources":["../../src/api/CheckAllFirmwareRelease.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA6B,MAAM,qBAAqB,CAAC;AAa/E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,KAAK,EACV,kBAAkB,EAElB,kCAAkC,EAClC,+BAA+B,EAChC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EAGrB,MAAM,UAAU,CAAC;AAmKlB,KAAK,6BAA6B,GAAG;IACnC,YAAY,EAAE,aAAa,CAAC;IAC5B,MAAM,EAAE,+BAA+B,CAAC;IACxC,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,mBAAmB,CAAC;IACrC,UAAU,EAAE,kCAAkC,EAAE,CAAC;IACjD,eAAe,EAAE,sBAAsB,EAAE,CAAC;IAC1C,OAAO,EAAE,oBAAoB,GAAG,SAAS,CAAC;CAC3C,CAAC;AAEF,wBAAgB,8BAA8B,CAAC,EAC7C,eAAe,EACf,mBAAwB,EACxB,mBAAwB,EACxB,YAAY,EACZ,OAAO,GACR,EAAE;IACD,eAAe,EAAE,mBAAmB,CAAC;IACrC,mBAAmB,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACpD,mBAAmB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IAC9D,YAAY,EAAE,aAAa,CAAC;IAC5B,OAAO,EAAE,oBAAoB,GAAG,SAAS,CAAC;CAC3C,GAAG,6BAA6B,CAuEhC;AAED,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,UAAU;IAC7D,qBAAqB;IAIrB,IAAI;IAME,GAAG;YAuDK,aAAa;CAoF5B"}
|
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
import { type Deferred, type EFirmwareType } from '@onekeyfe/hd-shared';
|
|
2
2
|
import { BaseMethod } from './BaseMethod';
|
|
3
3
|
import type { Features } from '../types';
|
|
4
|
-
import type { FirmwareArtifactReader, FirmwareArtifactReference } from '../types/api/firmwareUpdate';
|
|
5
|
-
import type { FirmwareUpdatePreparedPlan } from '../types/api/firmwareUpdatePreparedPlan';
|
|
6
4
|
type Params = {
|
|
7
5
|
binary?: ArrayBuffer;
|
|
8
|
-
artifact?: FirmwareArtifactReference;
|
|
9
|
-
resourceArtifact?: FirmwareArtifactReference;
|
|
10
|
-
resourceEntries?: Array<{
|
|
11
|
-
entryName: string;
|
|
12
|
-
artifact: FirmwareArtifactReference;
|
|
13
|
-
}>;
|
|
14
|
-
artifactReader?: FirmwareArtifactReader;
|
|
15
|
-
preparedPlan?: FirmwareUpdatePreparedPlan;
|
|
16
|
-
platform?: FirmwareUpdatePreparedPlan['platform'];
|
|
17
6
|
version?: number[];
|
|
18
7
|
updateType: 'firmware' | 'ble';
|
|
19
8
|
forcedUpdateRes?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirmwareUpdateV2.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,aAAa,EAKnB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"FirmwareUpdateV2.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,aAAa,EAKnB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAW1C,OAAO,KAAK,EAAE,QAAQ,EAAe,MAAM,UAAU,CAAC;AAGtD,KAAK,MAAM,GAAG;IACZ,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,aAAa,CAAC;CAC9B,CAAC;AA2EF,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAAU,CAAC,MAAM,CAAC;IAC9D,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAQ;IAE1C,IAAI;IA6CJ,cAAc,YAAa,MAAM,UAS/B;YAEY,qCAAqC;IAkBnD,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS;YAkFvC,4BAA4B;IAuB1C,qBAAqB;IAUrB,uBAAuB,CAAC,UAAU,EAAE,MAAM;IAc1C,gCAAgC,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAAE,YAAY,EAAE,aAAa;IAwBtF,GAAG;CAwJV"}
|
|
@@ -5,7 +5,6 @@ export declare const MIN_UPDATE_V3_BOOTLOADER_VERSION = "2.8.0";
|
|
|
5
5
|
export default class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod<FirmwareUpdateV3Params> {
|
|
6
6
|
checkPromise: Deferred<any> | null;
|
|
7
7
|
private isSwitchFirmware;
|
|
8
|
-
private artifactSources;
|
|
9
8
|
init(): void;
|
|
10
9
|
run(): Promise<{
|
|
11
10
|
bootloaderVersion: string;
|
|
@@ -14,12 +13,9 @@ export default class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
14
13
|
}>;
|
|
15
14
|
private runProtocolV1;
|
|
16
15
|
private validateDeviceAndVersion;
|
|
17
|
-
private
|
|
18
|
-
private
|
|
19
|
-
private
|
|
20
|
-
private prepareResourceInput;
|
|
21
|
-
private prepareBootloaderSource;
|
|
22
|
-
private prepareFirmwareAndBleSources;
|
|
16
|
+
private prepareResourceBinary;
|
|
17
|
+
private prepareBootloaderBinary;
|
|
18
|
+
private prepareFirmwareAndBleBinary;
|
|
23
19
|
private executeUpdate;
|
|
24
20
|
private extractUpdateModeProgress;
|
|
25
21
|
private isGetFeaturesTimeoutError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirmwareUpdateV3.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV3.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FirmwareUpdateV3.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV3.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAK/E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,qBAAqB,CAAC;AAKnE,eAAO,MAAM,gCAAgC,UAAU,CAAC;AAaxD,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,wBAAwB,CAAC,sBAAsB,CAAC;IAC5F,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAQ;IAE1C,OAAO,CAAC,gBAAgB,CAAS;IAEjC,IAAI;IAmCE,GAAG;;;;;YAQK,aAAa;IA+C3B,OAAO,CAAC,wBAAwB;YAiBlB,qBAAqB;YAoBrB,uBAAuB;YAiBvB,2BAA2B;YAiD3B,aAAa;IA0M3B,OAAO,CAAC,yBAAyB;IAajC,OAAO,CAAC,yBAAyB;IAQjC,OAAO,CAAC,qBAAqB;IAmB7B,OAAO,CAAC,sCAAsC;IAexC,sBAAsB,CAAC,OAAO,EAAE,MAAM;CAuE7C"}
|