@onekeyfe/hd-core 1.2.0-alpha.35 → 1.2.0-alpha.36

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.
Files changed (50) hide show
  1. package/__tests__/AllNetworkGetAddressBase.tracing.test.ts +74 -0
  2. package/__tests__/DeviceEventRegistration.test.ts +6 -0
  3. package/__tests__/get-device-state.test.ts +104 -12
  4. package/__tests__/open-wallet-session.test.ts +131 -7
  5. package/__tests__/protocol-v2-ui-lifecycle.test.ts +56 -0
  6. package/__tests__/protocol-v2.test.ts +290 -39
  7. package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
  8. package/dist/api/GetPassphraseState.d.ts.map +1 -1
  9. package/dist/api/OpenWalletSession.d.ts.map +1 -1
  10. package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
  11. package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts.map +1 -1
  12. package/dist/core/deviceEventRegistration.d.ts +2 -0
  13. package/dist/core/deviceEventRegistration.d.ts.map +1 -1
  14. package/dist/core/index.d.ts.map +1 -1
  15. package/dist/device/Device.d.ts +22 -4
  16. package/dist/device/Device.d.ts.map +1 -1
  17. package/dist/events/device.d.ts +4 -0
  18. package/dist/events/device.d.ts.map +1 -1
  19. package/dist/events/ui-request.d.ts +27 -2
  20. package/dist/events/ui-request.d.ts.map +1 -1
  21. package/dist/index.d.ts +56 -7
  22. package/dist/index.js +692 -397
  23. package/dist/protocols/protocol-v2/features.d.ts.map +1 -1
  24. package/dist/protocols/protocol-v2/uiInteraction.d.ts +3 -3
  25. package/dist/protocols/protocol-v2/uiInteraction.d.ts.map +1 -1
  26. package/dist/protocols/protocol-v2/unlockRetry.d.ts.map +1 -1
  27. package/dist/protocols/protocol-v2/walletSession.d.ts +4 -1
  28. package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -1
  29. package/dist/utils/deviceFeaturesUtils.d.ts +2 -0
  30. package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
  31. package/dist/utils/patch.d.ts +1 -1
  32. package/package.json +4 -4
  33. package/src/api/BaseMethod.ts +1 -1
  34. package/src/api/FirmwareUpdateV4.ts +13 -6
  35. package/src/api/GetPassphraseState.ts +7 -1
  36. package/src/api/OpenWalletSession.ts +18 -3
  37. package/src/api/allnetwork/AllNetworkGetAddressBase.ts +24 -2
  38. package/src/api/device/DeviceUnlock.ts +1 -1
  39. package/src/api/protocol-v2/ProtocolInfoRequest.ts +3 -1
  40. package/src/core/deviceEventRegistration.ts +4 -0
  41. package/src/core/index.ts +46 -4
  42. package/src/data/messages/messages-protocol-v2.json +15 -0
  43. package/src/device/Device.ts +221 -24
  44. package/src/events/device.ts +4 -0
  45. package/src/events/ui-request.ts +32 -2
  46. package/src/protocols/protocol-v2/features.ts +9 -2
  47. package/src/protocols/protocol-v2/uiInteraction.ts +31 -5
  48. package/src/protocols/protocol-v2/unlockRetry.ts +33 -11
  49. package/src/protocols/protocol-v2/walletSession.ts +140 -32
  50. package/src/utils/deviceFeaturesUtils.ts +4 -0
@@ -61,6 +61,7 @@ import { createCoreApi } from '../src/inject';
61
61
  import { Device, preloadSessionCache } from '../src/device/Device';
62
62
  import { deviceWalletSessionStore } from '../src/device/DeviceWalletSessionStore';
63
63
  import { DevicePool } from '../src/device/DevicePool';
64
+ import { DEVICE } from '../src/events';
64
65
  import { UI_REQUEST } from '../src/events/ui-request';
