@onekeyfe/hwk-ledger-adapter 1.1.26-patch.1 → 1.1.26-patch.2
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.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +9 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -354,7 +354,6 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
354
354
|
* enumerate() cache survives peripherals going offline.
|
|
355
355
|
*/
|
|
356
356
|
protected _discoverDescriptors(dm: LedgerDeviceManager): Promise<DeviceDescriptor[]>;
|
|
357
|
-
private _assertSingleUsbDescriptor;
|
|
358
357
|
searchDevices(): Promise<ConnectorDevice[]>;
|
|
359
358
|
connect(deviceId?: string): Promise<ConnectorSession>;
|
|
360
359
|
disconnect(sessionId: string): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -354,7 +354,6 @@ declare class LedgerConnectorBase implements IConnector {
|
|
|
354
354
|
* enumerate() cache survives peripherals going offline.
|
|
355
355
|
*/
|
|
356
356
|
protected _discoverDescriptors(dm: LedgerDeviceManager): Promise<DeviceDescriptor[]>;
|
|
357
|
-
private _assertSingleUsbDescriptor;
|
|
358
357
|
searchDevices(): Promise<ConnectorDevice[]>;
|
|
359
358
|
connect(deviceId?: string): Promise<ConnectorSession>;
|
|
360
359
|
disconnect(sessionId: string): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -1066,12 +1066,6 @@ var _LedgerAdapter = class _LedgerAdapter {
|
|
|
1066
1066
|
throw new Error("_doConnect aborted");
|
|
1067
1067
|
}
|
|
1068
1068
|
async _connectFirstOrSelect(devices, targetConnectId) {
|
|
1069
|
-
if (!isLedgerBleConnectionType(this.connector.connectionType) && devices.length > 1) {
|
|
1070
|
-
debugLog(
|
|
1071
|
-
`[DMK] Multiple Ledger USB devices found (${devices.length}); refusing to auto-select by ephemeral connectId.`
|
|
1072
|
-
);
|
|
1073
|
-
throw createMultipleUsbLedgerDevicesError();
|
|
1074
|
-
}
|
|
1075
1069
|
if (targetConnectId) {
|
|
1076
1070
|
const target = devices.find(
|
|
1077
1071
|
(d) => d.connectId === targetConnectId || d.deviceId === targetConnectId
|
|
@@ -1098,6 +1092,9 @@ var _LedgerAdapter = class _LedgerAdapter {
|
|
|
1098
1092
|
code: import_hwk_adapter_core2.HardwareErrorCode.DeviceNotFound
|
|
1099
1093
|
});
|
|
1100
1094
|
}
|
|
1095
|
+
if (devices.length > 1) {
|
|
1096
|
+
throw createMultipleUsbLedgerDevicesError();
|
|
1097
|
+
}
|
|
1101
1098
|
if (devices.length !== 1) {
|
|
1102
1099
|
throw Object.assign(new Error("Ledger device not found."), {
|
|
1103
1100
|
code: import_hwk_adapter_core2.HardwareErrorCode.DeviceNotFound
|
|
@@ -3088,22 +3085,18 @@ var LedgerConnectorBase = class {
|
|
|
3088
3085
|
}
|
|
3089
3086
|
return descriptors;
|
|
3090
3087
|
}
|
|
3091
|
-
_assertSingleUsbDescriptor(descriptors) {
|
|
3092
|
-
if (isLedgerBleConnectionType(this.connectionType) || descriptors.length <= 1) {
|
|
3093
|
-
return;
|
|
3094
|
-
}
|
|
3095
|
-
debugLog(
|
|
3096
|
-
`[DMK] Multiple Ledger USB devices found (${descriptors.length}); refusing to choose by ephemeral path. paths=[${descriptors.map((d) => d.path).join(",")}]`
|
|
3097
|
-
);
|
|
3098
|
-
throw createMultipleUsbLedgerDevicesError();
|
|
3099
|
-
}
|
|
3100
3088
|
// ---------------------------------------------------------------------------
|
|
3101
3089
|
// IConnector -- Device discovery
|
|
3090
|
+
//
|
|
3091
|
+
// Discovery never throws on multiple USB devices — it returns the full list.
|
|
3092
|
+
// The "connect exactly one device" rule is enforced upstream: an explicit
|
|
3093
|
+
// connectId connects that device (or fails as not-found), and only the
|
|
3094
|
+
// no-connectId USB path rejects when more than one device is present
|
|
3095
|
+
// (see LedgerAdapter._connectFirstOrSelect).
|
|
3102
3096
|
// ---------------------------------------------------------------------------
|
|
3103
3097
|
async searchDevices() {
|
|
3104
3098
|
const dm = await this._getDeviceManager();
|
|
3105
3099
|
const descriptors = await this._discoverDescriptors(dm);
|
|
3106
|
-
this._assertSingleUsbDescriptor(descriptors);
|
|
3107
3100
|
const resolvedDescriptors = descriptors.map((d) => ({
|
|
3108
3101
|
descriptor: d,
|
|
3109
3102
|
connectId: this._resolveConnectId(d)
|
|
@@ -3129,10 +3122,6 @@ var LedgerConnectorBase = class {
|
|
|
3129
3122
|
async connect(deviceId) {
|
|
3130
3123
|
const callerSuppliedConnectId = Boolean(deviceId);
|
|
3131
3124
|
let targetPath = deviceId;
|
|
3132
|
-
if (callerSuppliedConnectId && !isLedgerBleConnectionType(this.connectionType)) {
|
|
3133
|
-
const dm = await this._getDeviceManager();
|
|
3134
|
-
this._assertSingleUsbDescriptor(await this._discoverDescriptors(dm));
|
|
3135
|
-
}
|
|
3136
3125
|
if (!targetPath) {
|
|
3137
3126
|
const discovered = await this.searchDevices();
|
|
3138
3127
|
if (discovered.length === 0) {
|