@ledgerhq/hw-transport-node-hid-singleton 6.23.0 → 6.25.1-alpha.0
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/README.md +7 -0
- package/lib/TransportNodeHid.d.ts +6 -0
- package/lib/TransportNodeHid.d.ts.map +1 -1
- package/lib/TransportNodeHid.js +30 -3
- package/lib/TransportNodeHid.js.map +1 -1
- package/lib-es/TransportNodeHid.d.ts +0 -7
- package/lib-es/TransportNodeHid.d.ts.map +1 -1
- package/lib-es/TransportNodeHid.js +0 -33
- package/lib-es/TransportNodeHid.js.flow +138 -0
- package/lib-es/TransportNodeHid.js.map +1 -1
- package/lib-es/listenDevices.js.flow +84 -0
- package/package.json +5 -5
- package/src/TransportNodeHid.ts +24 -2
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@ Allows to communicate with Ledger Hardware Wallets.
|
|
|
23
23
|
* [list](#list)
|
|
24
24
|
* [listen](#listen)
|
|
25
25
|
* [Parameters](#parameters-1)
|
|
26
|
+
* [autoDisconnect](#autodisconnect)
|
|
26
27
|
* [disconnect](#disconnect)
|
|
27
28
|
* [open](#open)
|
|
28
29
|
|
|
@@ -62,6 +63,12 @@ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
|
62
63
|
|
|
63
64
|
Returns **Subscription**
|
|
64
65
|
|
|
66
|
+
#### autoDisconnect
|
|
67
|
+
|
|
68
|
+
convenience wrapper for auto-disconnect logic
|
|
69
|
+
|
|
70
|
+
Returns **void**
|
|
71
|
+
|
|
65
72
|
#### disconnect
|
|
66
73
|
|
|
67
74
|
globally disconnect the transport singleton
|
|
@@ -9,6 +9,7 @@ import type { Observer, DescriptorEvent, Subscription } from "@ledgerhq/hw-trans
|
|
|
9
9
|
* TransportNodeHid.create().then(transport => ...)
|
|
10
10
|
*/
|
|
11
11
|
export default class TransportNodeHidSingleton extends TransportNodeHidNoEvents {
|
|
12
|
+
preventAutoDisconnect: boolean;
|
|
12
13
|
/**
|
|
13
14
|
*
|
|
14
15
|
*/
|
|
@@ -20,6 +21,10 @@ export default class TransportNodeHidSingleton extends TransportNodeHidNoEvents
|
|
|
20
21
|
/**
|
|
21
22
|
*/
|
|
22
23
|
static listen: (observer: Observer<DescriptorEvent<any>>) => Subscription;
|
|
24
|
+
/**
|
|
25
|
+
* convenience wrapper for auto-disconnect logic
|
|
26
|
+
*/
|
|
27
|
+
static autoDisconnect(): void;
|
|
23
28
|
/**
|
|
24
29
|
* globally disconnect the transport singleton
|
|
25
30
|
*/
|
|
@@ -28,6 +33,7 @@ export default class TransportNodeHidSingleton extends TransportNodeHidNoEvents
|
|
|
28
33
|
* if path="" is not provided, the library will take the first device
|
|
29
34
|
*/
|
|
30
35
|
static open(): Promise<TransportNodeHidSingleton>;
|
|
36
|
+
setAllowAutoDisconnect(allow: boolean): void;
|
|
31
37
|
/**
|
|
32
38
|
* Exchange with the device using APDU protocol.
|
|
33
39
|
* @param apdu
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransportNodeHid.d.ts","sourceRoot":"","sources":["../src/TransportNodeHid.ts"],"names":[],"mappings":";AACA,OAAO,wBAEN,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EACf,YAAY,EACb,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"TransportNodeHid.d.ts","sourceRoot":"","sources":["../src/TransportNodeHid.ts"],"names":[],"mappings":";AACA,OAAO,wBAEN,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EACf,YAAY,EACb,MAAM,wBAAwB,CAAC;AAuBhC;;;;;;GAMG;AAEH,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,wBAAwB;IAC7E,qBAAqB,UAAS;IAC9B;;OAEG;IACH,MAAM,CAAC,WAAW,yBAAwC;IAE1D;;OAEG;IACH,MAAM,CAAC,IAAI,qBAAiC;IAE5C;OACG;IACH,MAAM,CAAC,MAAM,aAAc,SAAS,gBAAgB,GAAG,CAAC,CAAC,KAAG,YAAY,CAqDtE;IAEF;;OAEG;WACU,cAAc,IAAI,IAAI;IAWnC;;OAEG;WACU,UAAU;IASvB;;OAEG;IACH,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC,yBAAyB,CAAC;IAqCjD,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAI5C;;;;OAIG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAO7C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAMvB"}
|
package/lib/TransportNodeHid.js
CHANGED
|
@@ -99,7 +99,8 @@ var clearDisconnectTimeout = function () {
|
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
101
|
var setDisconnectTimeout = function () {
|
|
102
|
-
|
|
102
|
+
clearDisconnectTimeout();
|
|
103
|
+
disconnectTimeout = setTimeout(function () { return TransportNodeHidSingleton.autoDisconnect(); }, DISCONNECT_TIMEOUT);
|
|
103
104
|
};
|
|
104
105
|
/**
|
|
105
106
|
* node-hid Transport implementation
|
|
@@ -111,8 +112,29 @@ var setDisconnectTimeout = function () {
|
|
|
111
112
|
var TransportNodeHidSingleton = /** @class */ (function (_super) {
|
|
112
113
|
__extends(TransportNodeHidSingleton, _super);
|
|
113
114
|
function TransportNodeHidSingleton() {
|
|
114
|
-
|
|
115
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
116
|
+
_this.preventAutoDisconnect = false;
|
|
117
|
+
return _this;
|
|
115
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* convenience wrapper for auto-disconnect logic
|
|
121
|
+
*/
|
|
122
|
+
TransportNodeHidSingleton.autoDisconnect = function () {
|
|
123
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124
|
+
return __generator(this, function (_a) {
|
|
125
|
+
if (transportInstance && !transportInstance.preventAutoDisconnect) {
|
|
126
|
+
(0, logs_1.log)("hid-verbose", "triggering auto disconnect");
|
|
127
|
+
TransportNodeHidSingleton.disconnect();
|
|
128
|
+
}
|
|
129
|
+
else if (transportInstance) {
|
|
130
|
+
// If we have disabled the auto-disconnect, try again in DISCONNECT_TIMEOUT
|
|
131
|
+
clearDisconnectTimeout();
|
|
132
|
+
setDisconnectTimeout();
|
|
133
|
+
}
|
|
134
|
+
return [2 /*return*/];
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
};
|
|
116
138
|
/**
|
|
117
139
|
* globally disconnect the transport singleton
|
|
118
140
|
*/
|
|
@@ -162,6 +184,9 @@ var TransportNodeHidSingleton = /** @class */ (function (_super) {
|
|
|
162
184
|
return transportInstance;
|
|
163
185
|
});
|
|
164
186
|
};
|
|
187
|
+
TransportNodeHidSingleton.prototype.setAllowAutoDisconnect = function (allow) {
|
|
188
|
+
this.preventAutoDisconnect = !allow;
|
|
189
|
+
};
|
|
165
190
|
/**
|
|
166
191
|
* Exchange with the device using APDU protocol.
|
|
167
192
|
* @param apdu
|
|
@@ -184,7 +209,9 @@ var TransportNodeHidSingleton = /** @class */ (function (_super) {
|
|
|
184
209
|
});
|
|
185
210
|
};
|
|
186
211
|
TransportNodeHidSingleton.prototype.close = function () {
|
|
187
|
-
// intentionally, a close will not effectively close the hid connection
|
|
212
|
+
// intentionally, a close will not effectively close the hid connection but
|
|
213
|
+
// will allow an auto-disconnection after some inactivity
|
|
214
|
+
this.preventAutoDisconnect = false;
|
|
188
215
|
return Promise.resolve();
|
|
189
216
|
};
|
|
190
217
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransportNodeHid.js","sourceRoot":"","sources":["../src/TransportNodeHid.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAA2B;AAC3B,yGAEkD;AAMlD,uCAAqC;AACr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|
2
1
|
import TransportNodeHidNoEvents from "@ledgerhq/hw-transport-node-hid-noevents";
|
|
3
2
|
import type { Observer, DescriptorEvent, Subscription } from "@ledgerhq/hw-transport";
|
|
4
3
|
/**
|
|
@@ -28,12 +27,6 @@ export default class TransportNodeHidSingleton extends TransportNodeHidNoEvents
|
|
|
28
27
|
* if path="" is not provided, the library will take the first device
|
|
29
28
|
*/
|
|
30
29
|
static open(): Promise<TransportNodeHidSingleton>;
|
|
31
|
-
/**
|
|
32
|
-
* Exchange with the device using APDU protocol.
|
|
33
|
-
* @param apdu
|
|
34
|
-
* @returns a promise of apdu response
|
|
35
|
-
*/
|
|
36
|
-
exchange(apdu: Buffer): Promise<Buffer>;
|
|
37
30
|
close(): Promise<void>;
|
|
38
31
|
}
|
|
39
32
|
//# sourceMappingURL=TransportNodeHid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransportNodeHid.d.ts","sourceRoot":"","sources":["../src/TransportNodeHid.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TransportNodeHid.d.ts","sourceRoot":"","sources":["../src/TransportNodeHid.ts"],"names":[],"mappings":"AACA,OAAO,wBAEN,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EACf,YAAY,EACb,MAAM,wBAAwB,CAAC;AAMhC;;;;;;GAMG;AAEH,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,wBAAwB;IAC7E;;OAEG;IACH,MAAM,CAAC,WAAW,yBAAwC;IAE1D;;OAEG;IACH,MAAM,CAAC,IAAI,qBAAiC;IAE5C;OACG;IACH,MAAM,CAAC,MAAM,aAAc,SAAS,gBAAgB,GAAG,CAAC,CAAC,KAAG,YAAY,CAqDtE;IAEF;;OAEG;WACU,UAAU;IAQvB;;OAEG;IACH,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC,yBAAyB,CAAC;IAoCjD,KAAK;CAIN"}
|
|
@@ -67,16 +67,6 @@ import { identifyUSBProductId } from "@ledgerhq/devices";
|
|
|
67
67
|
import { CantOpenDevice } from "@ledgerhq/errors";
|
|
68
68
|
import { listenDevices } from "./listenDevices";
|
|
69
69
|
var transportInstance;
|
|
70
|
-
var DISCONNECT_TIMEOUT = 5000;
|
|
71
|
-
var disconnectTimeout;
|
|
72
|
-
var clearDisconnectTimeout = function () {
|
|
73
|
-
if (disconnectTimeout) {
|
|
74
|
-
clearTimeout(disconnectTimeout);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
var setDisconnectTimeout = function () {
|
|
78
|
-
disconnectTimeout = setTimeout(function () { return TransportNodeHidSingleton.disconnect(); }, DISCONNECT_TIMEOUT);
|
|
79
|
-
};
|
|
80
70
|
/**
|
|
81
71
|
* node-hid Transport implementation
|
|
82
72
|
* @example
|
|
@@ -100,7 +90,6 @@ var TransportNodeHidSingleton = /** @class */ (function (_super) {
|
|
|
100
90
|
transportInstance.emit("disconnect");
|
|
101
91
|
transportInstance = null;
|
|
102
92
|
}
|
|
103
|
-
clearDisconnectTimeout();
|
|
104
93
|
return [2 /*return*/];
|
|
105
94
|
});
|
|
106
95
|
});
|
|
@@ -109,7 +98,6 @@ var TransportNodeHidSingleton = /** @class */ (function (_super) {
|
|
|
109
98
|
* if path="" is not provided, the library will take the first device
|
|
110
99
|
*/
|
|
111
100
|
TransportNodeHidSingleton.open = function () {
|
|
112
|
-
clearDisconnectTimeout();
|
|
113
101
|
return Promise.resolve().then(function () {
|
|
114
102
|
if (transportInstance) {
|
|
115
103
|
log("hid-verbose", "reusing opened transport instance");
|
|
@@ -138,27 +126,6 @@ var TransportNodeHidSingleton = /** @class */ (function (_super) {
|
|
|
138
126
|
return transportInstance;
|
|
139
127
|
});
|
|
140
128
|
};
|
|
141
|
-
/**
|
|
142
|
-
* Exchange with the device using APDU protocol.
|
|
143
|
-
* @param apdu
|
|
144
|
-
* @returns a promise of apdu response
|
|
145
|
-
*/
|
|
146
|
-
TransportNodeHidSingleton.prototype.exchange = function (apdu) {
|
|
147
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
148
|
-
var result;
|
|
149
|
-
return __generator(this, function (_a) {
|
|
150
|
-
switch (_a.label) {
|
|
151
|
-
case 0:
|
|
152
|
-
clearDisconnectTimeout();
|
|
153
|
-
return [4 /*yield*/, _super.prototype.exchange.call(this, apdu)];
|
|
154
|
-
case 1:
|
|
155
|
-
result = _a.sent();
|
|
156
|
-
setDisconnectTimeout();
|
|
157
|
-
return [2 /*return*/, result];
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
};
|
|
162
129
|
TransportNodeHidSingleton.prototype.close = function () {
|
|
163
130
|
// intentionally, a close will not effectively close the hid connection
|
|
164
131
|
return Promise.resolve();
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
//@flow
|
|
2
|
+
|
|
3
|
+
import HID from "node-hid";
|
|
4
|
+
import TransportNodeHidNoEvents, {
|
|
5
|
+
getDevices,
|
|
6
|
+
} from "@ledgerhq/hw-transport-node-hid-noevents";
|
|
7
|
+
import type {
|
|
8
|
+
Observer,
|
|
9
|
+
DescriptorEvent,
|
|
10
|
+
Subscription,
|
|
11
|
+
} from "@ledgerhq/hw-transport";
|
|
12
|
+
import { log } from "@ledgerhq/logs";
|
|
13
|
+
import { identifyUSBProductId } from "@ledgerhq/devices";
|
|
14
|
+
import { CantOpenDevice } from "@ledgerhq/errors";
|
|
15
|
+
import { listenDevices } from "./listenDevices";
|
|
16
|
+
|
|
17
|
+
let transportInstance;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* node-hid Transport implementation
|
|
21
|
+
* @example
|
|
22
|
+
* import TransportNodeHid from "@ledgerhq/hw-transport-node-hid-singleton";
|
|
23
|
+
* ...
|
|
24
|
+
* TransportNodeHid.create().then(transport => ...)
|
|
25
|
+
*/
|
|
26
|
+
export default class TransportNodeHidSingleton extends TransportNodeHidNoEvents {
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
static isSupported = TransportNodeHidNoEvents.isSupported;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
static list = TransportNodeHidNoEvents.list;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
*/
|
|
39
|
+
static listen = (observer: Observer<DescriptorEvent<*>>): Subscription => {
|
|
40
|
+
let unsubscribed;
|
|
41
|
+
Promise.resolve(getDevices()).then((devices) => {
|
|
42
|
+
// this needs to run asynchronously so the subscription is defined during this phase
|
|
43
|
+
for (const device of devices) {
|
|
44
|
+
if (!unsubscribed) {
|
|
45
|
+
const deviceModel = identifyUSBProductId(device.productId);
|
|
46
|
+
observer.next({
|
|
47
|
+
type: "add",
|
|
48
|
+
descriptor: "",
|
|
49
|
+
device: { name: device.deviceName },
|
|
50
|
+
deviceModel,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const onAdd = (device) => {
|
|
57
|
+
const deviceModel = identifyUSBProductId(device.productId);
|
|
58
|
+
observer.next({
|
|
59
|
+
type: "add",
|
|
60
|
+
descriptor: "",
|
|
61
|
+
deviceModel,
|
|
62
|
+
device: { name: device.deviceName },
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const onRemove = (device) => {
|
|
67
|
+
const deviceModel = identifyUSBProductId(device.productId);
|
|
68
|
+
observer.next({
|
|
69
|
+
type: "remove",
|
|
70
|
+
descriptor: "",
|
|
71
|
+
deviceModel,
|
|
72
|
+
device: { name: device.deviceName },
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const stop = listenDevices(onAdd, onRemove);
|
|
77
|
+
|
|
78
|
+
function unsubscribe() {
|
|
79
|
+
stop();
|
|
80
|
+
unsubscribed = true;
|
|
81
|
+
}
|
|
82
|
+
return { unsubscribe };
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* globally disconnect the transport singleton
|
|
87
|
+
*/
|
|
88
|
+
static async disconnect() {
|
|
89
|
+
if (transportInstance) {
|
|
90
|
+
transportInstance.device.close();
|
|
91
|
+
transportInstance.emit("disconnect");
|
|
92
|
+
transportInstance = null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* if path="" is not provided, the library will take the first device
|
|
98
|
+
*/
|
|
99
|
+
static open(): Promise<TransportNodeHidSingleton> {
|
|
100
|
+
return Promise.resolve().then(() => {
|
|
101
|
+
if (transportInstance) {
|
|
102
|
+
log("hid-verbose", "reusing opened transport instance");
|
|
103
|
+
return transportInstance;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const device = getDevices()[0];
|
|
107
|
+
if (!device) throw new CantOpenDevice("no device found");
|
|
108
|
+
log("hid-verbose", "new HID transport");
|
|
109
|
+
transportInstance = new TransportNodeHidSingleton(
|
|
110
|
+
new HID.HID(device.path)
|
|
111
|
+
);
|
|
112
|
+
const unlisten = listenDevices(
|
|
113
|
+
() => {},
|
|
114
|
+
() => {
|
|
115
|
+
// assume any ledger disconnection concerns current transport
|
|
116
|
+
if (transportInstance) {
|
|
117
|
+
transportInstance.emit("disconnect");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
const onDisconnect = () => {
|
|
122
|
+
if (!transportInstance) return;
|
|
123
|
+
log("hid-verbose", "transport instance was disconnected");
|
|
124
|
+
transportInstance.off("disconnect", onDisconnect);
|
|
125
|
+
transportInstance = null;
|
|
126
|
+
unlisten();
|
|
127
|
+
};
|
|
128
|
+
transportInstance.on("disconnect", onDisconnect);
|
|
129
|
+
|
|
130
|
+
return transportInstance;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
close() {
|
|
135
|
+
// intentionally, a close will not effectively close the hid connection
|
|
136
|
+
return Promise.resolve();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransportNodeHid.js","sourceRoot":"","sources":["../src/TransportNodeHid.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,wBAAwB,EAAE,EAC/B,UAAU,GACX,MAAM,0CAA0C,CAAC;AAMlD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,IAAI,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"TransportNodeHid.js","sourceRoot":"","sources":["../src/TransportNodeHid.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,wBAAwB,EAAE,EAC/B,UAAU,GACX,MAAM,0CAA0C,CAAC;AAMlD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,IAAI,iBAAiB,CAAC;AACtB;;;;;;GAMG;AAEH;IAAuD,6CAAwB;IAA/E;;IA0HA,CAAC;IAtDC;;OAEG;IACU,oCAAU,GAAvB;;;gBACE,IAAI,iBAAiB,EAAE;oBACrB,iBAAiB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;oBACjC,iBAAiB,CAAC,IAAI,CAAC,YAAY,CAAC,C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,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,IAAM,IAAI,GAAG,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAE5C,SAAS,WAAW;YAClB,IAAI,EAAE,CAAC;YACP,YAAY,GAAG,IAAI,CAAC;QACtB,CAAC;QAED,OAAO;YACL,WAAW,aAAA;SACZ,CAAC;IACJ,CAAC,CAAC;IAwDJ,gCAAC;CAAA,AA1HD,CAAuD,wBAAwB,GA0H9E;eA1HoB,yBAAyB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import usbDetect from "usb-detection";
|
|
3
|
+
import { ledgerUSBVendorId } from "@ledgerhq/devices";
|
|
4
|
+
import { log } from "@ledgerhq/logs";
|
|
5
|
+
|
|
6
|
+
export type Device = {
|
|
7
|
+
locationId: number,
|
|
8
|
+
vendorId: number,
|
|
9
|
+
productId: number,
|
|
10
|
+
deviceName: string,
|
|
11
|
+
manufacturer: string,
|
|
12
|
+
serialNumber: string,
|
|
13
|
+
deviceAddress: number,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const deviceToLog = ({ productId, locationId, deviceAddress }) =>
|
|
17
|
+
`productId=${productId} locationId=${locationId} deviceAddress=${deviceAddress}`;
|
|
18
|
+
|
|
19
|
+
let usbDebounce = 1000;
|
|
20
|
+
|
|
21
|
+
export const setUsbDebounce = (n: number) => {
|
|
22
|
+
usbDebounce = n;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
let monitoring = false;
|
|
26
|
+
const monitor = () => {
|
|
27
|
+
if (!monitoring) {
|
|
28
|
+
monitoring = true;
|
|
29
|
+
usbDetect.startMonitoring();
|
|
30
|
+
}
|
|
31
|
+
return () => {};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// No better way for now. see https://github.com/LedgerHQ/ledgerjs/issues/434
|
|
35
|
+
process.on("exit", () => {
|
|
36
|
+
if (monitoring) {
|
|
37
|
+
// redeem the monitoring so the process can be terminated.
|
|
38
|
+
usbDetect.stopMonitoring();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const listenDevices = (
|
|
43
|
+
onAdd: (Device) => void,
|
|
44
|
+
onRemove: (Device) => void
|
|
45
|
+
) => {
|
|
46
|
+
const unmonitor = monitor();
|
|
47
|
+
|
|
48
|
+
const addEvent = "add:" + ledgerUSBVendorId;
|
|
49
|
+
const removeEvent = "remove:" + ledgerUSBVendorId;
|
|
50
|
+
|
|
51
|
+
let timeout;
|
|
52
|
+
|
|
53
|
+
const add = (device) => {
|
|
54
|
+
log("usb-detection", "add: " + deviceToLog(device));
|
|
55
|
+
if (!timeout) {
|
|
56
|
+
// a time is needed for the device to actually be connectable over HID..
|
|
57
|
+
// we also take this time to not emit the device yet and potentially cancel it if a remove happens.
|
|
58
|
+
timeout = setTimeout(() => {
|
|
59
|
+
onAdd(device);
|
|
60
|
+
timeout = null;
|
|
61
|
+
}, usbDebounce);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const remove = (device) => {
|
|
66
|
+
log("usb-detection", "remove: " + deviceToLog(device));
|
|
67
|
+
if (timeout) {
|
|
68
|
+
clearTimeout(timeout);
|
|
69
|
+
timeout = null;
|
|
70
|
+
} else {
|
|
71
|
+
onRemove(device);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
usbDetect.on(addEvent, add);
|
|
76
|
+
usbDetect.on(removeEvent, remove);
|
|
77
|
+
|
|
78
|
+
return () => {
|
|
79
|
+
if (timeout) clearTimeout(timeout);
|
|
80
|
+
usbDetect.off(addEvent, add);
|
|
81
|
+
usbDetect.off(removeEvent, remove);
|
|
82
|
+
unmonitor();
|
|
83
|
+
};
|
|
84
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/hw-transport-node-hid-singleton",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.25.1-alpha.0+d26c5a8e",
|
|
4
4
|
"description": "Ledger Hardware Wallet Node implementation of the communication layer, using node-hid and usb-detection",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"types": "lib/TransportNodeHid.d.ts",
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@ledgerhq/devices": "^6.
|
|
30
|
+
"@ledgerhq/devices": "^6.24.1",
|
|
31
31
|
"@ledgerhq/errors": "^6.10.0",
|
|
32
|
-
"@ledgerhq/hw-transport": "^6.
|
|
33
|
-
"@ledgerhq/hw-transport-node-hid-noevents": "^6.
|
|
32
|
+
"@ledgerhq/hw-transport": "^6.24.1",
|
|
33
|
+
"@ledgerhq/hw-transport-node-hid-noevents": "^6.24.1",
|
|
34
34
|
"@ledgerhq/logs": "^6.10.0",
|
|
35
35
|
"lodash": "^4.17.21",
|
|
36
36
|
"node-hid": "2.1.1",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"watch": "bash ../../script/watch.sh",
|
|
43
43
|
"doc": "bash ../../script/doc.sh"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "d26c5a8e64850a322080e0fcba5600125ebbb098"
|
|
46
46
|
}
|
package/src/TransportNodeHid.ts
CHANGED
|
@@ -22,8 +22,9 @@ const clearDisconnectTimeout = () => {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
const setDisconnectTimeout = () => {
|
|
25
|
+
clearDisconnectTimeout();
|
|
25
26
|
disconnectTimeout = setTimeout(
|
|
26
|
-
() => TransportNodeHidSingleton.
|
|
27
|
+
() => TransportNodeHidSingleton.autoDisconnect(),
|
|
27
28
|
DISCONNECT_TIMEOUT
|
|
28
29
|
);
|
|
29
30
|
};
|
|
@@ -37,6 +38,7 @@ const setDisconnectTimeout = () => {
|
|
|
37
38
|
*/
|
|
38
39
|
|
|
39
40
|
export default class TransportNodeHidSingleton extends TransportNodeHidNoEvents {
|
|
41
|
+
preventAutoDisconnect = false;
|
|
40
42
|
/**
|
|
41
43
|
*
|
|
42
44
|
*/
|
|
@@ -104,6 +106,20 @@ export default class TransportNodeHidSingleton extends TransportNodeHidNoEvents
|
|
|
104
106
|
};
|
|
105
107
|
};
|
|
106
108
|
|
|
109
|
+
/**
|
|
110
|
+
* convenience wrapper for auto-disconnect logic
|
|
111
|
+
*/
|
|
112
|
+
static async autoDisconnect(): void {
|
|
113
|
+
if (transportInstance && !transportInstance.preventAutoDisconnect) {
|
|
114
|
+
log("hid-verbose", "triggering auto disconnect");
|
|
115
|
+
TransportNodeHidSingleton.disconnect();
|
|
116
|
+
} else if (transportInstance) {
|
|
117
|
+
// If we have disabled the auto-disconnect, try again in DISCONNECT_TIMEOUT
|
|
118
|
+
clearDisconnectTimeout();
|
|
119
|
+
setDisconnectTimeout();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
107
123
|
/**
|
|
108
124
|
* globally disconnect the transport singleton
|
|
109
125
|
*/
|
|
@@ -156,6 +172,10 @@ export default class TransportNodeHidSingleton extends TransportNodeHidNoEvents
|
|
|
156
172
|
});
|
|
157
173
|
}
|
|
158
174
|
|
|
175
|
+
setAllowAutoDisconnect(allow: boolean): void {
|
|
176
|
+
this.preventAutoDisconnect = !allow;
|
|
177
|
+
}
|
|
178
|
+
|
|
159
179
|
/**
|
|
160
180
|
* Exchange with the device using APDU protocol.
|
|
161
181
|
* @param apdu
|
|
@@ -169,7 +189,9 @@ export default class TransportNodeHidSingleton extends TransportNodeHidNoEvents
|
|
|
169
189
|
}
|
|
170
190
|
|
|
171
191
|
close(): Promise<void> {
|
|
172
|
-
// intentionally, a close will not effectively close the hid connection
|
|
192
|
+
// intentionally, a close will not effectively close the hid connection but
|
|
193
|
+
// will allow an auto-disconnection after some inactivity
|
|
194
|
+
this.preventAutoDisconnect = false;
|
|
173
195
|
return Promise.resolve();
|
|
174
196
|
}
|
|
175
197
|
}
|