@onekeyfe/hd-transport-web-device 1.2.11-alpha.2 → 1.2.11-alpha.21

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.
@@ -1,5 +1,10 @@
1
1
  import transport, { PROTOCOL_V2_CHANNEL_BLE_UART, bytesToHex } from '@onekeyfe/hd-transport';
2
- import { EBleDisconnectReason, HardwareErrorCode, createDeferred } from '@onekeyfe/hd-shared';
2
+ import {
3
+ EBleDisconnectReason,
4
+ ERRORS,
5
+ HardwareErrorCode,
6
+ createDeferred,
7
+ } from '@onekeyfe/hd-shared';
3
8
  import EventEmitter from 'events';
4
9
 
5
10
  import ElectronBleTransport from '../src/electron-ble-transport';
@@ -343,6 +348,49 @@ describe('ElectronBleTransport protocol detection', () => {
343
348
  }
344
349
  );
345
350
 
351
+ test.each(['Pro 2', 'Neo'])(
352
+ 'retains %s V2 subscription while forwarding keepSession=false for idle disconnect',
353
+ async name => {
354
+ const device = { id: 'retained-idle-v2-id', name };
355
+ const release = jest.fn().mockResolvedValue(undefined);
356
+ const nobleBle = { ...createNobleBle(device), release };
357
+ echoProtocolV2(nobleBle, device.id);
358
+ const bleTransport = configureTransport(nobleBle);
359
+ await bleTransport.acquire({ uuid: device.id, expectedProtocol: 'V2' });
360
+ await bleTransport.call(device.id, 'Ping', { message: 'before-release' });
361
+ const notifyCleanup = nobleBle.onNotification.mock.results[0].value;
362
+
363
+ try {
364
+ await bleTransport.release(device.id, false, false, { retainLink: true });
365
+ expect(release).toHaveBeenCalledWith(device.id, false);
366
+ expect(bleTransport.getProtocolType(device.id)).toBe('V2');
367
+ expect(notifyCleanup).not.toHaveBeenCalled();
368
+
369
+ await expect(
370
+ bleTransport.acquire({ uuid: device.id, expectedProtocol: 'V2' })
371
+ ).resolves.toMatchObject({ uuid: device.id, protocolType: 'V2' });
372
+ await expect(
373
+ bleTransport.call(device.id, 'Ping', { message: 'within-idle-window' })
374
+ ).resolves.toMatchObject({ type: 'Success' });
375
+
376
+ expect(nobleBle.connect).toHaveBeenCalledTimes(1);
377
+ expect(nobleBle.subscribe).toHaveBeenCalledTimes(1);
378
+ expect(
379
+ nobleBle.write.mock.calls.map(([, hex]) => Number.parseInt(hex.slice(12, 14), 16))
380
+ ).toEqual([1, 2, 3]);
381
+
382
+ // Once the main-process 20s idle timer drops the link, retained state is cleared.
383
+ await bleTransport.release(device.id, false, false, { retainLink: true });
384
+ const disconnectHandler = nobleBle.onDeviceDisconnected.mock.calls[0][0];
385
+ disconnectHandler({ ...device, reason: EBleDisconnectReason.IdleKeepAlive });
386
+ expect(notifyCleanup).toHaveBeenCalledTimes(1);
387
+ expect(bleTransport.getProtocolType(device.id)).toBeUndefined();
388
+ } finally {
389
+ await bleTransport.disconnect(device.id);
390
+ }
391
+ }
392
+ );
393
+
346
394
  test.each(['ordinary release', 'onclose', 'forced probe'])(
347
395
  'does not retain renderer state for %s',
348
396
  async mode => {
@@ -1372,4 +1420,433 @@ describe('ElectronBleTransport protocol detection', () => {
1372
1420
  await bleTransport.release(device.id);
1373
1421
  }
1374
1422
  });
1423
+
1424
+ test('stop() unsubscribes host disconnect listener and releases owned links idempotently', async () => {
1425
+ const device = { id: 'stop-cleanup-pro2-id', name: 'OneKey Pro 2' };
1426
+ const nobleBle = createNobleBle(device);
1427
+ const emitter = new EventEmitter();
1428
+ const hostDisconnectCleanup = jest.fn();
1429
+ const notifyCleanup = jest.fn();
1430
+ const mtuCleanup = jest.fn();
1431
+ let disconnectHandler:
1432
+ | ((d: { id: string; name: string; reason?: EBleDisconnectReason }) => void)
1433
+ | undefined;
1434
+
1435
+ nobleBle.onDeviceDisconnected.mockImplementation(handler => {
1436
+ disconnectHandler = handler;
1437
+ return () => {
1438
+ hostDisconnectCleanup();
1439
+ disconnectHandler = undefined;
1440
+ };
1441
+ });
1442
+ echoProtocolV2(nobleBle, device.id);
1443
+ const echoOnNotification = nobleBle.onNotification.getMockImplementation();
1444
+ nobleBle.onNotification.mockImplementation(handler => {
1445
+ echoOnNotification?.(handler);
1446
+ return notifyCleanup;
1447
+ });
1448
+ nobleBle.onMtuChanged.mockImplementation(() => mtuCleanup);
1449
+
1450
+ const transportDisconnect = jest.fn();
1451
+ emitter.on('transport-device-disconnect', transportDisconnect);
1452
+ const bleTransport = configureTransport(nobleBle, emitter);
1453
+
1454
+ await bleTransport.acquire({ uuid: device.id, expectedProtocol: 'V2' });
1455
+ expect(bleTransport.getProtocolType(device.id)).toBe('V2');
1456
+
1457
+ await bleTransport.stop();
1458
+
1459
+ expect(hostDisconnectCleanup).toHaveBeenCalledTimes(1);
1460
+ expect(notifyCleanup).toHaveBeenCalledTimes(1);
1461
+ expect(mtuCleanup).toHaveBeenCalledTimes(1);
1462
+ expect(nobleBle.unsubscribe).toHaveBeenCalledWith(device.id);
1463
+ expect(nobleBle.disconnect).toHaveBeenCalledWith(device.id);
1464
+ expect(bleTransport.getProtocolType(device.id)).toBeUndefined();
1465
+
1466
+ // Calling stop() again is a safe no-op.
1467
+ await bleTransport.stop();
1468
+ expect(hostDisconnectCleanup).toHaveBeenCalledTimes(1);
1469
+ expect(nobleBle.disconnect).toHaveBeenCalledTimes(1);
1470
+
1471
+ // Late host disconnect events are no longer delivered to the stopped transport.
1472
+ disconnectHandler?.({ ...device, reason: EBleDisconnectReason.DeviceDisconnected });
1473
+ expect(transportDisconnect).not.toHaveBeenCalled();
1474
+ });
1475
+
1476
+ test('stop() during getDevice() does not let retired acquire disconnect a replacement link', async () => {
1477
+ const device = { id: 'lookup-stop-pro2-id', name: 'OneKey Pro 2' };
1478
+ const nobleBle = createNobleBle(device);
1479
+ let resolveGetDevice: ((value: typeof device) => void) | undefined;
1480
+ nobleBle.getDevice.mockImplementation(
1481
+ () =>
1482
+ new Promise(resolve => {
1483
+ resolveGetDevice = resolve;
1484
+ })
1485
+ );
1486
+ const bleTransport = configureTransport(nobleBle);
1487
+
1488
+ const acquiring = bleTransport.acquire({ uuid: device.id, expectedProtocol: 'V2' });
1489
+ const stopping = bleTransport.stop();
1490
+ await stopping;
1491
+ // Clear disconnect count recorded during stopResources() so we verify the late
1492
+ // retired acquire does not issue another disconnect against a replacement link.
1493
+ nobleBle.disconnect.mockClear();
1494
+
1495
+ resolveGetDevice?.(device);
1496
+ await expect(acquiring).rejects.toThrow(/Electron BLE transport is stopped/);
1497
+ expect(nobleBle.connect).not.toHaveBeenCalled();
1498
+ expect(nobleBle.disconnect).not.toHaveBeenCalled();
1499
+ });
1500
+
1501
+ test('wakes a sleeping legacy V1 Classic with Initialize after silent GetFeatures without probing V2', async () => {
1502
+ const device = { id: 'sleeping-classic-id', name: 'K8141' };
1503
+ const nobleBle = createNobleBle(device);
1504
+ const bleTransport = configureTransport(nobleBle);
1505
+ const probes = bleTransport as any;
1506
+ const probeProtocolV1 = jest.spyOn(probes, 'probeProtocolV1').mockResolvedValue(false);
1507
+ const probeProtocolV2 = jest.spyOn(probes, 'probeProtocolV2').mockResolvedValue(false);
1508
+ const callProtocolV1 = jest.spyOn(probes, 'callProtocolV1').mockResolvedValue({
1509
+ type: 'Features',
1510
+ message: {},
1511
+ });
1512
+
1513
+ await expect(bleTransport.acquire({ uuid: device.id })).resolves.toMatchObject({
1514
+ uuid: device.id,
1515
+ protocolType: 'V1',
1516
+ });
1517
+
1518
+ expect(probeProtocolV1).toHaveBeenCalledTimes(1);
1519
+ expect(callProtocolV1).toHaveBeenCalledTimes(1);
1520
+ expect(callProtocolV1.mock.calls[0]?.[1]).toBe('Initialize');
1521
+ expect(probeProtocolV2).not.toHaveBeenCalled();
1522
+ });
1523
+
1524
+ test('skips Initialize wake on Electron BLE when onlyConnectBleDevice is true', async () => {
1525
+ const device = { id: 'only-connect-classic-id', name: 'K1361' };
1526
+ const nobleBle = createNobleBle(device);
1527
+ const bleTransport = configureTransport(nobleBle);
1528
+ const probes = bleTransport as any;
1529
+ jest.spyOn(probes, 'probeProtocolV1').mockResolvedValue(false);
1530
+ jest.spyOn(probes, 'probeProtocolV2').mockResolvedValue(false);
1531
+ const callProtocolV1 = jest.spyOn(probes, 'callProtocolV1').mockResolvedValue({
1532
+ type: 'Features',
1533
+ message: {},
1534
+ });
1535
+
1536
+ await expect(
1537
+ bleTransport.acquire({ uuid: device.id, onlyConnectBleDevice: true })
1538
+ ).rejects.toBeDefined();
1539
+ expect(callProtocolV1).not.toHaveBeenCalled();
1540
+ });
1541
+
1542
+ test('propagates Windows pairing rejection from GetFeatures without consuming the wake for later reconnects', async () => {
1543
+ const device = { id: 'win-pairing-classic-id', name: 'K8141' };
1544
+ const nobleBle = createNobleBle(device);
1545
+ const bleTransport = configureTransport(nobleBle);
1546
+ const probes = bleTransport as any;
1547
+ const probeProtocolV2 = jest.spyOn(probes, 'probeProtocolV2').mockResolvedValue(false);
1548
+
1549
+ // Attempt 1: host aborts GetFeatures write after Windows pairing rejection.
1550
+ nobleBle.write.mockRejectedValueOnce(
1551
+ ERRORS.TypedError(
1552
+ HardwareErrorCode.BleConnectedError,
1553
+ 'Write failed with abortable error for device win-pairing-classic-id: status: 3'
1554
+ )
1555
+ );
1556
+ await expect(bleTransport.acquire({ uuid: device.id })).rejects.toMatchObject({
1557
+ errorCode: HardwareErrorCode.BleConnectedError,
1558
+ });
1559
+ expect(nobleBle.write).toHaveBeenCalledTimes(1);
1560
+ expect(probeProtocolV2).not.toHaveBeenCalled();
1561
+
1562
+ // Attempt 2: paired successfully, GetFeatures still silent (device asleep), so the
1563
+ // preserved wake sends a one-shot Initialize and confirms V1.
1564
+ nobleBle.write.mockClear();
1565
+ jest.spyOn(probes, 'probeProtocolV1').mockResolvedValueOnce(false);
1566
+ const callProtocolV1 = jest.spyOn(probes, 'callProtocolV1').mockResolvedValueOnce({
1567
+ type: 'Features',
1568
+ message: {},
1569
+ });
1570
+
1571
+ await expect(bleTransport.acquire({ uuid: device.id })).resolves.toMatchObject({
1572
+ uuid: device.id,
1573
+ protocolType: 'V1',
1574
+ });
1575
+ expect(callProtocolV1).toHaveBeenCalledWith(
1576
+ device.id,
1577
+ 'Initialize',
1578
+ {},
1579
+ { timeoutMs: 3000 },
1580
+ { oneShot: true },
1581
+ true
1582
+ );
1583
+ });
1584
+
1585
+ test('sends Initialize wake as a single one-shot native write and preserves wake when host proves write never started', async () => {
1586
+ const device = { id: 'oneshot-classic-id', name: 'K1361' };
1587
+ const nobleBle = createNobleBle(device);
1588
+ const bleTransport = configureTransport(nobleBle);
1589
+ const probes = bleTransport as any;
1590
+ jest.spyOn(probes, 'probeProtocolV1').mockResolvedValue(false);
1591
+ jest.spyOn(probes, 'probeProtocolV2').mockResolvedValue(false);
1592
+
1593
+ // Attempt 1: host rejects Initialize before submitting a GATT write.
1594
+ nobleBle.write.mockRejectedValueOnce(
1595
+ ERRORS.TypedError(
1596
+ HardwareErrorCode.BleCharacteristicNotFound,
1597
+ 'Device oneshot-classic-id not connected or characteristics not available'
1598
+ )
1599
+ );
1600
+ await expect(bleTransport.acquire({ uuid: device.id })).rejects.toMatchObject({
1601
+ errorCode: HardwareErrorCode.BleCharacteristicNotFound,
1602
+ });
1603
+ expect(nobleBle.write).toHaveBeenCalledTimes(1);
1604
+ expect(nobleBle.write.mock.calls[0]?.[2]).toEqual({ oneShot: true });
1605
+
1606
+ // Attempt 2: wake is still armed and executes one native write with { oneShot: true }.
1607
+ nobleBle.write.mockClear();
1608
+ let notifyHandler: ((id: string, hex: string) => void) | undefined;
1609
+ nobleBle.onNotification.mockImplementation(handler => {
1610
+ notifyHandler = handler;
1611
+ return jest.fn();
1612
+ });
1613
+ nobleBle.write.mockImplementationOnce((id: string) => {
1614
+ const reply = ProtocolV1.encodeTransportPackets(schemas.protocolV1, 'Success', {
1615
+ message: 'ok',
1616
+ });
1617
+ const packetHex = reply[0].toString('hex');
1618
+ const payloadLen = parseInt(packetHex.slice(10, 18), 16);
1619
+ notifyHandler?.(id, packetHex.slice(0, (9 + payloadLen) * 2));
1620
+ return Promise.resolve();
1621
+ });
1622
+
1623
+ await expect(bleTransport.acquire({ uuid: device.id })).resolves.toMatchObject({
1624
+ uuid: device.id,
1625
+ protocolType: 'V1',
1626
+ });
1627
+ expect(nobleBle.write).toHaveBeenCalledTimes(1);
1628
+ expect(nobleBle.write.mock.calls[0]?.[2]).toEqual({ oneShot: true });
1629
+ });
1630
+
1631
+ test('sends initial V1 GetFeatures probe with oneShot and rethrows TransportCallInProgress without waking', async () => {
1632
+ const device = { id: 'oneshot-getfeatures-id', name: 'K8141' };
1633
+ const nobleBle = createNobleBle(device);
1634
+ let notifyHandler: ((id: string, hex: string) => void) | undefined;
1635
+ nobleBle.onNotification.mockImplementation(handler => {
1636
+ notifyHandler = handler;
1637
+ return jest.fn();
1638
+ });
1639
+ nobleBle.write.mockImplementationOnce((id: string) => {
1640
+ const reply = ProtocolV1.encodeTransportPackets(schemas.protocolV1, 'Success', {
1641
+ message: 'ok',
1642
+ });
1643
+ const packetHex = reply[0].toString('hex');
1644
+ const payloadLen = parseInt(packetHex.slice(10, 18), 16);
1645
+ notifyHandler?.(id, packetHex.slice(0, (9 + payloadLen) * 2));
1646
+ return Promise.resolve();
1647
+ });
1648
+ const bleTransport = configureTransport(nobleBle);
1649
+
1650
+ await expect(bleTransport.acquire({ uuid: device.id })).resolves.toMatchObject({
1651
+ uuid: device.id,
1652
+ protocolType: 'V1',
1653
+ });
1654
+ expect(nobleBle.write).toHaveBeenCalledTimes(1);
1655
+ expect(nobleBle.write.mock.calls[0]?.[2]).toEqual({ oneShot: true });
1656
+
1657
+ await bleTransport.release(device.id);
1658
+
1659
+ const probes = bleTransport as any;
1660
+ const inProgressErr = ERRORS.TypedError(HardwareErrorCode.TransportCallInProgress);
1661
+ const callSpy = jest.spyOn(probes, 'callProtocolV1').mockRejectedValueOnce(inProgressErr);
1662
+ const wakeSpy = jest.spyOn(probes, 'wakeSilentProtocolV1Device');
1663
+
1664
+ await expect(bleTransport.acquire({ uuid: device.id })).rejects.toMatchObject({
1665
+ errorCode: HardwareErrorCode.TransportCallInProgress,
1666
+ });
1667
+ expect(callSpy).toHaveBeenCalledTimes(1);
1668
+ expect(wakeSpy).not.toHaveBeenCalled();
1669
+ });
1670
+
1671
+ test('skips Electron Initialize wake if abortSignal aborts during probe state reset', async () => {
1672
+ const device = { id: 'abort-reset-classic-id', name: 'K8141' };
1673
+ const nobleBle = createNobleBle(device);
1674
+ const bleTransport = configureTransport(nobleBle);
1675
+ const probes = bleTransport as any;
1676
+ const abortController = new AbortController();
1677
+ jest.spyOn(probes, 'probeProtocolV1').mockResolvedValue(false);
1678
+ jest.spyOn(probes, 'resetProbeStateAfterProtocolProbe').mockImplementation(() => {
1679
+ abortController.abort();
1680
+ return Promise.resolve();
1681
+ });
1682
+ const callProtocolV1 = jest.spyOn(probes, 'callProtocolV1');
1683
+
1684
+ await expect(
1685
+ bleTransport.acquire({ uuid: device.id, abortSignal: abortController.signal })
1686
+ ).rejects.toMatchObject({
1687
+ errorCode: HardwareErrorCode.DeviceInterruptedFromUser,
1688
+ });
1689
+ expect(callProtocolV1).not.toHaveBeenCalled();
1690
+ });
1691
+
1692
+ test('does not send Initialize wake when GetFeatures fails from an ordinary GATT write error', async () => {
1693
+ const device = { id: 'gatt-write-err-classic-id', name: 'K8141' };
1694
+ const nobleBle = createNobleBle(device);
1695
+ const bleTransport = configureTransport(nobleBle);
1696
+ const probes = bleTransport as any;
1697
+ const wakeSpy = jest.spyOn(probes, 'wakeSilentProtocolV1Device');
1698
+ jest.spyOn(probes, 'probeProtocolV2').mockResolvedValue(false);
1699
+ nobleBle.write.mockRejectedValueOnce(new Error('GATT write error'));
1700
+
1701
+ await expect(bleTransport.acquire({ uuid: device.id })).rejects.toMatchObject({
1702
+ errorCode: HardwareErrorCode.TransportProtocolProbeFailed,
1703
+ });
1704
+ expect(wakeSpy).not.toHaveBeenCalled();
1705
+ });
1706
+
1707
+ test('prevents a canceled acquire whose getDevice settles late from disconnecting a replacement acquire', async () => {
1708
+ const device = { id: 'superseded-acquire-id', name: 'K8141' };
1709
+ const nobleBle = createNobleBle(device);
1710
+ let resolveFirstGetDevice: ((d: typeof device) => void) | undefined;
1711
+ nobleBle.getDevice
1712
+ .mockImplementationOnce(
1713
+ () =>
1714
+ new Promise(resolve => {
1715
+ resolveFirstGetDevice = resolve;
1716
+ })
1717
+ )
1718
+ .mockResolvedValue(device);
1719
+ const bleTransport = configureTransport(nobleBle);
1720
+ const abortA = new AbortController();
1721
+
1722
+ const acquireA = bleTransport.acquire({
1723
+ uuid: device.id,
1724
+ expectedProtocol: 'V1',
1725
+ abortSignal: abortA.signal,
1726
+ });
1727
+ abortA.abort();
1728
+
1729
+ // Acquire B succeeds while acquire A is still waiting on getDevice.
1730
+ await expect(
1731
+ bleTransport.acquire({ uuid: device.id, expectedProtocol: 'V1' })
1732
+ ).resolves.toMatchObject({ uuid: device.id, protocolType: 'V1' });
1733
+ nobleBle.disconnect.mockClear();
1734
+ nobleBle.unsubscribe.mockClear();
1735
+
1736
+ // Acquire A resumes when its delayed lookup settles; it must not tear down B's link.
1737
+ resolveFirstGetDevice?.(device);
1738
+ await expect(acquireA).rejects.toMatchObject({
1739
+ errorCode: HardwareErrorCode.DeviceInterruptedFromUser,
1740
+ });
1741
+ expect(nobleBle.unsubscribe).not.toHaveBeenCalled();
1742
+ expect(nobleBle.disconnect).not.toHaveBeenCalled();
1743
+ expect(bleTransport.getProtocolType(device.id)).toBe('V1');
1744
+ });
1745
+
1746
+ test('restores wake eligibility when Windows rejects the Initialize wake write with writeRejected', async () => {
1747
+ const device = { id: 'win-wake-reject-id', name: 'K8141' };
1748
+ const nobleBle = createNobleBle(device);
1749
+ const bleTransport = configureTransport(nobleBle);
1750
+ const probes = bleTransport as any;
1751
+ jest.spyOn(probes, 'probeProtocolV1').mockResolvedValue(false);
1752
+ jest.spyOn(probes, 'probeProtocolV2').mockResolvedValue(false);
1753
+
1754
+ nobleBle.write.mockRejectedValueOnce(
1755
+ ERRORS.TypedError(
1756
+ HardwareErrorCode.BleConnectedError,
1757
+ 'Write failed with abortable error for device win-wake-reject-id: status: 3',
1758
+ { writeRejected: true }
1759
+ )
1760
+ );
1761
+ await expect(bleTransport.acquire({ uuid: device.id })).rejects.toMatchObject({
1762
+ errorCode: HardwareErrorCode.BleConnectedError,
1763
+ });
1764
+
1765
+ // After pairing succeeds on the next acquire, Initialize wake must still run.
1766
+ const callProtocolV1 = jest.spyOn(probes, 'callProtocolV1').mockResolvedValueOnce({
1767
+ type: 'Features',
1768
+ message: {},
1769
+ });
1770
+ await expect(bleTransport.acquire({ uuid: device.id })).resolves.toMatchObject({
1771
+ uuid: device.id,
1772
+ protocolType: 'V1',
1773
+ });
1774
+ expect(callProtocolV1).toHaveBeenCalledTimes(1);
1775
+ expect(callProtocolV1.mock.calls[0]?.[1]).toBe('Initialize');
1776
+ });
1777
+
1778
+ test('disconnects an ordinary 3000ms Initialize call on timeout instead of treating it as a probe', async () => {
1779
+ const device = { id: 'ordinary-init-3s-id', name: 'OneKey Classic' };
1780
+ const nobleBle = createNobleBle(device);
1781
+ nobleBle.onNotification.mockImplementation(() => jest.fn());
1782
+ nobleBle.write.mockImplementation(() => Promise.resolve());
1783
+ const bleTransport = configureTransport(nobleBle);
1784
+
1785
+ await bleTransport.acquire({ uuid: device.id, expectedProtocol: 'V1' });
1786
+ jest.useFakeTimers({ doNotFake: ['performance'] });
1787
+ try {
1788
+ const pending = bleTransport.call(device.id, 'Initialize', {}, { timeoutMs: 3000 });
1789
+ const expectation = expect(pending).rejects.toMatchObject({
1790
+ errorCode: HardwareErrorCode.BleTimeoutError,
1791
+ });
1792
+ await Promise.resolve();
1793
+ await Promise.resolve();
1794
+ jest.advanceTimersByTime(3000);
1795
+ await expectation;
1796
+ } finally {
1797
+ jest.useRealTimers();
1798
+ }
1799
+
1800
+ expect(nobleBle.disconnect).toHaveBeenCalledWith(device.id);
1801
+ expect(bleTransport.getProtocolType(device.id)).toBeUndefined();
1802
+ });
1803
+
1804
+ test('uses the post-connect device name for Electron legacy V1 wake when initial lookup has a placeholder name', async () => {
1805
+ const placeholder = { id: 'cold-classic-id', name: 'OneKey Device' };
1806
+ const connected = { id: 'cold-classic-id', name: 'K8141', mtu: 247 };
1807
+ const nobleBle = createNobleBle(placeholder);
1808
+ nobleBle.getDevice.mockResolvedValueOnce(placeholder).mockResolvedValueOnce(connected);
1809
+ const bleTransport = configureTransport(nobleBle);
1810
+ const probes = bleTransport as any;
1811
+ jest.spyOn(probes, 'probeProtocolV1').mockResolvedValue(false);
1812
+ const probeProtocolV2 = jest.spyOn(probes, 'probeProtocolV2').mockResolvedValue(false);
1813
+ const callProtocolV1 = jest.spyOn(probes, 'callProtocolV1').mockResolvedValue({
1814
+ type: 'Features',
1815
+ message: {},
1816
+ });
1817
+
1818
+ await expect(bleTransport.acquire({ uuid: placeholder.id })).resolves.toMatchObject({
1819
+ uuid: placeholder.id,
1820
+ name: 'K8141',
1821
+ protocolType: 'V1',
1822
+ });
1823
+ expect(callProtocolV1).toHaveBeenCalledTimes(1);
1824
+ expect(callProtocolV1.mock.calls[0]?.[1]).toBe('Initialize');
1825
+ expect(probeProtocolV2).not.toHaveBeenCalled();
1826
+ });
1827
+
1828
+ test('rejects an already-aborted acquire without releasing an existing Electron BLE link', async () => {
1829
+ const device = { id: 'existing-link-id', name: 'OneKey Classic' };
1830
+ const nobleBle = createNobleBle(device);
1831
+ const bleTransport = configureTransport(nobleBle);
1832
+ await bleTransport.acquire({ uuid: device.id, expectedProtocol: 'V1' });
1833
+
1834
+ const aborted = new AbortController();
1835
+ aborted.abort();
1836
+ const releaseSpy = jest.spyOn(bleTransport, 'release');
1837
+ nobleBle.disconnect.mockClear();
1838
+
1839
+ await expect(
1840
+ bleTransport.acquire({
1841
+ uuid: device.id,
1842
+ expectedProtocol: 'V1',
1843
+ abortSignal: aborted.signal,
1844
+ })
1845
+ ).rejects.toMatchObject({
1846
+ errorCode: HardwareErrorCode.DeviceInterruptedFromUser,
1847
+ });
1848
+ expect(releaseSpy).not.toHaveBeenCalled();
1849
+ expect(nobleBle.disconnect).not.toHaveBeenCalled();
1850
+ expect(bleTransport.getProtocolType(device.id)).toBe('V1');
1851
+ });
1375
1852
  });
