@onekeyfe/hd-transport-web-device 1.2.11-alpha.8 → 1.2.11-alpha.9

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.
@@ -911,7 +911,7 @@ describe('WebUSB identity probe ownership', () => {
911
911
  );
912
912
 
913
913
  test.each([false, true])(
914
- 'keeps repeated V1 probes read-only during on-device setup (%s)',
914
+ 'uses a read-only V1 probe only for isolated discovery (%s)',
915
915
  async identityProbe => {
916
916
  const probe = new WebUsbTransport(identityProbe);
917
917
  const internals = probe as unknown as {
@@ -929,11 +929,7 @@ describe('WebUSB identity probe ownership', () => {
929
929
  .spyOn(internals, 'callProtocolV1')
930
930
  .mockResolvedValue({ type: 'Features', message: {} });
931
931
  await expect(internals.probeProtocolV1('USB_PATH')).resolves.toBe(true);
932
- await expect(internals.probeProtocolV1('USB_PATH')).resolves.toBe(true);
933
- expect(call).toHaveBeenCalledTimes(2);
934
- expect(call.mock.calls.map(([, name]) => name)).toEqual(['GetFeatures', 'GetFeatures']);
935
- call.mockResolvedValue({ type: 'Failure', message: {} });
936
- await expect(internals.probeProtocolV1('USB_PATH')).resolves.toBe(false);
932
+ expect(call.mock.calls[0][1]).toBe(identityProbe ? 'GetFeatures' : 'Initialize');
937
933
  }
938
934
  );
939
935
  });
@@ -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() };
@@ -121,17 +121,17 @@ describe('WebUsbTransport Protocol V2 timeout recovery', () => {
121
121
  expect(webusb.deviceProtocol.has(path)).toBe(false);
122
122
  });
123
123
 
124
- test('keeps the legacy WebUSB read-only probe timeout at five seconds', async () => {
124
+ test('allows legacy WebUSB Initialize up to the Node USB probe timeout', async () => {
125
125
  const webusb = new WebUsbTransport() as any;
126
126
  const path = 'pro-webusb';
127
127
  webusb.messages = {};
128
- webusb.callProtocolV1 = jest.fn().mockResolvedValue({ type: 'Features', message: {} });
128
+ webusb.callProtocolV1 = jest.fn().mockResolvedValue({});
129
129
 
130
130
  await expect(webusb.probeProtocolV1(path)).resolves.toBe(true);
131
131
 
132
132
  expect(webusb.callProtocolV1).toHaveBeenCalledWith(
133
133
  path,
134
- 'GetFeatures',
134
+ 'Initialize',
135
135
  {},
136
136
  {
137
137
  timeoutMs: 5000,
@@ -28,6 +28,8 @@ export default class ElectronBleTransport {
28
28
  private retainedDevices;
29
29
  private protocolV2CallCounts;
30
30
  private acquiringDevices;
31
+ private stopped;
32
+ private stopPromise?;
31
33
  private deviceProtocol;
32
34
  private deviceProtocolHints;
33
35
  private deviceMtus;
@@ -47,6 +49,9 @@ export default class ElectronBleTransport {
47
49
  private handleBluetoothError;
48
50
  private cleanupDeviceState;
49
51
  init(logger: any, emitter?: EventEmitter): void;
52
+ private assertRunning;
53
+ stop(): Promise<void>;
54
+ private stopResources;
50
55
  private subscribeHostDisconnects;
51
56
  configure(signedData: any): void;
52
57
  configureProtocolV2(signedData: any): void;
@@ -1 +1 @@
1
- {"version":3,"file":"electron-ble-transport.d.ts","sourceRoot":"","sources":["../src/electron-ble-transport.ts"],"names":[],"mappings":";AAyBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAA4B,MAAM,iCAAiC,CAAC;AAC5F,OAAO,KAAK,EAEV,gBAAgB,EAChB,YAAY,EAEZ,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AAIvC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,UAAU,CAAC,EAAE,UAAU,CAAC;KACzB;CACF;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,gBAAgB,CAAC,EAAE,YAAY,CAAC;IAChC,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAiGF,MAAM,CAAC,OAAO,OAAO,oBAAoB;IACvC,OAAO,CAAC,SAAS,CAA0D;IAE3E,OAAO,CAAC,WAAW,CAA0D;IAE7E,OAAO,CAAC,6BAA6B,CAAqB;IAE1D,IAAI,SAA0B;IAE9B,UAAU,UAAS;IAEnB,UAAU,EAAE,QAAQ,CAAC,UAAU,GAAG,MAAM,CAAC,GAAG,IAAI,CAAQ;IAExD,OAAO,CAAC,kBAAkB,CAAuB;IAEjD,GAAG,CAAC,EAAE,GAAG,CAAC;IAEV,OAAO,CAAC,EAAE,YAAY,CAAC;IAEvB,OAAO,CAAC,gBAAgB,CAA0B;IAElD,OAAO,CAAC,eAAe,CAA0B;IAEjD,OAAO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I,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;YAqFd,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
@@ -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;
@@ -265,6 +265,8 @@ declare class ElectronBleTransport {
265
265
  * the link; `releaseNative()` needs it to cancel that pending connect.
266
266
  */
267
267
  private acquiringDevices;
268
+ private stopped;
269
+ private stopPromise?;
268
270
  private deviceProtocol;
269
271
  private deviceProtocolHints;
270
272
  private deviceMtus;
@@ -293,6 +295,9 @@ declare class ElectronBleTransport {
293
295
  private handleBluetoothError;
294
296
  private cleanupDeviceState;
295
297
  init(logger: any, emitter?: EventEmitter): void;
298
+ private assertRunning;
299
+ stop(): Promise<void>;
300
+ private stopResources;
296
301
  /**
297
302
  * One host subscription for the whole transport lifetime. init() can run
298
303
  * again after an SDK reset, so drop the previous listener first rather than
package/dist/index.js CHANGED
@@ -41,7 +41,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
41
41
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
42
42
  };
43
43
 
44
- const { parseConfigure: parseConfigure$1, check: check$1, ProtocolV1: ProtocolV1$1 } = transport__default["default"];
44
+ const { parseTransportConfigure: parseTransportConfigure$1, check: check$1, ProtocolV1: ProtocolV1$1 } = transport__default["default"];
45
45
  const CONFIGURATION_ID = 1;
46
46
  const INTERFACE_ID = 0;
47
47
  const ENDPOINT_ID = 1;
@@ -320,7 +320,7 @@ class WebUsbTransport extends transport.ProtocolV2UsbTransportBase {
320
320
  this.probedDeviceObjects.delete(path);
321
321
  }
322
322
  configure(signedData) {
323
- const messages = parseConfigure$1(signedData);
323
+ const messages = parseTransportConfigure$1(signedData);
324
324
  this.configured = true;
325
325
  this.messages = messages;
326
326
  }
@@ -332,7 +332,7 @@ class WebUsbTransport extends transport.ProtocolV2UsbTransportBase {
332
332
  if (schemaSource === this.protocolV2SchemaSource)
333
333
  return;
334
334
  const hadProtocolV2Schema = this.protocolV2SchemaSource !== undefined;
335
- this.messagesV2 = parseConfigure$1(signedData);
335
+ this.messagesV2 = parseTransportConfigure$1(signedData);
336
336
  this.protocolV2SchemaSource = schemaSource;
337
337
  if (!hadProtocolV2Schema)
338
338
  return;
@@ -1315,10 +1315,10 @@ class WebUsbTransport extends transport.ProtocolV2UsbTransportBase {
1315
1315
  return false;
1316
1316
  }
1317
1317
  try {
1318
- const response = yield this.callProtocolV1(path, 'GetFeatures', {}, {
1318
+ const response = yield this.callProtocolV1(path, this.identityProbe ? 'GetFeatures' : 'Initialize', {}, {
1319
1319
  timeoutMs: PROTOCOL_V1_PROBE_TIMEOUT,
1320
1320
  });
1321
- return response.type === 'Features';
1321
+ return !this.identityProbe || response.type === 'Features';
1322
1322
  }
1323
1323
  catch (error) {
1324
1324
  if (this.isWebUsbIoHardwareError(error))
@@ -1428,8 +1428,7 @@ class WebUsbTransport extends transport.ProtocolV2UsbTransportBase {
1428
1428
  }
1429
1429
  }
1430
1430
  decoded.reset();
1431
- const result = decoded.toBuffer();
1432
- return Buffer.from(result).toString('hex');
1431
+ return decoded.toString('hex');
1433
1432
  });
1434
1433
  }
1435
1434
  release(path) {
@@ -1505,7 +1504,7 @@ function resolveBlePacketCapacity(mtu, maximumPacketCapacity, fallbackPacketCapa
1505
1504
  return Math.min(maximumPacketCapacity, Math.floor(mtu) - BLE_ATT_HEADER_BYTES);
1506
1505
  }
1507
1506
 
1508
- const { parseConfigure, ProtocolV1, check } = transport__default["default"];
1507
+ const { parseTransportConfigure, ProtocolV1, check } = transport__default["default"];
1509
1508
  const toBleDescriptor = (device, protocolType) => (Object.assign(Object.assign({ id: device.id, name: device.name, path: device.id, debug: false, commType: 'electron-ble' }, (device.bleColorCode ? { bleColorCode: device.bleColorCode } : {})), (protocolType ? { protocolType } : {})));
1510
1509
  const invokeNobleBle = (request) => __awaiter(void 0, void 0, void 0, function* () {
1511
1510
  const response = yield request;
@@ -1525,41 +1524,6 @@ const BLE_PACKET_SIZE_MAXIMUM = 244;
1525
1524
  const BLE_WRITE_DELAY_MS = 5;
1526
1525
  const PROTOCOL_PROBE_TIMEOUT_MS = 3000;
1527
1526
  const PROTOCOL_V2_PROBE_TIMEOUT_MS = 5000;
1528
- const isSilentWindowsPairingNoResponse = (error) => {
1529
- if (!error || typeof error !== 'object') {
1530
- return false;
1531
- }
1532
- const candidate = error;
1533
- const code = candidate.errorCode;
1534
- if (code !== hdShared.HardwareErrorCode.BleDeviceBondError && code !== hdShared.HardwareErrorCode.BleBondInvalid) {
1535
- return false;
1536
- }
1537
- const { params } = candidate;
1538
- if (!params || typeof params !== 'object') {
1539
- return false;
1540
- }
1541
- const { phase, platform, stage, reason, nativeErrorMessage } = params;
1542
- if (phase !== 'pairing' || platform !== 'win32' || stage !== 'write') {
1543
- return false;
1544
- }
1545
- if (typeof nativeErrorMessage === 'string' && nativeErrorMessage.length > 0) {
1546
- return false;
1547
- }
1548
- return reason === 'pairing_no_response' || reason === 'stale_bond';
1549
- };
1550
- const shouldRethrowProtocolProbeError = (error, isLastProbe = false) => {
1551
- if (transport.isProtocolV2LinkDisabledError(error)) {
1552
- return true;
1553
- }
1554
- if (isSilentWindowsPairingNoResponse(error)) {
1555
- return isLastProbe;
1556
- }
1557
- const code = error === null || error === void 0 ? void 0 : error.errorCode;
1558
- return (code === hdShared.HardwareErrorCode.BleDeviceBondError ||
1559
- code === hdShared.HardwareErrorCode.BleDeviceBondedCanceled ||
1560
- code === hdShared.HardwareErrorCode.BlePeerRemovedPairingInformation ||
1561
- code === hdShared.HardwareErrorCode.BleBondInvalid);
1562
- };
1563
1527
  class ElectronBleTransport {
1564
1528
  constructor() {
1565
1529
  this.name = 'ElectronBleTransport';
@@ -1570,6 +1534,7 @@ class ElectronBleTransport {
1570
1534
  this.retainedDevices = new Set();
1571
1535
  this.protocolV2CallCounts = new Map();
1572
1536
  this.acquiringDevices = new Set();
1537
+ this.stopped = false;
1573
1538
  this.deviceProtocol = new Map();
1574
1539
  this.deviceProtocolHints = new Map();
1575
1540
  this.deviceMtus = new Map();
@@ -1674,6 +1639,8 @@ class ElectronBleTransport {
1674
1639
  }
1675
1640
  init(logger, emitter) {
1676
1641
  var _a, _b;
1642
+ this.stopped = false;
1643
+ this.stopPromise = undefined;
1677
1644
  this.Log = logger;
1678
1645
  this.emitter = emitter;
1679
1646
  if (!((_a = window.desktopApi) === null || _a === void 0 ? void 0 : _a.nobleBle)) {
@@ -1682,6 +1649,41 @@ class ElectronBleTransport {
1682
1649
  this.subscribeHostDisconnects();
1683
1650
  (_b = this.Log) === null || _b === void 0 ? void 0 : _b.debug('[Electron BLE] Transport initialized');
1684
1651
  }
1652
+ assertRunning() {
1653
+ if (this.stopped) {
1654
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Electron BLE transport is stopped');
1655
+ }
1656
+ }
1657
+ stop() {
1658
+ var _a;
1659
+ this.stopped = true;
1660
+ (_a = this.hostDisconnectCleanup) === null || _a === void 0 ? void 0 : _a.call(this);
1661
+ this.hostDisconnectCleanup = undefined;
1662
+ if (!this.stopPromise) {
1663
+ this.stopPromise = this.stopResources();
1664
+ }
1665
+ return this.stopPromise;
1666
+ }
1667
+ stopResources() {
1668
+ return __awaiter(this, void 0, void 0, function* () {
1669
+ const trackedDeviceIds = new Set([
1670
+ ...this.connectedDevices,
1671
+ ...this.retainedDevices,
1672
+ ...this.acquiringDevices,
1673
+ ...this.notificationCleanups.keys(),
1674
+ ...this.mtuCleanups.keys(),
1675
+ ...this.deviceProtocol.keys(),
1676
+ ...this.v1Buffers.keys(),
1677
+ ...this.v2Assemblers.keys(),
1678
+ ]);
1679
+ yield Promise.all(Array.from(trackedDeviceIds, deviceId => this.releaseNative(deviceId)));
1680
+ this.acquiringDevices.clear();
1681
+ this.protocolV2CallCounts.clear();
1682
+ yield this.protocolV2Links
1683
+ .dispose('Electron BLE transport stopped')
1684
+ .catch(error => { var _a; return (_a = this.Log) === null || _a === void 0 ? void 0 : _a.debug('[Electron BLE] link dispose failed:', error); });
1685
+ });
1686
+ }
1685
1687
  subscribeHostDisconnects() {
1686
1688
  var _a, _b, _c;
1687
1689
  (_a = this.hostDisconnectCleanup) === null || _a === void 0 ? void 0 : _a.call(this);
@@ -1700,7 +1702,7 @@ class ElectronBleTransport {
1700
1702
  });
1701
1703
  }
1702
1704
  configure(signedData) {
1703
- this._messages = parseConfigure(signedData);
1705
+ this._messages = parseTransportConfigure(signedData);
1704
1706
  this.configured = true;
1705
1707
  }
1706
1708
  configureProtocolV2(signedData) {
@@ -1709,7 +1711,7 @@ class ElectronBleTransport {
1709
1711
  return;
1710
1712
  }
1711
1713
  const isReconfiguration = this.protocolV2SchemaConfiguration !== undefined;
1712
- this._messagesV2 = parseConfigure(signedData);
1714
+ this._messagesV2 = parseTransportConfigure(signedData);
1713
1715
  this.protocolV2SchemaConfiguration = configuration;
1714
1716
  if (isReconfiguration) {
1715
1717
  this.protocolV2Links
@@ -1765,12 +1767,15 @@ class ElectronBleTransport {
1765
1767
  this.runPromise = null;
1766
1768
  this.runPromiseDeviceId = null;
1767
1769
  }
1770
+ this.assertRunning();
1768
1771
  this.acquiringDevices.add(uuid);
1772
+ let connectAttempted = false;
1769
1773
  try {
1770
1774
  if (!((_a = window.desktopApi) === null || _a === void 0 ? void 0 : _a.nobleBle)) {
1771
1775
  throw new Error('Noble BLE API not available');
1772
1776
  }
1773
1777
  const device = yield invokeNobleBle(window.desktopApi.nobleBle.getDevice(uuid));
1778
+ this.assertRunning();
1774
1779
  if (!device) {
1775
1780
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound, `Device ${uuid} not found`);
1776
1781
  }
@@ -1787,12 +1792,14 @@ class ElectronBleTransport {
1787
1792
  this.deviceProtocolHints.set(uuid, protocolHint);
1788
1793
  }
1789
1794
  try {
1795
+ connectAttempted = true;
1790
1796
  yield invokeNobleBle(window.desktopApi.nobleBle.connect(uuid));
1791
1797
  this.connectedDevices.add(uuid);
1792
1798
  }
1793
1799
  catch (error) {
1794
1800
  this.handleBluetoothError(error);
1795
1801
  }
1802
+ this.assertRunning();
1796
1803
  const mtuCleanup = this.createMtuSubscription(uuid);
1797
1804
  if (mtuCleanup) {
1798
1805
  this.mtuCleanups.set(uuid, mtuCleanup);
@@ -1806,9 +1813,11 @@ class ElectronBleTransport {
1806
1813
  this.handleBluetoothError(error);
1807
1814
  }
1808
1815
  yield this.refreshBlePacketCapacity(uuid);
1816
+ this.assertRunning();
1809
1817
  const cleanup = this.createNotificationSubscription(uuid);
1810
1818
  this.notificationCleanups.set(uuid, cleanup);
1811
1819
  const protocolType = yield this.detectProtocol(uuid, expectedProtocol, protocolHint);
1820
+ this.assertRunning();
1812
1821
  if (protocolType === 'V2') {
1813
1822
  (_c = this.Log) === null || _c === void 0 ? void 0 : _c.debug('[Electron BLE] Protocol V2 write configured', {
1814
1823
  writeMode: 'withoutResponse',
@@ -1822,7 +1831,7 @@ class ElectronBleTransport {
1822
1831
  (_e = this.Log) === null || _e === void 0 ? void 0 : _e.error('[Electron BLE] acquire failed:', error);
1823
1832
  try {
1824
1833
  const nobleBle = (_f = window.desktopApi) === null || _f === void 0 ? void 0 : _f.nobleBle;
1825
- if (nobleBle) {
1834
+ if (nobleBle && !this.stopped && (connectAttempted || this.connectedDevices.has(uuid))) {
1826
1835
  if (this.connectedDevices.has(uuid)) {
1827
1836
  yield invokeNobleBle(nobleBle.unsubscribe(uuid)).catch(cleanupError => {
1828
1837
  var _a;
@@ -1953,13 +1962,10 @@ class ElectronBleTransport {
1953
1962
  const probeOrder = protocolHint === 'V2' || this.deviceProtocol.get(uuid) === 'V2' ? ['V2', 'V1'] : ['V1', 'V2'];
1954
1963
  for (let i = 0; i < probeOrder.length; i += 1) {
1955
1964
  const protocol = probeOrder[i];
1956
- const isLastProbe = i === probeOrder.length - 1;
1957
1965
  if (i > 0) {
1958
1966
  yield this.resetProbeStateAfterProtocolProbe(uuid, probeOrder[i - 1]);
1959
1967
  }
1960
- const detected = protocol === 'V1'
1961
- ? yield this.probeProtocolV1(uuid, isLastProbe)
1962
- : yield this.probeProtocolV2(uuid, undefined, isLastProbe);
1968
+ const detected = protocol === 'V1' ? yield this.probeProtocolV1(uuid) : yield this.probeProtocolV2(uuid);
1963
1969
  if (detected) {
1964
1970
  this.deviceProtocol.set(uuid, protocol);
1965
1971
  (_c = this.Log) === null || _c === void 0 ? void 0 : _c.debug(`[Electron BLE] detectProtocol: uuid=${uuid} -> ${protocol}`);
@@ -2003,7 +2009,7 @@ class ElectronBleTransport {
2003
2009
  }
2004
2010
  });
2005
2011
  }
2006
- probeProtocolV1(uuid, isLastProbe = false) {
2012
+ probeProtocolV1(uuid) {
2007
2013
  var _a;
2008
2014
  return __awaiter(this, void 0, void 0, function* () {
2009
2015
  if (!this._messages) {
@@ -2017,14 +2023,14 @@ class ElectronBleTransport {
2017
2023
  catch (error) {
2018
2024
  this.clearProbeProtocol(uuid, 'V1');
2019
2025
  (_a = this.Log) === null || _a === void 0 ? void 0 : _a.debug('[Electron BLE] Protocol V1 GetFeatures probe failed:', error);
2020
- if (shouldRethrowProtocolProbeError(error, isLastProbe)) {
2026
+ if (transport.isProtocolV2LinkDisabledError(error)) {
2021
2027
  throw error;
2022
2028
  }
2023
2029
  return false;
2024
2030
  }
2025
2031
  });
2026
2032
  }
2027
- probeProtocolV2(uuid, expectedProtocol, isLastProbe = false) {
2033
+ probeProtocolV2(uuid, expectedProtocol) {
2028
2034
  var _a;
2029
2035
  return __awaiter(this, void 0, void 0, function* () {
2030
2036
  if (!this._messages || !this._messagesV2) {
@@ -2032,28 +2038,22 @@ class ElectronBleTransport {
2032
2038
  }
2033
2039
  this.deviceProtocol.set(uuid, 'V2');
2034
2040
  (_a = this.v2Assemblers.get(uuid)) === null || _a === void 0 ? void 0 : _a.reset();
2035
- try {
2036
- const detected = yield transport.probeProtocolV2({
2037
- call: (name, data, options) => this.callProtocolV2(uuid, name, data, options),
2038
- timeoutMs: PROTOCOL_V2_PROBE_TIMEOUT_MS,
2039
- logger: this.Log,
2040
- logPrefix: 'ProtocolV2 BLE',
2041
- onProbeFailed: () => {
2042
- var _a;
2043
- (_a = this.v2Assemblers.get(uuid)) === null || _a === void 0 ? void 0 : _a.reset();
2044
- this.resetProtocolV2Frames(uuid);
2045
- },
2046
- shouldRethrow: error => expectedProtocol === 'V2' || shouldRethrowProtocolProbeError(error, isLastProbe),
2047
- });
2048
- if (!detected) {
2049
- this.clearProbeProtocol(uuid, 'V2');
2050
- }
2051
- return detected;
2052
- }
2053
- catch (error) {
2041
+ const detected = yield transport.probeProtocolV2({
2042
+ call: (name, data, options) => this.callProtocolV2(uuid, name, data, options),
2043
+ timeoutMs: PROTOCOL_V2_PROBE_TIMEOUT_MS,
2044
+ logger: this.Log,
2045
+ logPrefix: 'ProtocolV2 BLE',
2046
+ onProbeFailed: () => {
2047
+ var _a;
2048
+ (_a = this.v2Assemblers.get(uuid)) === null || _a === void 0 ? void 0 : _a.reset();
2049
+ this.resetProtocolV2Frames(uuid);
2050
+ },
2051
+ shouldRethrow: error => expectedProtocol === 'V2' || transport.isProtocolV2LinkDisabledError(error),
2052
+ });
2053
+ if (!detected) {
2054
2054
  this.clearProbeProtocol(uuid, 'V2');
2055
- throw error;
2056
2055
  }
2056
+ return detected;
2057
2057
  });
2058
2058
  }
2059
2059
  writeOnce(uuid, hexData) {
package/dist/webusb.d.ts CHANGED
@@ -18,8 +18,8 @@ export default class WebUsbTransport extends ProtocolV2UsbTransportBase<string>
18
18
  private handleOperationSequence;
19
19
  private deviceLogSequence;
20
20
  private deviceLogIds;
21
- messages: ReturnType<typeof transport.parseConfigure> | undefined;
22
- messagesV2: ReturnType<typeof transport.parseConfigure> | undefined;
21
+ messages: ReturnType<typeof transport.parseTransportConfigure> | undefined;
22
+ messagesV2: ReturnType<typeof transport.parseTransportConfigure> | undefined;
23
23
  private protocolV2SchemaSource;
24
24
  private deviceProtocol;
25
25
  private confirmedDeviceProtocols;
@@ -1 +1 @@
1
- {"version":3,"file":"webusb.d.ts","sourceRoot":"","sources":["../src/webusb.ts"],"names":[],"mappings":";;AACA,OAAO,SAAS,EAAE,EAQhB,0BAA0B,EAG3B,MAAM,wBAAwB,CAAC;AAahC,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EACV,YAAY,EACZ,oBAAoB,EACpB,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AA0BhC,MAAM,WAAW,UAAW,SAAQ,oBAAoB;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,CAAC;IAClB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AA2BD,UAAU,oBAAoB;IAC5B,gBAAgB,CAAC,EAAE,YAAY,CAAC;IAChC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAmCD,MAAM,C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CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IA+C5C,OAAO,CAAC,IAAI,EAAE,MAAM;IA8B1B,SAAS,CAAC,uBAAuB,IAAI,iBAAiB;IAUtD,SAAS,CAAC,sBAAsB;cAIhB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC,IAAI,CAAC;cAIA,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC,UAAU,CAAC;cASN,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1F,SAAS,CAAC,8BAA8B,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAKrE,SAAS,CAAC,+BAA+B,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,KAAK;IAWjF,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;CAGxD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-transport-web-device",
3
- "version": "1.2.11-alpha.8",
3
+ "version": "1.2.11-alpha.9",
4
4
  "author": "OneKey",
5
5
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
6
6
  "license": "MIT",
@@ -21,13 +21,14 @@
21
21
  "lint:fix": "eslint . --fix"
22
22
  },
23
23
  "dependencies": {
24
- "@onekeyfe/hd-shared": "1.2.11-alpha.8",
25
- "@onekeyfe/hd-transport": "1.2.11-alpha.8"
24
+ "@onekeyfe/hd-shared": "1.2.11-alpha.9",
25
+ "@onekeyfe/hd-transport": "1.2.11-alpha.9",
26
+ "bytebuffer": "^5.0.1"
26
27
  },
27
28
  "devDependencies": {
28
- "@onekeyfe/hd-transport-electron": "1.2.11-alpha.8",
29
+ "@onekeyfe/hd-transport-electron": "1.2.11-alpha.9",
29
30
  "@types/w3c-web-usb": "^1.0.6",
30
31
  "@types/web-bluetooth": "^0.0.17"
31
32
  },
32
- "gitHead": "f2f0e4af13efbb09f4b421171142f9144124a1c2"
33
+ "gitHead": "42a772503abc1acb973bc31232a4c30f113034d1"
33
34
  }