65
66
  import {
66
67
  PROTOCOL_V2_DEVICE_INFO_TIMEOUT_MS,
@@ -70,8 +71,8 @@ import {
70
71
  getProtocolV2RuntimeMode,
71
72
  parseProtocolV2BuildFingerprint,
72
73
  requestProtocolV2DeviceInfo,
73
- requestProtocolV2ProtocolInfo,
74
74
  requestProtocolV2DeviceStatus,
75
+ requestProtocolV2ProtocolInfo,
75
76
  supportsProtocolV2Message,
76
77
  } from '../src/protocols/protocol-v2/features';
77
78
  import {
@@ -416,14 +417,16 @@ function stubDevice<T extends Record<string, any>>(device: T): T {
416
417
  }
417
418
  return d.features;
418
419
  };
420
+ d.ensureProtocolV2RuntimeContext ??= (timeoutMs?: number) =>
421
+ requestProtocolV2ProtocolInfo({
422
+ commands: d.getCommands?.() ?? d.commands,
423
+ timeoutMs,
424
+ });
419
425
  d.probeProtocolV2RuntimeState ??= async (
420
426
  deviceInfo: ProtocolV2DeviceInfo,
421
427
  timeoutMs?: number
422
428
  ) => {
423
- const protocolInfo = await requestProtocolV2ProtocolInfo({
424
- commands: d.getCommands(),
425
- timeoutMs,
426
- });
429
+ const protocolInfo = await d.ensureProtocolV2RuntimeContext(timeoutMs);
427
430
  const runtimeMode = getProtocolV2RuntimeMode(protocolInfo);
428
431
  if (runtimeMode === 'bootloader' || runtimeMode === 'romloader') {
429
432
  return d.updateProtocolV2Features(deviceInfo, null, runtimeMode, protocolInfo);
@@ -804,7 +807,7 @@ describe('Protocol V2 feature adapter', () => {
804
807
  ).resolves.toEqual({
805
808
  passphraseState: 'state-1',
806
809
  newSession: 'session-1',
807
- unlockedAttachPin: undefined,
810
+ unlockedAttachPin: false,
808
811
  resumed: false,
809
812
  });
810
813
  expect(typedCall).toHaveBeenCalledWith('ProtocolInfoRequest', 'ProtocolInfo', {
@@ -865,6 +868,7 @@ describe('Protocol V2 feature adapter', () => {
865
868
  expect(typedCall).toHaveBeenCalledWith('DeviceSessionGet', 'DeviceSession', {});
866
869
  expect(typedCall).toHaveBeenCalledWith('DeviceSessionGet', 'DeviceSession', {
867
870
  session_id: 'standard-session',
871
+ btc_test_address: 'standard-state',
868
872
  });
869
873
  expect(deviceWalletSessionStore.getStandard(deviceId)).toEqual({
870
874
  passphraseState: 'standard-state',
@@ -1334,6 +1338,7 @@ describe('Protocol V2 feature adapter', () => {
1334
1338
 
1335
1339
  expect(typedCall).toHaveBeenCalledWith('DeviceSessionGet', 'DeviceSession', {
1336
1340
  session_id: 'session-a',
1341
+ btc_test_address: 'state-a',
1337
1342
  });
1338
1343
  expect(device.getInternalState()).toBe('session-b');
1339
1344
  });
@@ -1401,7 +1406,11 @@ describe('Protocol V2 feature adapter', () => {
1401
1406
  });
1402
1407
  expect(typedCall.mock.calls).toEqual([
1403
1408
  ['ProtocolInfoRequest', 'ProtocolInfo', { eventless_wallet_session: true }],
1404
- ['DeviceSessionGet', 'DeviceSession', { session_id: 'session-a' }],
1409
+ [
1410
+ 'DeviceSessionGet',
1411
+ 'DeviceSession',
1412
+ { session_id: 'session-a', btc_test_address: 'state-a' },
1413
+ ],
1405
1414
  ]);
1406
1415
  expect(promptPassphrase).not.toHaveBeenCalled();
1407
1416
  expect(device.getInternalState()).toBeUndefined();
@@ -1552,6 +1561,72 @@ describe('Protocol V2 feature adapter', () => {
1552
1561
  expect(device.getInternalState()).toBeUndefined();
1553
1562
  });
1554
1563
 
1564
+ test.each([false, true])(
1565
+ 'rejects a different Attach PIN wallet when Pro2 lock failure is %s',
1566
+ async lockFails => {
1567
+ const deviceId = 'attach-mismatch-device';
1568
+ const device = Device.fromDescriptor({ ...descriptor, protocolType: 'V2' } as any);
1569
+ (device as any).features = normalizeProtocolV2Features(
1570
+ { ...descriptor, protocolType: 'V2' } as any,
1571
+ {
1572
+ status: {
1573
+ device_id: deviceId,
1574
+ unlocked: true,
1575
+ passphrase_enabled: true,
1576
+ attach_to_pin_enabled: true,
1577
+ unlocked_by_attach_to_pin: false,
1578
+ },
1579
+ }
1580
+ );
1581
+ device.passphraseState = 'expected-state';
1582
+
1583
+ const typedCall = jest.fn((request: string) => {
1584
+ if (request === 'ProtocolInfoRequest') return { message: { version: 2 } };
1585
+ if (request === 'DeviceSessionAskPin') return { message: { message: 'PIN verified' } };
1586
+ if (request === 'DeviceStatusGet') {
1587
+ return {
1588
+ message: {
1589
+ device_id: deviceId,
1590
+ unlocked: true,
1591
+ passphrase_enabled: true,
1592
+ attach_to_pin_enabled: true,
1593
+ unlocked_by_attach_to_pin: true,
1594
+ },
1595
+ };
1596
+ }
1597
+ if (request === 'DeviceSessionGet') {
1598
+ return {
1599
+ message: {
1600
+ btc_test_address: 'wrong-attach-state',
1601
+ session_id: 'wrong-attach-session',
1602
+ },
1603
+ };
1604
+ }
1605
+ if (request === 'LockDevice') {
1606
+ if (lockFails) throw new Error('Lock unsupported');
1607
+ return { message: { message: 'Device locked' } };
1608
+ }
1609
+ throw new Error(`Unexpected request: ${request}`);
1610
+ });
1611
+ const promptPassphrase = jest.fn().mockResolvedValue({ attachPinOnDevice: true });
1612
+ (device as any).commands = { typedCall, promptPassphrase };
1613
+
1614
+ await expect(
1615
+ getProtocolV2WalletSession(device, { expectedPassphraseState: 'expected-state' })
1616
+ ).rejects.toMatchObject({
1617
+ errorCode: HardwareErrorCode.DeviceCheckUnlockTypeError,
1618
+ });
1619
+
1620
+ expect(promptPassphrase).not.toHaveBeenCalled();
1621
+ expect(typedCall).toHaveBeenCalledWith('DeviceSessionGet', 'DeviceSession', {
1622
+ btc_test_address: 'expected-state',
1623
+ });
1624
+ expect(typedCall).toHaveBeenCalledWith('LockDevice', 'Success', {});
1625
+ expect(typedCall.mock.calls.filter(call => call[0] === 'DeviceSessionGet')).toHaveLength(1);
1626
+ expect(device.getInternalState()).toBeUndefined();
1627
+ }
1628
+ );
1629
+
1555
1630
  test('recovers an expired Attach PIN wallet through the unified wallet selector', async () => {
1556
1631
  const device = Device.fromDescriptor({
1557
1632
  id: 'cache-device-attach-recovery',
@@ -1608,7 +1683,17 @@ describe('Protocol V2 feature adapter', () => {
1608
1683
  }),
1609
1684
  { cancelDeviceOnReject: false }
1610
1685
  );
1611
- expect(unlockDevice).toHaveBeenCalledWith(DeviceSessionPinType.AttachToPin);
1686
+ expect(unlockDevice).toHaveBeenCalledWith(
1687
+ DeviceSessionPinType.AttachToPin,
1688
+ expect.objectContaining({
1689
+ emitUiEvent: false,
1690
+ interaction: expect.objectContaining({
1691
+ phase: 'pin',
1692
+ transition: 'start',
1693
+ protocol: 'V2',
1694
+ }),
1695
+ })
1696
+ );
1612
1697
  expect(device.getInternalState()).toBe('new-attach-session');
1613
1698
  });
1614
1699
 
@@ -1892,12 +1977,10 @@ describe('Protocol V2 feature adapter', () => {
1892
1977
  expect(getFeatures).not.toHaveBeenCalled();
1893
1978
  });
1894
1979
 
1895
- test('marks an interactive cache miss as a wallet-session recovery', async () => {
1980
+ test('uses the cached wallet address when the local session is missing', async () => {
1896
1981
  const typedCall = jest
1897
1982
  .fn()
1898
1983
  .mockResolvedValueOnce({ message: { version: 2 } })
1899
- .mockResolvedValueOnce({ message: { message: 'Passphrase prepared' } })
1900
- .mockResolvedValueOnce({ message: { unlocked: true, unlocked_attach_pin: false } })
1901
1984
  .mockResolvedValueOnce({
1902
1985
  message: {
1903
1986
  btc_test_address: 'expected-state',
@@ -1925,16 +2008,10 @@ describe('Protocol V2 feature adapter', () => {
1925
2008
  await expect(
1926
2009
  getProtocolV2WalletSession(device, { expectedPassphraseState: 'expected-state' })
1927
2010
  ).resolves.toMatchObject({ passphraseState: 'expected-state' });
1928
- expect(promptPassphrase).toHaveBeenCalledWith(
1929
- {
1930
- existsAttachPinUser: false,
1931
- deviceOnly: false,
1932
- source: 'wallet-session-coordinator',
1933
- reason: 'session-recovery',
1934
- expectedPassphraseState: 'expected-state',
1935
- },
1936
- { cancelDeviceOnReject: false }
1937
- );
2011
+ expect(typedCall).toHaveBeenCalledWith('DeviceSessionGet', 'DeviceSession', {
2012
+ btc_test_address: 'expected-state',
2013
+ });
2014
+ expect(promptPassphrase).not.toHaveBeenCalled();
1938
2015
  });
1939
2016
 
1940
2017
  test('reuses the Pro2 session opened by legacy getPassphraseState on the next App call', async () => {
@@ -2000,8 +2077,11 @@ describe('Protocol V2 feature adapter', () => {
2000
2077
  true
2001
2078
  );
2002
2079
  expect(typedCall.mock.calls).toEqual([
2003
- ['ProtocolInfoRequest', 'ProtocolInfo', { eventless_wallet_session: true }],
2004
- ['DeviceSessionGet', 'DeviceSession', { session_id: 'session-pro2-app' }],
2080
+ [
2081
+ 'DeviceSessionGet',
2082
+ 'DeviceSession',
2083
+ { session_id: 'session-pro2-app', btc_test_address: 'state-pro2-app' },
2084
+ ],
2005
2085
  ]);
2006
2086
  });
2007
2087
 
@@ -2268,12 +2348,15 @@ describe('Protocol V2 feature adapter', () => {
2268
2348
  );
2269
2349
 
2270
2350
  expect(device.getInternalState()).toBeUndefined();
2271
- expect(typedCall).toHaveBeenNthCalledWith(2, 'DeviceSessionAskPassphrase', 'Success', {
2351
+ expect(typedCall).toHaveBeenCalledWith('DeviceSessionGet', 'DeviceSession', {
2352
+ btc_test_address: 'expected-state',
2353
+ });
2354
+ expect(typedCall).toHaveBeenCalledWith('DeviceSessionAskPassphrase', 'Success', {
2272
2355
  passphrase: 'host hidden wallet',
2273
2356
  on_device: false,
2274
2357
  });
2275
- expect(typedCall).toHaveBeenNthCalledWith(3, 'DeviceStatusGet', 'DeviceStatus', {});
2276
- expect(typedCall).toHaveBeenNthCalledWith(4, 'DeviceSessionGet', 'DeviceSession', {});
2358
+ expect(typedCall).toHaveBeenCalledWith('DeviceStatusGet', 'DeviceStatus', {});
2359
+ expect(typedCall).toHaveBeenCalledWith('DeviceSessionGet', 'DeviceSession', {});
2277
2360
  });
2278
2361
 
2279
2362
  test('useEmptyPassphrase ignores a stale hidden-wallet state during Protocol V2 safety check', async () => {
@@ -2310,6 +2393,9 @@ describe('Protocol V2 feature adapter', () => {
2310
2393
  expect(typedCall).toHaveBeenCalledWith('ProtocolInfoRequest', 'ProtocolInfo', {
2311
2394
  eventless_wallet_session: true,
2312
2395
  });
2396
+ expect(typedCall).toHaveBeenCalledWith('DeviceSessionAskPin', 'Success', {
2397
+ type: DeviceSessionPinType.Main,
2398
+ });
2313
2399
  });
2314
2400
 
2315
2401
  test('marks fallback features as unavailable when DeviceInfo is missing', () => {
@@ -2680,7 +2766,9 @@ describe('Protocol V2 feature adapter', () => {
2680
2766
  timeoutMs: PROTOCOL_V2_DEVICE_INFO_TIMEOUT_MS,
2681
2767
  }
2682
2768
  );
2683
- expect(typedCall).toHaveBeenNthCalledWith(2, 'ProtocolInfoRequest', 'ProtocolInfo', {});
2769
+ expect(typedCall).toHaveBeenNthCalledWith(2, 'ProtocolInfoRequest', 'ProtocolInfo', {
2770
+ eventless_wallet_session: true,
2771
+ });
2684
2772
  expect(typedCall).toHaveBeenNthCalledWith(3, 'DeviceStatusGet', 'DeviceStatus', {});
2685
2773
  });
2686
2774
 
@@ -2718,7 +2806,9 @@ describe('Protocol V2 feature adapter', () => {
2718
2806
  }),
2719
2807
  expect.anything()
2720
2808
  );
2721
- expect(typedCall).toHaveBeenNthCalledWith(2, 'ProtocolInfoRequest', 'ProtocolInfo', {});
2809
+ expect(typedCall).toHaveBeenNthCalledWith(2, 'ProtocolInfoRequest', 'ProtocolInfo', {
2810
+ eventless_wallet_session: true,
2811
+ });
2722
2812
  expect(typedCall).not.toHaveBeenCalledWith('DeviceStatusGet', 'DeviceStatus', {});
2723
2813
  expect(device.features).toMatchObject({
2724
2814
  deviceId: null,
@@ -2839,6 +2929,59 @@ describe('Protocol V2 feature adapter', () => {
2839
2929
  });
2840
2930
  });
2841
2931
 
2932
+ test('maps an explicit unsupported DeviceStatusGet response to bootloader for an unknown fingerprint', async () => {
2933
+ const device = Device.fromDescriptor({
2934
+ path: 'usb-path',
2935
+ protocolType: 'V2',
2936
+ } as any);
2937
+ const protocolInfo = {
2938
+ ...protocolV2ApplicationInfo,
2939
+ build_fingerprint: 'legacy-fingerprint',
2940
+ };
2941
+ const typedCall = jest
2942
+ .fn()
2943
+ .mockResolvedValueOnce({ type: 'ProtocolInfo', message: protocolInfo })
2944
+ .mockRejectedValueOnce(new Error('Failure_UnexpectedMessage,Unknown message'));
2945
+ (device as any).commands = { typedCall };
2946
+
2947
+ await device.probeProtocolV2RuntimeState({
2948
+ hw: { Device_type: DeviceType.PRO2, serial_no: 'PR2SERIAL' },
2949
+ fw: { bootloader: { version: '0.2.0' } },
2950
+ });
2951
+
2952
+ expect(device.features).toMatchObject({
2953
+ mode: 'bootloader',
2954
+ bootloaderMode: true,
2955
+ initialized: null,
2956
+ });
2957
+ });
2958
+
2959
+ test('propagates DeviceStatusGet link failures instead of mapping them to bootloader', async () => {
2960
+ const device = Device.fromDescriptor({
2961
+ path: 'usb-path',
2962
+ protocolType: 'V2',
2963
+ } as any);
2964
+ const protocolInfo = {
2965
+ ...protocolV2ApplicationInfo,
2966
+ build_fingerprint: 'legacy-fingerprint',
2967
+ };
2968
+ const linkError = new Error('Protocol V2 CRC mismatch');
2969
+ const typedCall = jest
2970
+ .fn()
2971
+ .mockResolvedValueOnce({ type: 'ProtocolInfo', message: protocolInfo })
2972
+ .mockRejectedValueOnce(linkError);
2973
+ (device as any).commands = { typedCall };
2974
+
2975
+ await expect(
2976
+ device.probeProtocolV2RuntimeState({
2977
+ hw: { Device_type: DeviceType.PRO2, serial_no: 'PR2SERIAL' },
2978
+ fw: { application: { version: '1.2.3' } },
2979
+ })
2980
+ ).rejects.toBe(linkError);
2981
+
2982
+ expect(device.features).toBeUndefined();
2983
+ });
2984
+
2842
2985
  test('fails safely when runtime fingerprint and capabilities are both unknown', async () => {
2843
2986
  const device = Device.fromDescriptor({
2844
2987
  path: 'usb-path',
@@ -2931,10 +3074,6 @@ describe('Protocol V2 feature adapter', () => {
2931
3074
  fw: { application: { version: '1.2.4' } },
2932
3075
  },
2933
3076
  })
2934
- .mockResolvedValueOnce({
2935
- type: 'ProtocolInfo',
2936
- message: protocolV2ApplicationInfo,
2937
- })
2938
3077
  .mockResolvedValueOnce({
2939
3078
  type: 'DeviceStatus',
2940
3079
  message: { init_states: true, unlocked: true },
@@ -2956,7 +3095,7 @@ describe('Protocol V2 feature adapter', () => {
2956
3095
  firmwareVersion: '1.2.4',
2957
3096
  passphraseProtection: null,
2958
3097
  });
2959
- expect(typedCall).toHaveBeenCalledTimes(6);
3098
+ expect(typedCall).toHaveBeenCalledTimes(5);
2960
3099
  expect(typedCall).toHaveBeenNthCalledWith(
2961
3100
  4,
2962
3101
  'DeviceInfoGet',
@@ -3070,9 +3209,23 @@ describe('Protocol V2 feature adapter', () => {
3070
3209
  status: { init_states: true },
3071
3210
  }
3072
3211
  );
3212
+ const pinOnDevice = jest.fn();
3213
+ device.on(DEVICE.PIN_ON_DEVICE, pinOnDevice);
3073
3214
 
3074
3215
  const features = await device.unlockDevice();
3075
3216
 
3217
+ expect(pinOnDevice).toHaveBeenCalledWith(
3218
+ device,
3219
+ DeviceSessionPinType.Main,
3220
+ expect.objectContaining({
3221
+ source: 'unlock-coordinator',
3222
+ reason: 'device-unlock',
3223
+ deviceOnly: true,
3224
+ })
3225
+ );
3226
+ expect(pinOnDevice.mock.invocationCallOrder[0]).toBeLessThan(
3227
+ typedCall.mock.invocationCallOrder[0]
3228
+ );
3076
3229
  expect(typedCall.mock.calls).toEqual([
3077
3230
  ['DeviceSessionAskPin', 'Success', { type: DeviceSessionPinType.Main }],
3078
3231
  ['DeviceStatusGet', 'DeviceStatus', {}],
@@ -3118,9 +3271,12 @@ describe('Protocol V2 feature adapter', () => {
3118
3271
  throw new Error(`Unexpected request: ${requestType}`);
3119
3272
  });
3120
3273
  (device as any).commands = { typedCall };
3274
+ const pinOnDevice = jest.fn();
3275
+ device.on(DEVICE.PIN_ON_DEVICE, pinOnDevice);
3121
3276
 
3122
- await device.unlockDevice();
3277
+ await device.unlockDevice(DeviceSessionPinType.Main, { emitUiEvent: false });
3123
3278
 
3279
+ expect(pinOnDevice).not.toHaveBeenCalled();
3124
3280
  expect(typedCall.mock.calls).toEqual([
3125
3281
  ['DeviceSessionAskPin', 'Success', { type: DeviceSessionPinType.Main }],
3126
3282
  ['DeviceStatusGet', 'DeviceStatus', {}],
@@ -4339,6 +4495,19 @@ describe('Protocol V2 firmware update targets', () => {
4339
4495
  )
4340
4496
  ).toBe(true);
4341
4497
 
4498
+ (method.postProgressMessage as jest.Mock).mockClear();
4499
+ expect(
4500
+ (method as any).assertProtocolV2TargetStatus(
4501
+ [
4502
+ { target_id: 4, status: 'FW_MGMT_UPDATER_TASK_STATUS_FINISHED' },
4503
+ { target_id: 4, status: 'FW_MGMT_UPDATER_TASK_STATUS_FINISHED' },
4504
+ ],
4505
+ new Set([4, 10])
4506
+ )
4507
+ ).toBe(false);
4508
+ expect(method.postProgressMessage).toHaveBeenCalledWith(50, 'installingFirmware');
4509
+ expect(method.postProgressMessage).not.toHaveBeenCalledWith(100, 'installingFirmware');
4510
+
4342
4511
  expect(
4343
4512
  (method as any).assertProtocolV2TargetStatus([{ target_id: 4, status: 1 }], expectedTargetIds)
4344
4513
  ).toBe(false);
@@ -4944,7 +5113,7 @@ describe('Protocol V2 firmware update targets', () => {
4944
5113
  (method as any).captureProtocolV2PhysicalIdentity = jest.fn().mockResolvedValue(undefined);
4945
5114
 
4946
5115
  const order: string[] = [];
4947
- const resourceBinary = new Uint8Array([1, 2, 3]).buffer;
5116
+ const resourceBinary = buildOkppHeader().buffer as ArrayBuffer;
4948
5117
  const getSysResourceBinarySpy = jest
4949
5118
  .spyOn(firmwareBinaryApi, 'getSysResourceBinary')
4950
5119
  .mockImplementation(() => {
@@ -5012,6 +5181,31 @@ describe('Protocol V2 firmware update targets', () => {
5012
5181
  getFirmwareLatestReleaseSpy.mockRestore();
5013
5182
  });
5014
5183
 
5184
+ test('rejects a remote RESC bundle without an OKPP header when metadata is absent', async () => {
5185
+ const method = new FirmwareUpdateV4({
5186
+ id: 1,
5187
+ payload: {
5188
+ method: 'firmwareUpdateV4',
5189
+ },
5190
+ });
5191
+ const getSysResourceBinarySpy = jest
5192
+ .spyOn(firmwareBinaryApi, 'getSysResourceBinary')
5193
+ .mockResolvedValue({ binary: new Uint8Array([1, 2, 3]).buffer });
5194
+
5195
+ await expect(
5196
+ (method as any).prefetchProtocolV2ResourceBundles([
5197
+ {
5198
+ name: 'images',
5199
+ binary: new ArrayBuffer(0),
5200
+ devicePath: 'vol0:/resource/images/images.okpkg',
5201
+ url: 'https://example.com/images.okpkg',
5202
+ },
5203
+ ])
5204
+ ).rejects.toThrow('Invalid Protocol V2 RESC bundle header: images');
5205
+
5206
+ getSysResourceBinarySpy.mockRestore();
5207
+ });
5208
+
5015
5209
  test('rejects an empty remote RESC bundle before entering bootloader', async () => {
5016
5210
  const method = new FirmwareUpdateV4({
5017
5211
  id: 1,
@@ -6080,7 +6274,10 @@ describe('Protocol V2 protected method execution', () => {
6080
6274
  }
6081
6275
  if (requestType === 'DeviceSessionGet') {
6082
6276
  calls.push('resume-hidden-session');
6083
- expect(request).toEqual({ session_id: 'hidden-session' });
6277
+ expect(request).toEqual({
6278
+ session_id: 'hidden-session',
6279
+ btc_test_address: 'hidden-state',
6280
+ });
6084
6281
  return Promise.resolve({
6085
6282
  message: {
6086
6283
  session_id: 'hidden-session',
@@ -6094,6 +6291,10 @@ describe('Protocol V2 protected method execution', () => {
6094
6291
  features: { unlocked: true, passphraseProtection: true },
6095
6292
  passphraseState: 'hidden-state',
6096
6293
  commands: { typedCall },
6294
+ ensureProtocolV2RuntimeContext: () =>
6295
+ typedCall('ProtocolInfoRequest', 'ProtocolInfo', {
6296
+ eventless_wallet_session: true,
6297
+ }).then(response => response.message),
6097
6298
  isProtocolV2: () => true,
6098
6299
  unlockDevice: jest.fn(() => {
6099
6300
  calls.push('unlock');
@@ -6142,6 +6343,10 @@ describe('Protocol V2 protected method execution', () => {
6142
6343
  features: { unlocked: true, passphraseProtection: true },
6143
6344
  passphraseState: 'hidden-state',
6144
6345
  commands: { typedCall },
6346
+ ensureProtocolV2RuntimeContext: () =>
6347
+ typedCall('ProtocolInfoRequest', 'ProtocolInfo', {
6348
+ eventless_wallet_session: true,
6349
+ }).then(response => response.message),
6145
6350
  isProtocolV2: () => true,
6146
6351
  unlockDevice: jest.fn().mockResolvedValue(undefined),
6147
6352
  getCurrentPassphraseProtection: () => true,
@@ -6177,7 +6382,10 @@ describe('Protocol V2 protected method execution', () => {
6177
6382
  }
6178
6383
  if (requestType === 'DeviceSessionGet') {
6179
6384
  calls.push('resume-hidden-session');
6180
- expect(request).toEqual({ session_id: 'hidden-session' });
6385
+ expect(request).toEqual({
6386
+ session_id: 'hidden-session',
6387
+ btc_test_address: 'hidden-state',
6388
+ });
6181
6389
  return Promise.resolve({
6182
6390
  message: {
6183
6391
  session_id: 'hidden-session',
@@ -6196,6 +6404,10 @@ describe('Protocol V2 protected method execution', () => {
6196
6404
  features,
6197
6405
  passphraseState: 'hidden-state',
6198
6406
  commands: { typedCall },
6407
+ ensureProtocolV2RuntimeContext: () =>
6408
+ typedCall('ProtocolInfoRequest', 'ProtocolInfo', {
6409
+ eventless_wallet_session: true,
6410
+ }).then(response => response.message),
6199
6411
  isProtocolV2: () => true,
6200
6412
  unlockDevice: jest.fn(() => {
6201
6413
  calls.push('unlock-main');
@@ -6213,7 +6425,12 @@ describe('Protocol V2 protected method execution', () => {
6213
6425
  await expect(runMethodWithUnlockRetry(method as any, device as any)).resolves.toEqual({
6214
6426
  message: 'ok',
6215
6427
  });
6216
- expect(device.unlockDevice).toHaveBeenCalledWith();
6428
+ expect(device.unlockDevice).toHaveBeenCalledWith(undefined, {
6429
+ source: 'unlock-coordinator',
6430
+ reason: 'device-locked',
6431
+ deviceOnly: true,
6432
+ method: 'evmSignMessage',
6433
+ });
6217
6434
  expect(calls).toEqual([
6218
6435
  'unlock-main',
6219
6436
  'negotiate-session',
@@ -6423,6 +6640,38 @@ describe('Protocol V2 protected method execution', () => {
6423
6640
  expect(uiCoordinator.resumeMethodInteraction).not.toHaveBeenCalled();
6424
6641
  });
6425
6642
 
6643
+ test('keeps the PIN prompt when an eventless method actually unlocks the device', async () => {
6644
+ const lockedError = deviceLockedError();
6645
+ const method = {
6646
+ name: 'backgroundRead',
6647
+ unlockPolicy: 'retry-on-locked',
6648
+ protocolV2UiMode: 'none',
6649
+ run: jest.fn().mockRejectedValueOnce(lockedError).mockResolvedValueOnce({ message: 'ok' }),
6650
+ };
6651
+ const device = {
6652
+ isProtocolV2: () => true,
6653
+ unlockDevice: jest.fn().mockResolvedValue(undefined),
6654
+ };
6655
+ const uiCoordinator = {
6656
+ enterMethodInteraction: jest.fn(),
6657
+ enterUnlockInteraction: jest.fn(),
6658
+ resumeMethodInteraction: jest.fn(),
6659
+ };
6660
+
6661
+ await expect(
6662
+ runMethodWithUnlockRetry(method as any, device as any, uiCoordinator as any)
6663
+ ).resolves.toEqual({ message: 'ok' });
6664
+ expect(device.unlockDevice).toHaveBeenCalledWith(undefined, {
6665
+ source: 'unlock-coordinator',
6666
+ reason: 'device-locked',
6667
+ deviceOnly: true,
6668
+ method: 'backgroundRead',
6669
+ });
6670
+ expect(uiCoordinator.enterMethodInteraction).not.toHaveBeenCalled();
6671
+ expect(uiCoordinator.enterUnlockInteraction).not.toHaveBeenCalled();
6672
+ expect(uiCoordinator.resumeMethodInteraction).not.toHaveBeenCalled();
6673
+ });
6674
+
6426
6675
  test('does not unlock or replay a lock-free state-changing method after a locked response', async () => {
6427
6676
  const error = deviceLockedError();
6428
6677
  const method = {
@@ -6627,7 +6876,9 @@ describe('Protocol V2 current low-level methods', () => {
6627
6876
 
6628
6877
  await method.run();
6629
6878
 
6630
- expect(typedCall).toHaveBeenCalledWith('ProtocolInfoRequest', 'ProtocolInfo', {});
6879
+ expect(typedCall).toHaveBeenCalledWith('ProtocolInfoRequest', 'ProtocolInfo', {
6880
+ eventless_wallet_session: true,
6881
+ });
6631
6882
  });
6632
6883
 
6633
6884
  test('sends DeviceFactoryInfoSet and DeviceFactoryInfoGet', async () => {
@@ -1 +1 @@
1
- {"version":3,"file":"FirmwareUpdateV4.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV4.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAY/E,OAAO,KAAK,EAAE,sBAAsB,EAA0B,MAAM,6BAA6B,CAAC;AA+UlG,eAAO,MAAM,oCAAoC,WACvC,WAAW,GAAG,UAAU,eACnB,MAAM,GAAG,SAAS,YAKhC,CAAC;AAEF,eAAO,MAAM,iCAAiC,0BACrB,MAAM,uBACR,MAAM,SAc5B,CAAC;AAUF,MAAM,CAAC,OAAO,OAAO,gBAAi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7B,wBAAwB;IAoDtC,OAAO,CAAC,sCAAsC;YAchC,cAAc;YA+Bd,6BAA6B;YAW7B,0BAA0B;YAS1B,6BAA6B;YAmB7B,gBAAgB;IAiB9B,OAAO,CAAC,qBAAqB;CAM9B"}
@@ -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,qBAAqB;IAIrB,IAAI;IAKE,GAAG;CA4BV"}
1
+ {"version":3,"file":"GetPassphraseState.d.ts","sourceRoot":"","sources":["../../src/api/GetPassphraseState.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU;IACxD,qBAAqB;IAIrB,IAAI;IAKE,GAAG;CAiCV"}
@@ -1 +1 @@
1
- {"version":3,"file":"OpenWalletSession.d.ts","sourceRoot":"","sources":["../../src/api/OpenWalletSession.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,OAAO,KAAK,EACV,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,gCAAgC,CAAC;AAkExC,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,UAAU,CAAC,uBAAuB,CAAC;IAChF,qBAAqB;IAIrB,IAAI;IAOE,GAAG,IAAI,OAAO,CAAC,wBAAwB,CAAC;CA2H/C"}
1
+ {"version":3,"file":"OpenWalletSession.d.ts","sourceRoot":"","sources":["../../src/api/OpenWalletSession.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,OAAO,KAAK,EACV,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,gCAAgC,CAAC;AAkExC,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BAAuB,CAAC;QACjC,aAAa,EAAE,MAAM,CAAC;KACvB,GAAG,YAAY;IAqBV,UAAU,CACd,UAAU,EAAE,MAAM,OAAO,EACzB,MAAM,EAAE,GAAG,GAAG;QACZ,MAAM,EAAE,CAAC,GAAG,GAAG;YAAE,oBAAoB,EAAE,oBAAoB,CAAA;SAAE,CAAC,EAAE,CAAC;KAClE,EACD,eAAe,EAAE,MAAM;IAkIzB,QAAQ,CAAC,oBAAoB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAE9E,GAAG;CAyBV"}
@@ -1 +1 @@
1
- {"version":3,"file":"ProtocolInfoRequest.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/ProtocolInfoRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,UAAU;IACzD,qBAAqB;IAIrB,IAAI;IAOE,GAAG;CAIV"}
1
+ {"version":3,"file":"ProtocolInfoRequest.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/ProtocolInfoRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,UAAU;IACzD,qBAAqB;IAIrB,IAAI;IAOE,GAAG;CAMV"}
@@ -2,6 +2,8 @@ import { DEVICE } from '../events';
2
2
  import type { Device, DeviceEvents } from '../device/Device';
3
3
  export type HardwareUiEventHandlers = {
4
4
  pin: (...event: DeviceEvents[typeof DEVICE.PIN]) => void;
5
+ pinOnDevice: (...event: DeviceEvents[typeof DEVICE.PIN_ON_DEVICE]) => void;
6
+ pinOnDeviceComplete: (...event: DeviceEvents[typeof DEVICE.PIN_ON_DEVICE_COMPLETE]) => void;
5
7
  button: (...event: DeviceEvents[typeof DEVICE.BUTTON]) => void;
6
8
  passphrase: (...event: DeviceEvents[typeof DEVICE.PASSPHRASE]) => void;
7
9
  passphraseOnDevice: (...event: DeviceEvents[typeof DEVICE.PASSPHRASE_ON_DEVICE]) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"deviceEventRegistration.d.ts","sourceRoot":"","sources":["../../src/core/deviceEventRegistration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE7D,MAAM,MAAM,uBAAuB,GAAG;IACpC,GAAG,EAAE,CAAC,GAAG,KAAK,EAAE,YAAY,CAAC,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;IACzD,MAAM,EAAE,CAAC,GAAG,KAAK,EAAE,YAAY,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IAC/D,UAAU,EAAE,CAAC,GAAG,KAAK,EAAE,YAAY,CAAC,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IACvE,kBAAkB,EAAE,CAAC,GAAG,KAAK,EAAE,YAAY,CAAC,OAAO,MAAM,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;IACzF,iBAAiB,EAAE,CAAC,GAAG,KAAK,EAAE,YAAY,CAAC,OAAO,MAAM,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;CACzF,CAAC;AAEF,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAC1B,QAAQ,EAAE,uBAAuB,WAQlC"}
1
+ {"version":3,"file":"deviceEventRegistration.d.ts","sourceRoot":"","sources":["../../src/core/deviceEventRegistration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE7D,MAAM,MA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