@onekeyfe/hd-transport-web-device 1.2.0-alpha.15 → 1.2.0-alpha.151
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__/electron-ble-transport.test.ts +439 -27
- package/__tests__/webusb-protocol-cache.test.ts +244 -0
- package/__tests__/webusb-protocol-v2-timeout.test.ts +363 -11
- package/dist/ble-packet-capacity.d.ts +2 -0
- package/dist/ble-packet-capacity.d.ts.map +1 -0
- package/dist/electron-ble-transport.d.ts +17 -3
- package/dist/electron-ble-transport.d.ts.map +1 -1
- package/dist/index.d.ts +146 -12
- package/dist/index.js +428 -281
- package/dist/transportLog.d.ts +1 -6
- package/dist/transportLog.d.ts.map +1 -1
- package/dist/webusb.d.ts +20 -10
- package/dist/webusb.d.ts.map +1 -1
- package/jest.config.js +5 -0
- package/package.json +6 -5
- package/src/ble-packet-capacity.ts +13 -0
- package/src/electron-ble-transport.ts +252 -115
- package/src/transportLog.ts +1 -11
- package/src/webusb.ts +305 -204
|
@@ -12,24 +12,32 @@ export type BleAcquireInput = {
|
|
|
12
12
|
uuid: string;
|
|
13
13
|
forceCleanRunPromise?: boolean;
|
|
14
14
|
expectedProtocol?: ProtocolType;
|
|
15
|
+
protocolHint?: ProtocolType;
|
|
15
16
|
};
|
|
16
17
|
export default class ElectronBleTransport {
|
|
17
18
|
private _messages;
|
|
18
19
|
private _messagesV2;
|
|
20
|
+
private protocolV2SchemaConfiguration;
|
|
19
21
|
name: string;
|
|
20
22
|
configured: boolean;
|
|
21
23
|
runPromise: Deferred<Uint8Array | string> | null;
|
|
24
|
+
private runPromiseDeviceId;
|
|
22
25
|
Log?: any;
|
|
23
26
|
emitter?: EventEmitter;
|
|
24
27
|
private connectedDevices;
|
|
25
28
|
private deviceProtocol;
|
|
26
29
|
private deviceProtocolHints;
|
|
30
|
+
private confirmedProtocolV2;
|
|
31
|
+
private deviceMtus;
|
|
32
|
+
private devicePacketCapacities;
|
|
27
33
|
private v1Buffers;
|
|
28
34
|
private v2Assemblers;
|
|
29
35
|
private v2FrameQueues;
|
|
30
36
|
private v2FramePromises;
|
|
31
37
|
private protocolV2Links;
|
|
38
|
+
private warnedMissingRelease;
|
|
32
39
|
private notificationCleanups;
|
|
40
|
+
private mtuCleanups;
|
|
33
41
|
private disconnectCleanups;
|
|
34
42
|
private notificationTokens;
|
|
35
43
|
private nextNotificationToken;
|
|
@@ -51,7 +59,10 @@ export default class ElectronBleTransport {
|
|
|
51
59
|
name: string | null;
|
|
52
60
|
protocolType?: ProtocolType | undefined;
|
|
53
61
|
}>;
|
|
54
|
-
release(id: string): Promise<void>;
|
|
62
|
+
release(id: string, _onclose?: boolean, keepSession?: boolean): Promise<void>;
|
|
63
|
+
disconnect(id: string): Promise<void>;
|
|
64
|
+
private releaseNative;
|
|
65
|
+
private releaseLogical;
|
|
55
66
|
private createProtocolMismatchError;
|
|
56
67
|
private createProtocolDetectionError;
|
|
57
68
|
private clearProbeProtocol;
|
|
@@ -60,18 +71,21 @@ export default class ElectronBleTransport {
|
|
|
60
71
|
private resetProbeStateAfterProtocolProbe;
|
|
61
72
|
private probeProtocolV1;
|
|
62
73
|
private probeProtocolV2;
|
|
63
|
-
private writeWithChunking;
|
|
64
74
|
private writeOnce;
|
|
75
|
+
private refreshBlePacketCapacity;
|
|
76
|
+
private updateBlePacketCapacity;
|
|
77
|
+
private createMtuSubscription;
|
|
78
|
+
private writeProtocolV2Frame;
|
|
65
79
|
private handleNotification;
|
|
66
80
|
private handleProtocolV2Notification;
|
|
67
81
|
private getProtocolV2FrameQueue;
|
|
68
82
|
private resolveProtocolV2Frame;
|
|
69
|
-
private rejectAllProtocolV2Frames;
|
|
70
83
|
private resetProtocolV2Frames;
|
|
71
84
|
private rejectProtocolV2Frames;
|
|
72
85
|
private readProtocolV2Frame;
|
|
73
86
|
private handleProtocolV1Notification;
|
|
74
87
|
call(uuid: string, name: string, data: Record<string, unknown>, options?: TransportCallOptions): Promise<import("@onekeyfe/hd-transport").MessageFromOneKey>;
|
|
88
|
+
post(uuid: string, name: string, data: Record<string, unknown>): Promise<void>;
|
|
75
89
|
private callProtocolV1;
|
|
76
90
|
private callProtocolV2;
|
|
77
91
|
private createProtocolV2Adapter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electron-ble-transport.d.ts","sourceRoot":"","sources":["../src/electron-ble-transport.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"electron-ble-transport.d.ts","sourceRoot":"","sources":["../src/electron-ble-transport.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,51 +1,136 @@
|
|
|
1
1
|
import * as _onekeyfe_hd_transport from '@onekeyfe/hd-transport';
|
|
2
|
-
import _onekeyfe_hd_transport__default, { AcquireInput, TransportCallOptions, ProtocolType, OneKeyDeviceInfoBase, OneKeyDeviceInfo } from '@onekeyfe/hd-transport';
|
|
2
|
+
import _onekeyfe_hd_transport__default, { ProtocolV2UsbTransportBase, AcquireInput, TransportCallOptions, ProtocolV2Schemas, ProtocolV2CallContext, ProtocolType, OneKeyDeviceInfoBase, OneKeyDeviceInfo } from '@onekeyfe/hd-transport';
|
|
3
3
|
import { Deferred } from '@onekeyfe/hd-shared';
|
|
4
4
|
import { DesktopAPI } from '@onekeyfe/hd-transport-electron';
|
|
5
5
|
import EventEmitter from 'events';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Device information with path and WebUSB device instance
|
|
9
|
+
*/
|
|
7
10
|
interface DeviceInfo extends OneKeyDeviceInfoBase {
|
|
8
11
|
path: string;
|
|
9
12
|
device: USBDevice;
|
|
10
13
|
protocolType?: ProtocolType;
|
|
11
14
|
}
|
|
12
|
-
declare class WebUsbTransport {
|
|
15
|
+
declare class WebUsbTransport extends ProtocolV2UsbTransportBase<string> {
|
|
13
16
|
messages: ReturnType<typeof _onekeyfe_hd_transport__default.parseConfigure> | undefined;
|
|
17
|
+
/** Protobuf schema for Protocol V2 transports. */
|
|
14
18
|
messagesV2: ReturnType<typeof _onekeyfe_hd_transport__default.parseConfigure> | undefined;
|
|
19
|
+
private protocolV2SchemaSource;
|
|
20
|
+
/** Per-path protocol type detected by active wire-level probe. */
|
|
15
21
|
private deviceProtocol;
|
|
16
22
|
private deviceProtocolHints;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Paths whose cached protocol must be re-probed on the next acquire (a USB
|
|
25
|
+
* disconnect was seen, or a transfer-level reconnect happened mid-call).
|
|
26
|
+
*/
|
|
27
|
+
private staleProtocolPaths;
|
|
28
|
+
/** Paths currently acquired (between a successful acquire() and its release()). */
|
|
29
|
+
private acquiredPaths;
|
|
30
|
+
/**
|
|
31
|
+
* The exact USBDevice object each cached protocol was probed against. The
|
|
32
|
+
* browser returns the same object identity for a device as long as it stays
|
|
33
|
+
* connected, and a replug/reboot always yields a new object — so an identity
|
|
34
|
+
* mismatch proves the device was re-enumerated since the probe, even when the
|
|
35
|
+
* disconnect event itself was delayed or missed.
|
|
36
|
+
*/
|
|
37
|
+
private probedDeviceObjects;
|
|
38
|
+
/** Per-path USB endpoint / interface numbers (discovered from USB descriptors) */
|
|
20
39
|
private deviceEndpoints;
|
|
21
|
-
private mockSerialPaths;
|
|
22
|
-
private mockSerialCounter;
|
|
23
40
|
name: string;
|
|
24
41
|
stopped: boolean;
|
|
25
42
|
configured: boolean;
|
|
26
43
|
Log?: any;
|
|
27
44
|
usb?: USB;
|
|
45
|
+
/**
|
|
46
|
+
* Cached list of connected devices
|
|
47
|
+
* This is essential for maintaining device references between operations
|
|
48
|
+
*/
|
|
28
49
|
deviceList: Array<DeviceInfo>;
|
|
29
50
|
configurationId: number;
|
|
30
51
|
endpointId: number;
|
|
31
52
|
interfaceId: number;
|
|
53
|
+
constructor();
|
|
54
|
+
/**
|
|
55
|
+
* Initialize WebUSB transport
|
|
56
|
+
*/
|
|
32
57
|
init(logger: any): void;
|
|
58
|
+
/**
|
|
59
|
+
* Protocol type is a property of the physical device keyed by USB serial number.
|
|
60
|
+
* It can only change across a device reboot (e.g. normal ↔ bootloader mode), and
|
|
61
|
+
* a reboot always surfaces as a USB disconnect. Disconnects (and transfer-level
|
|
62
|
+
* reconnects, which cover a missed disconnect event) only MARK the cached probe
|
|
63
|
+
* result stale instead of deleting it: an in-flight session keeps using the old
|
|
64
|
+
* value so the transfer-level reconnect retries can absorb a transient
|
|
65
|
+
* re-enumeration exactly as they did before the cache existed, while the next
|
|
66
|
+
* acquire re-probes from scratch.
|
|
67
|
+
*/
|
|
68
|
+
markProtocolStale(path: string): void;
|
|
69
|
+
/**
|
|
70
|
+
* Configure Protocol V1 protobuf schema (legacy chunked 0x3F framing).
|
|
71
|
+
*/
|
|
33
72
|
configure(signedData: any): void;
|
|
73
|
+
/**
|
|
74
|
+
* Cache the Protocol V2 protobuf schema.
|
|
75
|
+
*/
|
|
34
76
|
configureProtocolV2(signedData: any): void;
|
|
77
|
+
/**
|
|
78
|
+
* Request user to select a device
|
|
79
|
+
* This method must be called in response to a user action
|
|
80
|
+
* to comply with WebUSB security requirements
|
|
81
|
+
*/
|
|
35
82
|
promptDeviceAccess(): Promise<USBDevice | null>;
|
|
83
|
+
/**
|
|
84
|
+
* Enumerate already connected devices
|
|
85
|
+
* This method only returns devices that are already authorized by the browser
|
|
86
|
+
* It does NOT prompt the user to select a device
|
|
87
|
+
*/
|
|
36
88
|
enumerate(): Promise<DeviceInfo[]>;
|
|
37
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Get list of connected devices
|
|
91
|
+
*/
|
|
38
92
|
getConnectedDevices(): Promise<DeviceInfo[]>;
|
|
93
|
+
/**
|
|
94
|
+
* Acquire device control
|
|
95
|
+
*/
|
|
39
96
|
acquire(input: AcquireInput): Promise<string | undefined>;
|
|
97
|
+
/**
|
|
98
|
+
* Determine protocol type after connect.
|
|
99
|
+
* Probe Protocol V1 first with Initialize. If it does not answer in time,
|
|
100
|
+
* fall back to a Protocol V2 Ping probe.
|
|
101
|
+
*/
|
|
40
102
|
private createProtocolMismatchError;
|
|
103
|
+
private createProtocolProbeTimeoutError;
|
|
41
104
|
private createProtocolDetectionError;
|
|
42
105
|
private detectProtocol;
|
|
106
|
+
/**
|
|
107
|
+
* Find device by path
|
|
108
|
+
*/
|
|
43
109
|
findDevice(path: string): Promise<USBDevice>;
|
|
110
|
+
/**
|
|
111
|
+
* Connect to device with retry mechanism
|
|
112
|
+
*/
|
|
44
113
|
connect(path: string, first: boolean): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Discover vendor-class (0xFF) interface and its IN/OUT endpoint numbers from USB descriptors.
|
|
116
|
+
* Falls back to legacy hardcoded values if no vendor interface is found.
|
|
117
|
+
*/
|
|
45
118
|
private discoverEndpoints;
|
|
119
|
+
/**
|
|
120
|
+
* Connect to specific device.
|
|
121
|
+
* Discovers interface/endpoint numbers from USB descriptors on first connection.
|
|
122
|
+
*/
|
|
46
123
|
connectToDevice(path: string, first: boolean): Promise<void>;
|
|
47
124
|
private closeOpenDevice;
|
|
48
125
|
private clearEndpointHalt;
|
|
126
|
+
/**
|
|
127
|
+
* With the protocol cache surviving release(), deviceProtocol presence no
|
|
128
|
+
* longer implies an active session. Guard call()/post() explicitly so a
|
|
129
|
+
* post-release straggler fails fast instead of silently reopening the device
|
|
130
|
+
* and driving it outside any session (pre-cache behavior: the deleted
|
|
131
|
+
* protocol entry produced the same fail-fast).
|
|
132
|
+
*/
|
|
133
|
+
private assertAcquired;
|
|
49
134
|
post(session: string, name: string, data: Record<string, unknown>): Promise<void>;
|
|
50
135
|
private getErrorMessage;
|
|
51
136
|
private isRetryablePacketIoError;
|
|
@@ -55,16 +140,43 @@ declare class WebUsbTransport {
|
|
|
55
140
|
private transferOutWithRetry;
|
|
56
141
|
private transferOutOnce;
|
|
57
142
|
private transferInWithRetry;
|
|
143
|
+
private transferInOnce;
|
|
144
|
+
private closeConnectionAfterProbe;
|
|
58
145
|
private resetConnectionAfterProbe;
|
|
59
146
|
private withProtocolReadTimeout;
|
|
60
147
|
private probeProtocolV1;
|
|
61
148
|
private probeProtocolV2;
|
|
149
|
+
/**
|
|
150
|
+
* Call device method — branches to Protocol V1 or Protocol V2 based on active probe.
|
|
151
|
+
*/
|
|
62
152
|
call(path: string, name: string, data: Record<string, unknown>, options?: TransportCallOptions): Promise<_onekeyfe_hd_transport.MessageFromOneKey>;
|
|
63
153
|
private callProtocolV1;
|
|
154
|
+
/**
|
|
155
|
+
* Send/receive a single call over Protocol V2 (0x5A framing).
|
|
156
|
+
*
|
|
157
|
+
* Encoding: protobuf message → 2-byte LE messageTypeId + pb bytes → Protocol V2 frame
|
|
158
|
+
* Decoding: Protocol V2 frame → messageTypeId + pb bytes → protobuf message
|
|
159
|
+
*/
|
|
64
160
|
private callProtocolV2;
|
|
65
|
-
|
|
161
|
+
/**
|
|
162
|
+
* Receive data from device
|
|
163
|
+
*/
|
|
66
164
|
receiveData(path: string, timeoutMs?: number): Promise<string>;
|
|
165
|
+
/**
|
|
166
|
+
* Release device
|
|
167
|
+
*/
|
|
67
168
|
release(path: string): Promise<void>;
|
|
169
|
+
protected getProtocolV2UsbSchemas(): ProtocolV2Schemas;
|
|
170
|
+
protected getProtocolV2UsbLogger(): any;
|
|
171
|
+
protected writeProtocolV2UsbPacket(path: string, frame: Uint8Array, _context: ProtocolV2CallContext): Promise<void>;
|
|
172
|
+
protected readProtocolV2UsbPacket(path: string, _context: ProtocolV2CallContext): Promise<Uint8Array>;
|
|
173
|
+
protected resetProtocolV2UsbNativeLink(path: string, _reason: string): Promise<void>;
|
|
174
|
+
protected onProtocolV2UsbLinkInvalidated(path: string, reason: string): void;
|
|
175
|
+
protected createProtocolV2UsbTimeoutError(name: string, timeoutMs: number): Error;
|
|
176
|
+
/**
|
|
177
|
+
* Expose the detected protocol type for a given device path.
|
|
178
|
+
* Used by upper layers (e.g. TransportManager) to select the correct schema.
|
|
179
|
+
*/
|
|
68
180
|
getProtocolType(path: string): ProtocolType | undefined;
|
|
69
181
|
}
|
|
70
182
|
|
|
@@ -77,24 +189,40 @@ type BleAcquireInput = {
|
|
|
77
189
|
uuid: string;
|
|
78
190
|
forceCleanRunPromise?: boolean;
|
|
79
191
|
expectedProtocol?: ProtocolType;
|
|
192
|
+
protocolHint?: ProtocolType;
|
|
80
193
|
};
|
|
194
|
+
/**
|
|
195
|
+
* Desktop Electron BLE transport with automatic Protocol V1/V2 detection.
|
|
196
|
+
*
|
|
197
|
+
* Protocol V1 devices continue using chunked packets. Protocol V2 is detected
|
|
198
|
+
* after a Protocol V1 GetFeatures timeout by probing Protocol V2 Ping.
|
|
199
|
+
*/
|
|
81
200
|
declare class ElectronBleTransport {
|
|
82
201
|
private _messages;
|
|
83
202
|
private _messagesV2;
|
|
203
|
+
private protocolV2SchemaConfiguration;
|
|
84
204
|
name: string;
|
|
85
205
|
configured: boolean;
|
|
86
206
|
runPromise: Deferred<Uint8Array | string> | null;
|
|
207
|
+
private runPromiseDeviceId;
|
|
87
208
|
Log?: any;
|
|
88
209
|
emitter?: EventEmitter;
|
|
89
210
|
private connectedDevices;
|
|
90
211
|
private deviceProtocol;
|
|
91
212
|
private deviceProtocolHints;
|
|
213
|
+
/** Endpoints that answered a V2 probe in this transport lifetime. Survives disconnect. */
|
|
214
|
+
private confirmedProtocolV2;
|
|
215
|
+
private deviceMtus;
|
|
216
|
+
private devicePacketCapacities;
|
|
92
217
|
private v1Buffers;
|
|
93
218
|
private v2Assemblers;
|
|
94
219
|
private v2FrameQueues;
|
|
95
220
|
private v2FramePromises;
|
|
96
221
|
private protocolV2Links;
|
|
222
|
+
/** One-shot guard so a missing preload `release` bridge is reported once. */
|
|
223
|
+
private warnedMissingRelease;
|
|
97
224
|
private notificationCleanups;
|
|
225
|
+
private mtuCleanups;
|
|
98
226
|
private disconnectCleanups;
|
|
99
227
|
private notificationTokens;
|
|
100
228
|
private nextNotificationToken;
|
|
@@ -116,7 +244,10 @@ declare class ElectronBleTransport {
|
|
|
116
244
|
name: string | null;
|
|
117
245
|
protocolType?: ProtocolType | undefined;
|
|
118
246
|
}>;
|
|
119
|
-
release(id: string): Promise<void>;
|
|
247
|
+
release(id: string, _onclose?: boolean, keepSession?: boolean): Promise<void>;
|
|
248
|
+
disconnect(id: string): Promise<void>;
|
|
249
|
+
private releaseNative;
|
|
250
|
+
private releaseLogical;
|
|
120
251
|
private createProtocolMismatchError;
|
|
121
252
|
private createProtocolDetectionError;
|
|
122
253
|
private clearProbeProtocol;
|
|
@@ -125,18 +256,21 @@ declare class ElectronBleTransport {
|
|
|
125
256
|
private resetProbeStateAfterProtocolProbe;
|
|
126
257
|
private probeProtocolV1;
|
|
127
258
|
private probeProtocolV2;
|
|
128
|
-
private writeWithChunking;
|
|
129
259
|
private writeOnce;
|
|
260
|
+
private refreshBlePacketCapacity;
|
|
261
|
+
private updateBlePacketCapacity;
|
|
262
|
+
private createMtuSubscription;
|
|
263
|
+
private writeProtocolV2Frame;
|
|
130
264
|
private handleNotification;
|
|
131
265
|
private handleProtocolV2Notification;
|
|
132
266
|
private getProtocolV2FrameQueue;
|
|
133
267
|
private resolveProtocolV2Frame;
|
|
134
|
-
private rejectAllProtocolV2Frames;
|
|
135
268
|
private resetProtocolV2Frames;
|
|
136
269
|
private rejectProtocolV2Frames;
|
|
137
270
|
private readProtocolV2Frame;
|
|
138
271
|
private handleProtocolV1Notification;
|
|
139
272
|
call(uuid: string, name: string, data: Record<string, unknown>, options?: TransportCallOptions): Promise<_onekeyfe_hd_transport.MessageFromOneKey>;
|
|
273
|
+
post(uuid: string, name: string, data: Record<string, unknown>): Promise<void>;
|
|
140
274
|
private callProtocolV1;
|
|
141
275
|
private callProtocolV2;
|
|
142
276
|
private createProtocolV2Adapter;
|