@onekeyfe/hd-core 1.1.27-alpha.31 → 1.1.27-alpha.33
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__/evmSignTransaction.test.ts +1 -1
- package/__tests__/evmSignTypedData.test.ts +1 -1
- package/__tests__/protocol-v2.test.ts +319 -9
- package/dist/api/DirList.d.ts.map +1 -1
- package/dist/api/DirMake.d.ts.map +1 -1
- package/dist/api/DirRemove.d.ts.map +1 -1
- package/dist/api/FileDelete.d.ts.map +1 -1
- package/dist/api/FileRead.d.ts.map +1 -1
- package/dist/api/FileWrite.d.ts.map +1 -1
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/PathInfo.d.ts.map +1 -1
- package/dist/api/helpers/filesystemValidation.d.ts +7 -0
- package/dist/api/helpers/filesystemValidation.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +1 -1
- package/dist/api/protocol-v2/helpers.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +2 -2
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/data-manager/TransportManager.d.ts.map +1 -1
- package/dist/index.d.ts +8 -5
- package/dist/index.js +185 -83
- package/dist/protocols/protocol-v2/features.d.ts +1 -1
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -1
- package/dist/types/api/getPassphraseState.d.ts +4 -1
- package/dist/types/api/getPassphraseState.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +1 -1
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +2 -0
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/package.json +4 -4
- package/src/api/DirList.ts +6 -2
- package/src/api/DirMake.ts +2 -1
- package/src/api/DirRemove.ts +2 -1
- package/src/api/FileDelete.ts +2 -1
- package/src/api/FileRead.ts +12 -5
- package/src/api/FileWrite.ts +19 -7
- package/src/api/GetPassphraseState.ts +5 -1
- package/src/api/PathInfo.ts +2 -1
- package/src/api/evm/EVMGetAddress.ts +1 -1
- package/src/api/evm/EVMGetPublicKey.ts +1 -1
- package/src/api/evm/EVMSignMessage.ts +1 -1
- package/src/api/evm/EVMSignTransaction.ts +1 -1
- package/src/api/evm/EVMSignTypedData.ts +4 -4
- package/src/api/evm/EVMVerifyMessage.ts +1 -1
- package/src/api/helpers/filesystemValidation.ts +51 -0
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +2 -1
- package/src/api/protocol-v2/helpers.ts +34 -11
- package/src/core/index.ts +12 -4
- package/src/data-manager/DataManager.ts +7 -7
- package/src/data-manager/MessagesConfig.ts +6 -6
- package/src/data-manager/TransportManager.ts +4 -4
- package/src/device/Device.ts +2 -2
- package/src/protocols/protocol-v2/features.ts +37 -40
- package/src/protocols/protocol-v2/firmware.ts +1 -1
- package/src/types/api/getPassphraseState.ts +5 -1
- package/src/types/api/index.ts +1 -1
- package/src/utils/deviceFeaturesUtils.ts +26 -10
- /package/src/data/messages/{messages-pro2.json → messages-protocol-v2.json} +0 -0
|
@@ -10,7 +10,7 @@ jest.mock('../src/data/config', () => ({
|
|
|
10
10
|
|
|
11
11
|
// Mock the device and transport manager
|
|
12
12
|
jest.mock('../src/data-manager/TransportManager', () => ({
|
|
13
|
-
getProtocolV1MessageSchema: jest.fn(() => '
|
|
13
|
+
getProtocolV1MessageSchema: jest.fn(() => 'v1CurrentSchema'),
|
|
14
14
|
}));
|
|
15
15
|
|
|
16
16
|
jest.mock('../src/device/Device', () => ({
|
|
@@ -9,7 +9,7 @@ jest.mock('../src/data/config', () => ({
|
|
|
9
9
|
}));
|
|
10
10
|
|
|
11
11
|
jest.mock('../src/data-manager/TransportManager', () => ({
|
|
12
|
-
getProtocolV1MessageSchema: jest.fn(() => '
|
|
12
|
+
getProtocolV1MessageSchema: jest.fn(() => 'v1CurrentSchema'),
|
|
13
13
|
}));
|
|
14
14
|
|
|
15
15
|
jest.mock('../src/device/Device', () => ({
|
|
@@ -5,6 +5,7 @@ import { DeviceRebootType } from '@onekeyfe/hd-transport';
|
|
|
5
5
|
import ConfluxSignTransaction from '../src/api/conflux/ConfluxSignTransaction';
|
|
6
6
|
import DnxGetAddress from '../src/api/dynex/DnxGetAddress';
|
|
7
7
|
import DnxSignTransaction from '../src/api/dynex/DnxSignTransaction';
|
|
8
|
+
import DirList from '../src/api/DirList';
|
|
8
9
|
import FileRead from '../src/api/FileRead';
|
|
9
10
|
import FileWrite from '../src/api/FileWrite';
|
|
10
11
|
import DeviceFirmwareUpdate from '../src/api/protocol-v2/DeviceFirmwareUpdate';
|
|
@@ -21,6 +22,10 @@ import { Device } from '../src/device/Device';
|
|
|
21
22
|
import { UI_REQUEST } from '../src/events/ui-request';
|
|
22
23
|
import { getProtocolV2Features, normalizeProtocolV2Features } from '../src/protocols/protocol-v2';
|
|
23
24
|
import { shouldSkipMethodSupportCheck } from '../src/utils';
|
|
25
|
+
import {
|
|
26
|
+
getPassphraseState,
|
|
27
|
+
getPassphraseStateWithRefreshDeviceInfo,
|
|
28
|
+
} from '../src/utils/deviceFeaturesUtils';
|
|
24
29
|
|
|
25
30
|
import type { DeviceCommands } from '../src/device/DeviceCommands';
|
|
26
31
|
|
|
@@ -117,6 +122,113 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
117
122
|
expect(features.ble_enable).toBe(true);
|
|
118
123
|
});
|
|
119
124
|
|
|
125
|
+
test('uses GetPassphraseState payloads compatible with Pro1 passphrase flow', async () => {
|
|
126
|
+
const features = normalizeProtocolV2Features(descriptor as any);
|
|
127
|
+
const typedCall = jest.fn().mockResolvedValue({
|
|
128
|
+
type: 'PassphraseState',
|
|
129
|
+
message: {
|
|
130
|
+
passphrase_state: 'state-1',
|
|
131
|
+
session_id: 'session-1',
|
|
132
|
+
unlocked_attach_pin: false,
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
const commands = { typedCall } as unknown as DeviceCommands;
|
|
136
|
+
|
|
137
|
+
await getPassphraseState(features, commands, {
|
|
138
|
+
expectPassphraseState: 'state-1',
|
|
139
|
+
});
|
|
140
|
+
expect(typedCall).toHaveBeenLastCalledWith('GetPassphraseState', 'PassphraseState', {
|
|
141
|
+
passphrase_state: 'state-1',
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
await getPassphraseState(features, commands, {
|
|
145
|
+
expectPassphraseState: 'state-2',
|
|
146
|
+
allowCreateAttachPin: true,
|
|
147
|
+
});
|
|
148
|
+
expect(typedCall).toHaveBeenLastCalledWith('GetPassphraseState', 'PassphraseState', {
|
|
149
|
+
passphrase_state: 'state-2',
|
|
150
|
+
allow_create_attach_pin: true,
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
await getPassphraseState(features, commands, {
|
|
154
|
+
onlyMainPin: true,
|
|
155
|
+
});
|
|
156
|
+
expect(typedCall).toHaveBeenLastCalledWith('GetPassphraseState', 'PassphraseState', {
|
|
157
|
+
_only_main_pin: true,
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test('stores Pro2 passphrase sessions without selecting them implicitly', async () => {
|
|
162
|
+
const device = Device.fromDescriptor({ ...descriptor, protocolType: 'V2' } as any);
|
|
163
|
+
const typedCall = jest.fn().mockResolvedValue({
|
|
164
|
+
type: 'PassphraseState',
|
|
165
|
+
message: {
|
|
166
|
+
passphrase_state: 'state-auto',
|
|
167
|
+
session_id: 'session-auto',
|
|
168
|
+
unlocked_attach_pin: false,
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
(device as any).features = normalizeProtocolV2Features({
|
|
173
|
+
...descriptor,
|
|
174
|
+
protocolType: 'V2',
|
|
175
|
+
} as any);
|
|
176
|
+
(device as any).commands = { typedCall };
|
|
177
|
+
|
|
178
|
+
await expect(getPassphraseStateWithRefreshDeviceInfo(device)).resolves.toMatchObject({
|
|
179
|
+
passphraseState: 'state-auto',
|
|
180
|
+
newSession: 'session-auto',
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
expect(device.passphraseState).toBeUndefined();
|
|
184
|
+
expect(device.features?.passphrase_protection).toBe(true);
|
|
185
|
+
expect(device.features?.session_id).toBe('session-auto');
|
|
186
|
+
expect(device.getInternalState()).toBeUndefined();
|
|
187
|
+
device.passphraseState = 'state-auto';
|
|
188
|
+
expect(device.getInternalState()).toBe('session-auto');
|
|
189
|
+
expect(typedCall).toHaveBeenLastCalledWith('GetPassphraseState', 'PassphraseState', {
|
|
190
|
+
passphrase_state: undefined,
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
test('does not mark Pro2 passphrase enabled from a main PIN session alone', async () => {
|
|
195
|
+
const device = Device.fromDescriptor({ ...descriptor, protocolType: 'V2' } as any);
|
|
196
|
+
const typedCall = jest.fn().mockResolvedValue({
|
|
197
|
+
type: 'PassphraseState',
|
|
198
|
+
message: {
|
|
199
|
+
session_id: 'main-pin-session',
|
|
200
|
+
unlocked_attach_pin: false,
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
(device as any).features = normalizeProtocolV2Features(
|
|
205
|
+
{
|
|
206
|
+
...descriptor,
|
|
207
|
+
protocolType: 'V2',
|
|
208
|
+
} as any,
|
|
209
|
+
{
|
|
210
|
+
status: {
|
|
211
|
+
passphrase_protection: false,
|
|
212
|
+
},
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
(device as any).commands = { typedCall };
|
|
216
|
+
|
|
217
|
+
await expect(
|
|
218
|
+
getPassphraseStateWithRefreshDeviceInfo(device, { onlyMainPin: true })
|
|
219
|
+
).resolves.toMatchObject({
|
|
220
|
+
passphraseState: undefined,
|
|
221
|
+
newSession: 'main-pin-session',
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
expect(device.features?.passphrase_protection).toBe(false);
|
|
225
|
+
expect(device.features?.session_id).toBe('main-pin-session');
|
|
226
|
+
expect(device.getInternalState()).toBeUndefined();
|
|
227
|
+
expect(typedCall).toHaveBeenLastCalledWith('GetPassphraseState', 'PassphraseState', {
|
|
228
|
+
_only_main_pin: true,
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
120
232
|
test('marks fallback features as unavailable when DeviceInfo is missing', () => {
|
|
121
233
|
const features = normalizeProtocolV2Features(descriptor as any);
|
|
122
234
|
|
|
@@ -138,11 +250,21 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
138
250
|
expect(shouldSkipMethodSupportCheck(features)).toBe(true);
|
|
139
251
|
});
|
|
140
252
|
|
|
141
|
-
test('initializes Protocol V2 features
|
|
253
|
+
test('initializes Protocol V2 features from DeviceGetDeviceInfo after Ping', async () => {
|
|
142
254
|
const commands = {
|
|
143
255
|
typedCall: jest
|
|
144
256
|
.fn()
|
|
145
|
-
.mockResolvedValueOnce({ type: 'Success', message: { message: 'pong' } })
|
|
257
|
+
.mockResolvedValueOnce({ type: 'Success', message: { message: 'pong' } })
|
|
258
|
+
.mockResolvedValueOnce({
|
|
259
|
+
type: 'DeviceInfo',
|
|
260
|
+
message: {
|
|
261
|
+
hw: { serial_no: 'PR2SERIAL' },
|
|
262
|
+
status: {
|
|
263
|
+
init_states: true,
|
|
264
|
+
passphrase_protection: true,
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
}),
|
|
146
268
|
};
|
|
147
269
|
|
|
148
270
|
const features = await getProtocolV2Features({
|
|
@@ -150,9 +272,34 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
150
272
|
descriptor: descriptor as any,
|
|
151
273
|
});
|
|
152
274
|
|
|
153
|
-
expect(features.device_id).toBe('
|
|
275
|
+
expect(features.device_id).toBe('PR2SERIAL');
|
|
276
|
+
expect(features.initialized).toBe(true);
|
|
277
|
+
expect(features.passphrase_protection).toBe(true);
|
|
154
278
|
expect(commands.typedCall).toHaveBeenNthCalledWith(1, 'Ping', 'Success', { message: 'init' });
|
|
155
|
-
expect(commands.typedCall).
|
|
279
|
+
expect(commands.typedCall).toHaveBeenNthCalledWith(2, 'DeviceGetDeviceInfo', 'DeviceInfo', {
|
|
280
|
+
targets: expect.objectContaining({ status: true }),
|
|
281
|
+
types: expect.objectContaining({ specific: true }),
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
test('falls back to descriptor features when Protocol V2 DeviceGetDeviceInfo fails', async () => {
|
|
286
|
+
const onDeviceInfoError = jest.fn();
|
|
287
|
+
const commands = {
|
|
288
|
+
typedCall: jest
|
|
289
|
+
.fn()
|
|
290
|
+
.mockResolvedValueOnce({ type: 'Success', message: { message: 'pong' } })
|
|
291
|
+
.mockRejectedValueOnce(new Error('DeviceInfo not supported')),
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
const features = await getProtocolV2Features({
|
|
295
|
+
commands: commands as unknown as DeviceCommands,
|
|
296
|
+
descriptor: descriptor as any,
|
|
297
|
+
onDeviceInfoError,
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
expect(features.device_id).toBe('usb-path');
|
|
301
|
+
expect(features.passphrase_protection).toBeNull();
|
|
302
|
+
expect(onDeviceInfoError).toHaveBeenCalledWith(expect.any(Error));
|
|
156
303
|
});
|
|
157
304
|
|
|
158
305
|
test('does not block method-level legacy version checks on Protocol V2', async () => {
|
|
@@ -259,15 +406,25 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
259
406
|
} as any);
|
|
260
407
|
const typedCall = jest
|
|
261
408
|
.fn()
|
|
262
|
-
.mockResolvedValueOnce({ type: 'Success', message: { message: 'init' } })
|
|
409
|
+
.mockResolvedValueOnce({ type: 'Success', message: { message: 'init' } })
|
|
410
|
+
.mockResolvedValueOnce({
|
|
411
|
+
type: 'DeviceInfo',
|
|
412
|
+
message: {
|
|
413
|
+
hw: { serial_no: 'PR2SERIAL' },
|
|
414
|
+
status: {
|
|
415
|
+
passphrase_protection: true,
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
});
|
|
263
419
|
|
|
264
420
|
(device as any).commands = { typedCall };
|
|
265
421
|
|
|
266
422
|
await device.initialize();
|
|
267
423
|
await device.initialize();
|
|
268
424
|
|
|
269
|
-
expect(device.features?.device_id).toBe('
|
|
270
|
-
expect(
|
|
425
|
+
expect(device.features?.device_id).toBe('PR2SERIAL');
|
|
426
|
+
expect(device.features?.passphrase_protection).toBe(true);
|
|
427
|
+
expect(typedCall).toHaveBeenCalledTimes(2);
|
|
271
428
|
expect(typedCall).toHaveBeenNthCalledWith(
|
|
272
429
|
1,
|
|
273
430
|
'Ping',
|
|
@@ -277,6 +434,18 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
277
434
|
timeoutMs: 10000,
|
|
278
435
|
}
|
|
279
436
|
);
|
|
437
|
+
expect(typedCall).toHaveBeenNthCalledWith(
|
|
438
|
+
2,
|
|
439
|
+
'DeviceGetDeviceInfo',
|
|
440
|
+
'DeviceInfo',
|
|
441
|
+
{
|
|
442
|
+
targets: expect.objectContaining({ status: true }),
|
|
443
|
+
types: expect.objectContaining({ specific: true }),
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
timeoutMs: 10000,
|
|
447
|
+
}
|
|
448
|
+
);
|
|
280
449
|
});
|
|
281
450
|
});
|
|
282
451
|
|
|
@@ -428,6 +597,9 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
428
597
|
if (name === 'Ping') {
|
|
429
598
|
return Promise.resolve({ type: 'Success', message: { message: 'init' } });
|
|
430
599
|
}
|
|
600
|
+
if (name === 'DeviceGetDeviceInfo') {
|
|
601
|
+
return Promise.resolve({ type: 'DeviceInfo', message: {} });
|
|
602
|
+
}
|
|
431
603
|
return Promise.reject(new Error(`unexpected call ${name}`));
|
|
432
604
|
});
|
|
433
605
|
const commands = { typedCall };
|
|
@@ -450,7 +622,17 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
450
622
|
{ message: 'init' },
|
|
451
623
|
{ timeoutMs: 5000 }
|
|
452
624
|
);
|
|
453
|
-
expect(typedCall).
|
|
625
|
+
expect(typedCall).toHaveBeenNthCalledWith(
|
|
626
|
+
2,
|
|
627
|
+
'DeviceGetDeviceInfo',
|
|
628
|
+
'DeviceInfo',
|
|
629
|
+
{
|
|
630
|
+
targets: expect.objectContaining({ status: true }),
|
|
631
|
+
types: expect.objectContaining({ specific: true }),
|
|
632
|
+
},
|
|
633
|
+
{ timeoutMs: 5000 }
|
|
634
|
+
);
|
|
635
|
+
expect(typedCall).toHaveBeenCalledTimes(2);
|
|
454
636
|
expect(typedCall).not.toHaveBeenCalledWith('Initialize', 'Features', {});
|
|
455
637
|
expect(versions).toEqual({
|
|
456
638
|
bootloaderVersion: '0.0.0',
|
|
@@ -820,6 +1002,7 @@ describe('Protocol V2 firmware update method', () => {
|
|
|
820
1002
|
id: 1,
|
|
821
1003
|
payload: {
|
|
822
1004
|
method: 'deviceFirmwareUpdate',
|
|
1005
|
+
targetId: 3,
|
|
823
1006
|
path: 'vol0:firmware.bin',
|
|
824
1007
|
},
|
|
825
1008
|
});
|
|
@@ -838,6 +1021,55 @@ describe('Protocol V2 firmware update method', () => {
|
|
|
838
1021
|
targets: [{ target_id: 0, status: 1 }],
|
|
839
1022
|
});
|
|
840
1023
|
expect(typedCall.mock.calls[0][1]).toEqual(['Success', 'DeviceFirmwareUpdateStatus']);
|
|
1024
|
+
expect(typedCall.mock.calls[0][2]).toEqual({
|
|
1025
|
+
targets: [{ target_id: 3, path: 'vol0:firmware.bin' }],
|
|
1026
|
+
});
|
|
1027
|
+
});
|
|
1028
|
+
|
|
1029
|
+
test('rejects missing or invalid firmware targets before transport call', async () => {
|
|
1030
|
+
const typedCall = jest.fn();
|
|
1031
|
+
const method = new DeviceFirmwareUpdate({
|
|
1032
|
+
id: 1,
|
|
1033
|
+
payload: {
|
|
1034
|
+
method: 'deviceFirmwareUpdate',
|
|
1035
|
+
path: 'vol0:firmware.bin',
|
|
1036
|
+
},
|
|
1037
|
+
});
|
|
1038
|
+
method.init();
|
|
1039
|
+
(method as any).device = {
|
|
1040
|
+
commands: { typedCall },
|
|
1041
|
+
};
|
|
1042
|
+
|
|
1043
|
+
await expect(method.run()).rejects.toMatchObject({
|
|
1044
|
+
errorCode: HardwareErrorCode.CallMethodInvalidParameter,
|
|
1045
|
+
});
|
|
1046
|
+
expect(typedCall).not.toHaveBeenCalled();
|
|
1047
|
+
});
|
|
1048
|
+
|
|
1049
|
+
test('accepts targetId alias inside firmware targets', async () => {
|
|
1050
|
+
const typedCall = jest.fn().mockResolvedValue({ message: {} });
|
|
1051
|
+
const method = new DeviceFirmwareUpdate({
|
|
1052
|
+
id: 1,
|
|
1053
|
+
payload: {
|
|
1054
|
+
method: 'deviceFirmwareUpdate',
|
|
1055
|
+
targets: [
|
|
1056
|
+
{
|
|
1057
|
+
target_id: undefined,
|
|
1058
|
+
targetId: 3,
|
|
1059
|
+
path: 'vol0:firmware.bin',
|
|
1060
|
+
},
|
|
1061
|
+
],
|
|
1062
|
+
} as any,
|
|
1063
|
+
});
|
|
1064
|
+
method.init();
|
|
1065
|
+
(method as any).device = {
|
|
1066
|
+
commands: { typedCall },
|
|
1067
|
+
};
|
|
1068
|
+
|
|
1069
|
+
await method.run();
|
|
1070
|
+
expect(typedCall.mock.calls[0][2]).toEqual({
|
|
1071
|
+
targets: [{ target_id: 3, path: 'vol0:firmware.bin' }],
|
|
1072
|
+
});
|
|
841
1073
|
});
|
|
842
1074
|
});
|
|
843
1075
|
|
|
@@ -869,11 +1101,45 @@ describe('Protocol V2 onboarding status method', () => {
|
|
|
869
1101
|
page_count: 5,
|
|
870
1102
|
page_name: 'backup',
|
|
871
1103
|
});
|
|
872
|
-
expect(typedCall).toHaveBeenCalledWith(
|
|
1104
|
+
expect(typedCall).toHaveBeenCalledWith(
|
|
1105
|
+
'DeviceGetOnboardingStatus',
|
|
1106
|
+
'DeviceOnboardingStatus',
|
|
1107
|
+
{}
|
|
1108
|
+
);
|
|
873
1109
|
});
|
|
874
1110
|
});
|
|
875
1111
|
|
|
876
1112
|
describe('Protocol V2 file write method', () => {
|
|
1113
|
+
test('rejects invalid write parameters before transport call', () => {
|
|
1114
|
+
expect(() => {
|
|
1115
|
+
const method = new FileWrite({
|
|
1116
|
+
id: 1,
|
|
1117
|
+
payload: {
|
|
1118
|
+
method: 'fileWrite',
|
|
1119
|
+
path: 'vol1:test.bin',
|
|
1120
|
+
offset: -1,
|
|
1121
|
+
data: new Uint8Array([1]),
|
|
1122
|
+
},
|
|
1123
|
+
});
|
|
1124
|
+
method.init();
|
|
1125
|
+
}).toThrow(
|
|
1126
|
+
expect.objectContaining({ errorCode: HardwareErrorCode.CallMethodInvalidParameter })
|
|
1127
|
+
);
|
|
1128
|
+
|
|
1129
|
+
expect(() => {
|
|
1130
|
+
const method = new FileWrite({
|
|
1131
|
+
id: 1,
|
|
1132
|
+
payload: {
|
|
1133
|
+
method: 'fileWrite',
|
|
1134
|
+
path: 'vol1:test.bin',
|
|
1135
|
+
} as any,
|
|
1136
|
+
});
|
|
1137
|
+
method.init();
|
|
1138
|
+
}).toThrow(
|
|
1139
|
+
expect.objectContaining({ errorCode: HardwareErrorCode.CallMethodInvalidParameter })
|
|
1140
|
+
);
|
|
1141
|
+
});
|
|
1142
|
+
|
|
877
1143
|
test('uses demo-aligned overwrite and append defaults', async () => {
|
|
878
1144
|
const typedCall = jest.fn().mockResolvedValue({ message: { processed_byte: 1 } });
|
|
879
1145
|
const method = new FileWrite({
|
|
@@ -1016,6 +1282,50 @@ describe('Protocol V2 file write method', () => {
|
|
|
1016
1282
|
});
|
|
1017
1283
|
|
|
1018
1284
|
describe('Protocol V2 file read method', () => {
|
|
1285
|
+
test('rejects invalid read and directory parameters before transport call', () => {
|
|
1286
|
+
expect(() => {
|
|
1287
|
+
const method = new FileRead({
|
|
1288
|
+
id: 1,
|
|
1289
|
+
payload: {
|
|
1290
|
+
method: 'fileRead',
|
|
1291
|
+
path: '',
|
|
1292
|
+
offset: 0,
|
|
1293
|
+
},
|
|
1294
|
+
});
|
|
1295
|
+
method.init();
|
|
1296
|
+
}).toThrow(
|
|
1297
|
+
expect.objectContaining({ errorCode: HardwareErrorCode.CallMethodInvalidParameter })
|
|
1298
|
+
);
|
|
1299
|
+
|
|
1300
|
+
expect(() => {
|
|
1301
|
+
const method = new FileRead({
|
|
1302
|
+
id: 1,
|
|
1303
|
+
payload: {
|
|
1304
|
+
method: 'fileRead',
|
|
1305
|
+
path: 'vol1:test.bin',
|
|
1306
|
+
totalSize: -1,
|
|
1307
|
+
},
|
|
1308
|
+
});
|
|
1309
|
+
method.init();
|
|
1310
|
+
}).toThrow(
|
|
1311
|
+
expect.objectContaining({ errorCode: HardwareErrorCode.CallMethodInvalidParameter })
|
|
1312
|
+
);
|
|
1313
|
+
|
|
1314
|
+
expect(() => {
|
|
1315
|
+
const method = new DirList({
|
|
1316
|
+
id: 1,
|
|
1317
|
+
payload: {
|
|
1318
|
+
method: 'dirList',
|
|
1319
|
+
path: 'vol1:',
|
|
1320
|
+
depth: -1,
|
|
1321
|
+
},
|
|
1322
|
+
});
|
|
1323
|
+
method.init();
|
|
1324
|
+
}).toThrow(
|
|
1325
|
+
expect.objectContaining({ errorCode: HardwareErrorCode.CallMethodInvalidParameter })
|
|
1326
|
+
);
|
|
1327
|
+
});
|
|
1328
|
+
|
|
1019
1329
|
test('reads full file in chunks when read length is 0', async () => {
|
|
1020
1330
|
const firstChunk = new Uint8Array(64).fill(1);
|
|
1021
1331
|
const typedCall = jest
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirList.d.ts","sourceRoot":"","sources":["../../src/api/DirList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"DirList.d.ts","sourceRoot":"","sources":["../../src/api/DirList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,UAAU,CAAC,aAAa,CAAC;IAC5D,IAAI;IASE,GAAG;CAOV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirMake.d.ts","sourceRoot":"","sources":["../../src/api/DirMake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"DirMake.d.ts","sourceRoot":"","sources":["../../src/api/DirMake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,UAAU,CAAC,aAAa,CAAC;IAC5D,IAAI;IAME,GAAG;CAMV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirRemove.d.ts","sourceRoot":"","sources":["../../src/api/DirRemove.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"DirRemove.d.ts","sourceRoot":"","sources":["../../src/api/DirRemove.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,UAAU,CAAC,eAAe,CAAC;IAChE,IAAI;IAME,GAAG;CAMV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileDelete.d.ts","sourceRoot":"","sources":["../../src/api/FileDelete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"FileDelete.d.ts","sourceRoot":"","sources":["../../src/api/FileDelete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAU,CAAC,gBAAgB,CAAC;IAClE,IAAI;IAME,GAAG;CAMV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileRead.d.ts","sourceRoot":"","sources":["../../src/api/FileRead.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"FileRead.d.ts","sourceRoot":"","sources":["../../src/api/FileRead.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAU1C,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAiDF,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,UAAU,CAAC,cAAc,CAAC;IAC9D,IAAI;IAaE,GAAG;;;;;;;CA+EV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileWrite.d.ts","sourceRoot":"","sources":["../../src/api/FileWrite.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"FileWrite.d.ts","sourceRoot":"","sources":["../../src/api/FileWrite.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAW1C,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,IAAI,GAAG,MAAM,CAAC;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AA0DF,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,UAAU,CAAC,eAAe,CAAC;IAChE,IAAI;IAmBE,GAAG;;;;;;;CAiGV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetPassphraseState.d.ts","sourceRoot":"","sources":["../../src/api/GetPassphraseState.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU;IACxD,IAAI;IAKE,GAAG;;;;;;
|
|
1
|
+
{"version":3,"file":"GetPassphraseState.d.ts","sourceRoot":"","sources":["../../src/api/GetPassphraseState.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU;IACxD,IAAI;IAKE,GAAG;;;;;;CA8BV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathInfo.d.ts","sourceRoot":"","sources":["../../src/api/PathInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"PathInfo.d.ts","sourceRoot":"","sources":["../../src/api/PathInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,UAAU,CAAC,cAAc,CAAC;IAC9D,IAAI;IAME,GAAG;CAUV"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const invalidParameter: (message: string) => import("@onekeyfe/hd-shared").HardwareError;
|
|
2
|
+
export declare function validateNonEmptyString(value: unknown, name: string): string;
|
|
3
|
+
export declare function validateNonNegativeInteger(value: unknown, name: string, defaultValue?: number): number;
|
|
4
|
+
export declare function validateOptionalNonNegativeInteger(value: unknown, name: string): number | undefined;
|
|
5
|
+
export declare function validateOptionalPercentage(value: unknown, name: string): number | undefined;
|
|
6
|
+
export declare function validateRequiredData(value: unknown, name: string): void;
|
|
7
|
+
//# sourceMappingURL=filesystemValidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystemValidation.d.ts","sourceRoot":"","sources":["../../../src/api/helpers/filesystemValidation.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,YAAa,MAAM,gDAC0B,CAAC;AAE3E,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAK3E;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAWR;AAED,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAGpB;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO3F;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAIvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceFirmwareUpdate.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/DeviceFirmwareUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAO3C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAE5D,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,UAAU,CAAC,0BAA0B,CAAC;IACtF,IAAI;IAWE,GAAG;
|
|
1
|
+
{"version":3,"file":"DeviceFirmwareUpdate.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/DeviceFirmwareUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAO3C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAE5D,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,UAAU,CAAC,0BAA0B,CAAC;IACtF,IAAI;IAWE,GAAG;CAYV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,MAAM,OAAO,gBAAgB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEjG,MAAM,MAAM,kBAAkB,GA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
|
|
|
2
2
|
import type { AssetsMap, ConnectSettings, DeviceTypeMap, Features, IDeviceBLEFirmwareStatus, IDeviceFirmwareStatus, ITransportStatus, IVersionArray } from '../types';
|
|
3
3
|
export declare const FIRMWARE_FIELDS: readonly ["firmware", "firmware-v2", "firmware-v8", "firmware-btc-v8"];
|
|
4
4
|
export type IFirmwareField = (typeof FIRMWARE_FIELDS)[number];
|
|
5
|
-
export type ProtocolV1MessageSchema = '
|
|
6
|
-
export type ProtobufMessageSchema = ProtocolV1MessageSchema | '
|
|
5
|
+
export type ProtocolV1MessageSchema = 'v1CurrentSchema' | 'v1LegacySchema';
|
|
6
|
+
export type ProtobufMessageSchema = ProtocolV1MessageSchema | 'v2Schema';
|
|
7
7
|
export default class DataManager {
|
|
8
8
|
static deviceMap: DeviceTypeMap & {
|
|
9
9
|
[k: string]: DeviceTypeMap[keyof DeviceTypeMap] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataManager.d.ts","sourceRoot":"","sources":["../../src/data-manager/DataManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAkBjE,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,aAAa,EACb,QAAQ,EACR,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EAEd,MAAM,UAAU,CAAC;AAIlB,eAAO,MAAM,eAAe,wEAKlB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,MAAM,MAAM,uBAAuB,GAAG,
|
|
1
|
+
{"version":3,"file":"DataManager.d.ts","sourceRoot":"","sources":["../../src/data-manager/DataManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAkBjE,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,aAAa,EACb,QAAQ,EACR,wBAAwB,EACxB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