@@ -16,6 +16,37 @@ const schema = {
16
16
  },
17
17
  };
18
18
 
19
+ test('reads a multi-packet V1 response without a global Buffer', async () => {
20
+ const webusb = new WebUsbTransport();
21
+ const messages = transport.parseConfigure(schema);
22
+ const response = { message: 'v1 response '.repeat(9) };
23
+ const expected = transport.ProtocolV1.encodeEnvelope(messages, 'Success', response).toString(
24
+ 'hex'
25
+ );
26
+ const packets = transport.ProtocolV1.encodeTransportPackets(messages, 'Success', response);
27
+ expect(packets.length).toBeGreaterThan(1);
28
+ const reader = webusb as unknown as {
29
+ transferInWithRetry: () => Promise<Uint8Array>;
30
+ };
31
+ const transferIn = jest.spyOn(reader, 'transferInWithRetry');
32
+ packets.forEach(packet => {
33
+ transferIn.mockResolvedValueOnce(new Uint8Array(packet.toBuffer()));
34
+ });
35
+ const buffer = globalThis.Buffer;
36
+ try {
37
+ Object.defineProperty(globalThis, 'Buffer', { value: undefined });
38
+ const received = await webusb.receiveData('synthetic-usb');
39
+ expect(received).toBe(expected);
40
+ expect(transport.ProtocolV1.decodeMessage(messages, received)).toMatchObject({
41
+ type: 'Success',
42
+ message: response,
43
+ });
44
+ } finally {
45
+ Object.defineProperty(globalThis, 'Buffer', { value: buffer });
46
+ transferIn.mockRestore();
47
+ }
48
+ });
49
+
19
50
  function buildAcquirableTransport(path = 'pro-webusb') {
20
51
  const webusb = new WebUsbTransport() as any;
21
52
  webusb.Log = { debug: jest.fn() };
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import type { Deferred } from '@onekeyfe/hd-shared';
3
3
  import type { DesktopAPI } from '@onekeyfe/hd-transport-electron';
4
- import type { OneKeyDeviceInfo, ProtocolType, TransportCallOptions } from '@onekeyfe/hd-transport';
4
+ import type { OneKeyDeviceInfo, ProtocolType, TransportCallOptions, TransportReleaseOptions } from '@onekeyfe/hd-transport';
5
5
  import type EventEmitter from 'events';
6
6
  declare global {
7
7
  interface Window {
@@ -13,6 +13,8 @@ export type BleAcquireInput = {
13
13
  forceCleanRunPromise?: boolean;
14
14
  expectedProtocol?: ProtocolType;
15
15
  protocolHint?: ProtocolType;
16
+ onlyConnectBleDevice?: boolean;
17
+ abortSignal?: AbortSignal;
16
18
  };
17
19
  export default class ElectronBleTransport {
18
20
  private _messages;
@@ -28,8 +30,15 @@ export default class ElectronBleTransport {
28
30
  private retainedDevices;
29
31
  private protocolV2CallCounts;
30
32
  private acquiringDevices;
33
+ private stopped;
34
+ private stopPromise?;
31
35
  private deviceProtocol;
32
36
  private deviceProtocolHints;
37
+ private silentDetections;
38
+ private probeResponseTimeoutErrors;
39
+ private lastV1ProbeFailedWithoutTimeout;
40
+ private acquireGenerations;
41
+ private nextAcquireGeneration;
33
42
  private deviceMtus;
34
43
  private devicePacketCapacities;
35
44
  private v1Buffers;
@@ -47,6 +56,9 @@ export default class ElectronBleTransport {
47
56
  private handleBluetoothError;
48
57
  private cleanupDeviceState;
49
58
  init(logger: any, emitter?: EventEmitter): void;
59
+ private assertRunning;
60
+ stop(): Promise<void>;
61
+ private stopResources;
50
62
  private subscribeHostDisconnects;
51
63
  configure(signedData: any): void;
52
64
  configureProtocolV2(signedData: any): void;
@@ -64,7 +76,7 @@ export default class ElectronBleTransport {
64
76
  bleColorCode?: string | undefined;
65
77
  protocolType?: ProtocolType | undefined;
66
78
  }>;
67
- release(id: string, onclose?: boolean, keepSession?: boolean): Promise<void>;
79
+ release(id: string, onclose?: boolean, keepSession?: boolean, options?: TransportReleaseOptions): Promise<void>;
68
80
  disconnect(id: string): Promise<void>;
69
81
  private releaseNative;
70
82
  private releaseLogical;
@@ -72,6 +84,7 @@ export default class ElectronBleTransport {
72
84
  private createProtocolDetectionError;
73
85
  private clearProbeProtocol;
74
86
  private detectProtocol;
87
+ private wakeSilentProtocolV1Device;
75
88
  private createNotificationSubscription;
76
89
  private resetProbeStateAfterProtocolProbe;
77
90
  private probeProtocolV1;
@@ -1 +1 @@
1
- {"version":3,"file":"electron-ble-transport.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iBjC,OAAO,CAAC,4BAA4B;IAqB9B,IAAI,CACR,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,oBAAoB;IAuB1B,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;YAatD,cAAc;YA+Fd,cAAc;IA+B5B,OAAO,CAAC,uBAAuB;IAyC/B,OAAO,CAAC,6BAA6B;IA4CrC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;CAGxD"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _onekeyfe_hd_transport from '@onekeyfe/hd-transport';
2
- import _onekeyfe_hd_transport__default, { ProtocolV2UsbTransportBase, AcquireInput, TransportCallOptions, ProtocolV2Schemas, ProtocolV2CallContext, ProtocolType, OneKeyDeviceInfoBase, OneKeyDeviceInfo } from '@onekeyfe/hd-transport';
2
+ import _onekeyfe_hd_transport__default, { ProtocolV2UsbTransportBase, AcquireInput, TransportCallOptions, ProtocolV2Schemas, ProtocolV2CallContext, ProtocolType, OneKeyDeviceInfoBase, OneKeyDeviceInfo, TransportReleaseOptions } from '@onekeyfe/hd-transport';
3
3
  import EventEmitter from 'events';
4
4
  import { Deferred } from '@onekeyfe/hd-shared';
5
5
  import { DesktopAPI } from '@onekeyfe/hd-transport-electron';
@@ -22,9 +22,9 @@ declare class WebUsbTransport extends ProtocolV2UsbTransportBase<string> {
22
22
  private handleOperationSequence;
23
23
  private deviceLogSequence;
24
24
  private deviceLogIds;
25
- messages: ReturnType<typeof _onekeyfe_hd_transport__default.parseConfigure> | undefined;
25
+ messages: ReturnType<typeof _onekeyfe_hd_transport__default.parseTransportConfigure> | undefined;
26
26
  /** Protobuf schema for Protocol V2 transports. */
27
- messagesV2: ReturnType<typeof _onekeyfe_hd_transport__default.parseConfigure> | undefined;
27
+ messagesV2: ReturnType<typeof _onekeyfe_hd_transport__default.parseTransportConfigure> | undefined;
28
28
  private protocolV2SchemaSource;
29
29
  /** Per-path protocol type detected by active wire-level probe. */
30
30
  private deviceProtocol;
@@ -237,6 +237,8 @@ type BleAcquireInput = {
237
237
  forceCleanRunPromise?: boolean;
238
238
  expectedProtocol?: ProtocolType;
239
239
  protocolHint?: ProtocolType;
240
+ onlyConnectBleDevice?: boolean;
241
+ abortSignal?: AbortSignal;
240
242
  };
241
243
  /**
242
244
  * Desktop Electron BLE transport with automatic Protocol V1/V2 detection.
@@ -265,8 +267,15 @@ declare class ElectronBleTransport {
265
267
  * the link; `releaseNative()` needs it to cancel that pending connect.
266
268
  */
267
269
  private acquiringDevices;
270
+ private stopped;
271
+ private stopPromise?;
268
272
  private deviceProtocol;
269
273
  private deviceProtocolHints;
274
+ private silentDetections;
275
+ private probeResponseTimeoutErrors;
276
+ private lastV1ProbeFailedWithoutTimeout;
277
+ private acquireGenerations;
278
+ private nextAcquireGeneration;
270
279
  private deviceMtus;
271
280
  private devicePacketCapacities;
272
281
  private v1Buffers;
@@ -293,6 +302,9 @@ declare class ElectronBleTransport {
293
302
  private handleBluetoothError;
294
303
  private cleanupDeviceState;
295
304
  init(logger: any, emitter?: EventEmitter): void;
305
+ private assertRunning;
306
+ stop(): Promise<void>;
307
+ private stopResources;
296
308
  /**
297
309
  * One host subscription for the whole transport lifetime. init() can run
298
310
  * again after an SDK reset, so drop the previous listener first rather than
@@ -315,7 +327,7 @@ declare class ElectronBleTransport {
315
327
  bleColorCode?: string | undefined;
316
328
  protocolType?: ProtocolType | undefined;
317
329
  }>;
318
- release(id: string, onclose?: boolean, keepSession?: boolean): Promise<void>;
330
+ release(id: string, onclose?: boolean, keepSession?: boolean, options?: TransportReleaseOptions): Promise<void>;
319
331
  disconnect(id: string): Promise<void>;
320
332
  private releaseNative;
321
333
  private releaseLogical;
@@ -323,6 +335,7 @@ declare class ElectronBleTransport {
323
335
  private createProtocolDetectionError;
324
336
  private clearProbeProtocol;
325
337
  private detectProtocol;
338
+ private wakeSilentProtocolV1Device;
326
339
  private createNotificationSubscription;
327
340
  private resetProbeStateAfterProtocolProbe;
328
341
  private probeProtocolV1;