@onekeyfe/hd-transport-usb 1.2.11-alpha.5 → 1.2.11-alpha.8
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/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/package.json +4 -4
- package/src/index.ts +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -12,9 +12,9 @@ import EventEmitter from 'events';
|
|
|
12
12
|
* Modeled after WebUsbTransport.
|
|
13
13
|
*/
|
|
14
14
|
declare class NodeUsbTransport extends ProtocolV2UsbTransportBase<string> {
|
|
15
|
-
messages: ReturnType<typeof transport__default.
|
|
15
|
+
messages: ReturnType<typeof transport__default.parseConfigure> | undefined;
|
|
16
16
|
/** Protobuf schema for Protocol V2 transports. */
|
|
17
|
-
messagesV2: ReturnType<typeof transport__default.
|
|
17
|
+
messagesV2: ReturnType<typeof transport__default.parseConfigure> | undefined;
|
|
18
18
|
private protocolV2SchemaSource;
|
|
19
19
|
name: string;
|
|
20
20
|
version: string;
|
|
@@ -87,7 +87,7 @@ declare class NodeUsbTransport extends ProtocolV2UsbTransportBase<string> {
|
|
|
87
87
|
*/
|
|
88
88
|
call(path: string, name: string, data: Record<string, unknown>, options?: TransportCallOptions): Promise<transport.MessageFromOneKey>;
|
|
89
89
|
private callProtocolV1;
|
|
90
|
-
cancel(): void;
|
|
90
|
+
cancel(_session?: string): void;
|
|
91
91
|
/**
|
|
92
92
|
* Get the current open device for a path, re-resolving from the map
|
|
93
93
|
* so callers always use a fresh reference after reconnect.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,SAAS,EAAE,EAQhB,0BAA0B,EAE3B,MAAM,wBAAwB,CAAC;AAShC,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,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uB,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;cAOA,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC,UAAU,CAAC;cAsBN,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1F,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;YAOnE,cAAc;YAad,WAAW;IA6CzB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;CAGxD"}
|
package/dist/index.js
CHANGED
|
@@ -59,7 +59,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
59
59
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
const {
|
|
62
|
+
const { parseConfigure, ProtocolV1, check } = transport__default["default"];
|
|
63
63
|
const PACKET_SIZE = transport.PROTOCOL_V1_USB_PACKET_SIZE;
|
|
64
64
|
const REPORT_ID = transport.PROTOCOL_V1_REPORT_ID;
|
|
65
65
|
const PAYLOAD_SIZE = transport.PROTOCOL_V1_CHUNK_PAYLOAD_SIZE;
|
|
@@ -165,7 +165,7 @@ class NodeUsbTransport extends transport.ProtocolV2UsbTransportBase {
|
|
|
165
165
|
return Promise.resolve('');
|
|
166
166
|
}
|
|
167
167
|
configure(signedData) {
|
|
168
|
-
const messages =
|
|
168
|
+
const messages = parseConfigure(signedData);
|
|
169
169
|
this.configured = true;
|
|
170
170
|
this.messages = messages;
|
|
171
171
|
return Promise.resolve();
|
|
@@ -178,7 +178,7 @@ class NodeUsbTransport extends transport.ProtocolV2UsbTransportBase {
|
|
|
178
178
|
if (schemaSource === this.protocolV2SchemaSource)
|
|
179
179
|
return;
|
|
180
180
|
const hadProtocolV2Schema = this.protocolV2SchemaSource !== undefined;
|
|
181
|
-
this.messagesV2 =
|
|
181
|
+
this.messagesV2 = parseConfigure(signedData);
|
|
182
182
|
this.protocolV2SchemaSource = schemaSource;
|
|
183
183
|
if (!hadProtocolV2Schema)
|
|
184
184
|
return;
|
|
@@ -432,7 +432,7 @@ class NodeUsbTransport extends transport.ProtocolV2UsbTransportBase {
|
|
|
432
432
|
return check.call(jsonData);
|
|
433
433
|
});
|
|
434
434
|
}
|
|
435
|
-
cancel() {
|
|
435
|
+
cancel(_session) {
|
|
436
436
|
this.cancelled = true;
|
|
437
437
|
}
|
|
438
438
|
getOpenDevice(path) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport-usb",
|
|
3
|
-
"version": "1.2.11-alpha.
|
|
3
|
+
"version": "1.2.11-alpha.8",
|
|
4
4
|
"description": "OneKey hardware wallet direct USB transport plugin (libusb)",
|
|
5
5
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"lint:fix": "eslint . --fix"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@onekeyfe/hd-shared": "1.2.11-alpha.
|
|
25
|
-
"@onekeyfe/hd-transport": "1.2.11-alpha.
|
|
24
|
+
"@onekeyfe/hd-shared": "1.2.11-alpha.8",
|
|
25
|
+
"@onekeyfe/hd-transport": "1.2.11-alpha.8",
|
|
26
26
|
"bytebuffer": "^5.0.1",
|
|
27
27
|
"usb": "^2.14.0"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "f2f0e4af13efbb09f4b421171142f9144124a1c2"
|
|
30
30
|
}
|
package/src/index.ts
CHANGED
|
@@ -29,7 +29,7 @@ import type {
|
|
|
29
29
|
TransportCallOptions,
|
|
30
30
|
} from '@onekeyfe/hd-transport';
|
|
31
31
|
|
|
32
|
-
const {
|
|
32
|
+
const { parseConfigure, ProtocolV1, check } = transport;
|
|
33
33
|
|
|
34
34
|
const PACKET_SIZE = PROTOCOL_V1_USB_PACKET_SIZE;
|
|
35
35
|
const REPORT_ID = PROTOCOL_V1_REPORT_ID;
|
|
@@ -163,10 +163,10 @@ function toArrayBuffer(buf: Buffer): ArrayBuffer {
|
|
|
163
163
|
* Modeled after WebUsbTransport.
|
|
164
164
|
*/
|
|
165
165
|
export default class NodeUsbTransport extends ProtocolV2UsbTransportBase<string> {
|
|
166
|
-
messages: ReturnType<typeof transport.
|
|
166
|
+
messages: ReturnType<typeof transport.parseConfigure> | undefined;
|
|
167
167
|
|
|
168
168
|
/** Protobuf schema for Protocol V2 transports. */
|
|
169
|
-
messagesV2: ReturnType<typeof transport.
|
|
169
|
+
messagesV2: ReturnType<typeof transport.parseConfigure> | undefined;
|
|
170
170
|
|
|
171
171
|
private protocolV2SchemaSource: string | undefined;
|
|
172
172
|
|
|
@@ -225,7 +225,7 @@ export default class NodeUsbTransport extends ProtocolV2UsbTransportBase<string>
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
configure(signedData: any) {
|
|
228
|
-
const messages =
|
|
228
|
+
const messages = parseConfigure(signedData);
|
|
229
229
|
this.configured = true;
|
|
230
230
|
this.messages = messages;
|
|
231
231
|
return Promise.resolve();
|
|
@@ -239,7 +239,7 @@ export default class NodeUsbTransport extends ProtocolV2UsbTransportBase<string>
|
|
|
239
239
|
if (schemaSource === this.protocolV2SchemaSource) return;
|
|
240
240
|
|
|
241
241
|
const hadProtocolV2Schema = this.protocolV2SchemaSource !== undefined;
|
|
242
|
-
this.messagesV2 =
|
|
242
|
+
this.messagesV2 = parseConfigure(signedData);
|
|
243
243
|
this.protocolV2SchemaSource = schemaSource;
|
|
244
244
|
if (!hadProtocolV2Schema) return;
|
|
245
245
|
|
|
@@ -554,7 +554,7 @@ export default class NodeUsbTransport extends ProtocolV2UsbTransportBase<string>
|
|
|
554
554
|
return check.call(jsonData);
|
|
555
555
|
}
|
|
556
556
|
|
|
557
|
-
cancel() {
|
|
557
|
+
cancel(_session?: string) {
|
|
558
558
|
this.cancelled = true;
|
|
559
559
|
}
|
|
560
560
|
|