@onekeyfe/hwk-adapter-core 1.2.8-alpha.12 → 1.2.8-alpha.121
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/chunk-DB4JOPZO.mjs +74 -0
- package/dist/chunk-DB4JOPZO.mjs.map +1 -0
- package/dist/{chunk-BAGEFFFY.js → chunk-PY5FNLTS.js} +49 -13
- package/dist/chunk-PY5FNLTS.js.map +1 -0
- package/dist/{chunk-SZZF623R.js → chunk-UFNTICCX.js} +158 -55
- package/dist/chunk-UFNTICCX.js.map +1 -0
- package/dist/{chunk-YA4BWFTZ.mjs → chunk-V2OHL2JS.mjs} +158 -55
- package/dist/chunk-V2OHL2JS.mjs.map +1 -0
- package/dist/{chunk-U63HTLGJ.mjs → chunk-Y7NVGPPY.mjs} +48 -12
- package/dist/chunk-Y7NVGPPY.mjs.map +1 -0
- package/dist/chunk-YLCHSNXO.js +74 -0
- package/dist/chunk-YLCHSNXO.js.map +1 -0
- package/dist/errors-DednD9bG.d.mts +281 -0
- package/dist/errors-DednD9bG.d.ts +281 -0
- package/dist/errors.d.mts +1 -207
- package/dist/errors.d.ts +1 -207
- package/dist/errors.js +8 -2
- package/dist/errors.js.map +1 -1
- package/dist/errors.mjs +9 -3
- package/dist/index.d.mts +969 -401
- package/dist/index.d.ts +969 -401
- package/dist/index.js +1103 -87
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1095 -79
- package/dist/index.mjs.map +1 -1
- package/dist/{ui-events-Cb7haAeE.d.ts → ui-events-D_lCGgCk.d.mts} +80 -3
- package/dist/{ui-events-Cb7haAeE.d.mts → ui-events-D_lCGgCk.d.ts} +80 -3
- package/dist/ui-events.d.mts +1 -1
- package/dist/ui-events.d.ts +1 -1
- package/dist/ui-events.js +3 -2
- package/dist/ui-events.js.map +1 -1
- package/dist/ui-events.mjs +2 -1
- package/package.json +2 -2
- package/dist/chunk-BAGEFFFY.js.map +0 -1
- package/dist/chunk-SZZF623R.js.map +0 -1
- package/dist/chunk-U63HTLGJ.mjs.map +0 -1
- package/dist/chunk-YA4BWFTZ.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,28 +1,58 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
+
var _chunkYLCHSNXOjs = require('./chunk-YLCHSNXO.js');
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
|
|
6
|
-
var _chunkSZZF623Rjs = require('./chunk-SZZF623R.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
var _chunkPY5FNLTSjs = require('./chunk-PY5FNLTS.js');
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
var _chunkUFNTICCXjs = require('./chunk-UFNTICCX.js');
|
|
17
23
|
|
|
18
24
|
// src/types/response.ts
|
|
19
25
|
function success(payload) {
|
|
20
26
|
return { success: true, payload };
|
|
21
27
|
}
|
|
22
|
-
function failure(code, error, params) {
|
|
28
|
+
function failure(code, error, params, origin, recovery) {
|
|
23
29
|
return {
|
|
24
30
|
success: false,
|
|
25
|
-
payload: {
|
|
31
|
+
payload: {
|
|
32
|
+
error,
|
|
33
|
+
code,
|
|
34
|
+
...origin !== void 0 ? { origin } : {},
|
|
35
|
+
recovery: _nullishCoalesce(recovery, () => ( _chunkUFNTICCXjs.defaultRecoveryForCode.call(void 0, code))),
|
|
36
|
+
...params ? { params } : {}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/types/device.ts
|
|
42
|
+
function resolveSearchTargetReusePolicy(device) {
|
|
43
|
+
return _optionalChain([device, 'access', _ => _.capabilities, 'optionalAccess', _2 => _2.persistentDeviceIdentity]) ? "reconnectable" : "current-discovery";
|
|
44
|
+
}
|
|
45
|
+
function toPhysicalDeviceSearchTarget(vendor, device) {
|
|
46
|
+
return {
|
|
47
|
+
searchTargetId: device.connectId,
|
|
48
|
+
searchTargetReusePolicy: resolveSearchTargetReusePolicy(device),
|
|
49
|
+
vendor,
|
|
50
|
+
connectionType: device.connectionType,
|
|
51
|
+
kind: "physical",
|
|
52
|
+
label: device.label,
|
|
53
|
+
model: device.model,
|
|
54
|
+
modelName: device.modelName,
|
|
55
|
+
serialNumber: device.serialNumber
|
|
26
56
|
};
|
|
27
57
|
}
|
|
28
58
|
|
|
@@ -35,8 +65,20 @@ var CHAIN_FINGERPRINT_PATHS = {
|
|
|
35
65
|
// Cointype 1 (testnet) is rejected by some Ledger BTC App configurations.
|
|
36
66
|
btc: "m/44'/0'/0'",
|
|
37
67
|
sol: "m/44'/501'/0'",
|
|
38
|
-
tron: "m/44'/195'/0'/0/0"
|
|
68
|
+
tron: "m/44'/195'/0'/0/0",
|
|
69
|
+
// Shielded UA (single Orchard receiver) derived from the transparent path.
|
|
70
|
+
zcash: "m/44'/133'/0'/0/0"
|
|
39
71
|
};
|
|
72
|
+
function parseBip32MasterFingerprint(value) {
|
|
73
|
+
if (typeof value !== "string") return void 0;
|
|
74
|
+
const normalized = value.trim().toLowerCase();
|
|
75
|
+
return /^[0-9a-f]{8}$/.test(normalized) ? normalized : void 0;
|
|
76
|
+
}
|
|
77
|
+
var MISSING_BIP32_MASTER_FINGERPRINT = "00000000";
|
|
78
|
+
function parseWalletMasterFingerprint(value) {
|
|
79
|
+
const fingerprint = parseBip32MasterFingerprint(value);
|
|
80
|
+
return fingerprint === MISSING_BIP32_MASTER_FINGERPRINT ? void 0 : fingerprint;
|
|
81
|
+
}
|
|
40
82
|
function deriveDeviceFingerprint(value) {
|
|
41
83
|
return _utils.bytesToHex.call(void 0, _sha256.sha256.call(void 0, _utils.utf8ToBytes.call(void 0, value))).slice(0, 16);
|
|
42
84
|
}
|
|
@@ -66,7 +108,8 @@ var SDK = {
|
|
|
66
108
|
DEVICE_STUCK: "device-stuck",
|
|
67
109
|
DEVICE_UNRESPONSIVE: "device-unresponsive",
|
|
68
110
|
DEVICE_RECOVERED: "device-recovered",
|
|
69
|
-
DEVICE_INTERACTION: "device-interaction"
|
|
111
|
+
DEVICE_INTERACTION: "device-interaction",
|
|
112
|
+
OPERATION_ENDED: "operation-ended"
|
|
70
113
|
};
|
|
71
114
|
|
|
72
115
|
// src/utils/DeviceJobQueue.ts
|
|
@@ -75,6 +118,7 @@ var DeviceJobQueue = class {
|
|
|
75
118
|
this._tail = Promise.resolve();
|
|
76
119
|
this._active = null;
|
|
77
120
|
this._jobs = /* @__PURE__ */ new Map();
|
|
121
|
+
this._cancelScopes = /* @__PURE__ */ new Map();
|
|
78
122
|
/** Incremented on clear() so queued-but-not-yet-running jobs detect invalidation. */
|
|
79
123
|
this._generation = 0;
|
|
80
124
|
this._generationCancelReasons = /* @__PURE__ */ new Map();
|
|
@@ -97,12 +141,13 @@ var DeviceJobQueue = class {
|
|
|
97
141
|
abortController: ac,
|
|
98
142
|
startedAt: Date.now()
|
|
99
143
|
};
|
|
100
|
-
this._jobs.set(jobToken,
|
|
144
|
+
this._jobs.set(jobToken, activeJob);
|
|
101
145
|
const next = prev.catch(() => {
|
|
102
146
|
}).then(async () => {
|
|
103
147
|
if (this._generation !== gen) {
|
|
104
148
|
throw _nullishCoalesce(this._generationCancelReasons.get(gen), () => ( new Error("Job cancelled: queue was cleared")));
|
|
105
149
|
}
|
|
150
|
+
if (ac.signal.aborted) throw ac.signal.reason;
|
|
106
151
|
this._active = activeJob;
|
|
107
152
|
try {
|
|
108
153
|
return await job(ac.signal);
|
|
@@ -118,32 +163,52 @@ var DeviceJobQueue = class {
|
|
|
118
163
|
});
|
|
119
164
|
return next;
|
|
120
165
|
}
|
|
121
|
-
/**
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
166
|
+
/**
|
|
167
|
+
* Holds a cancel across the gaps between a bundle's per-item jobs, when the queue is empty.
|
|
168
|
+
* Callers must `release()` when the bundle ends.
|
|
169
|
+
*/
|
|
170
|
+
createCancelScope(deviceId) {
|
|
171
|
+
const scopeToken = {};
|
|
172
|
+
const abortController = new AbortController();
|
|
173
|
+
this._cancelScopes.set(scopeToken, { deviceId, abortController });
|
|
174
|
+
return {
|
|
175
|
+
signal: abortController.signal,
|
|
176
|
+
release: () => {
|
|
177
|
+
this._cancelScopes.delete(scopeToken);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
127
180
|
}
|
|
128
|
-
/**
|
|
129
|
-
|
|
181
|
+
/**
|
|
182
|
+
* Cancels the running job only; `reason` becomes signal.reason. Adapters use
|
|
183
|
+
* `cancelActiveAndPending`; this stays for a connector layer that stops only what is on the wire.
|
|
184
|
+
*/
|
|
185
|
+
cancelActive(deviceId, reason) {
|
|
130
186
|
if (!this._active) return false;
|
|
131
187
|
if (deviceId && this._active.deviceId !== deviceId) return false;
|
|
132
|
-
this._active.abortController.abort(_nullishCoalesce(reason, () => ( new Error("
|
|
188
|
+
this._active.abortController.abort(_nullishCoalesce(reason, () => ( new Error("Cancelled"))));
|
|
133
189
|
return true;
|
|
134
190
|
}
|
|
135
|
-
/**
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
/** Cancel the active job and invalidate queued jobs that have not started. */
|
|
191
|
+
/**
|
|
192
|
+
* Cancels the active job and unstarted queued jobs; returns whether anything was reached. Only
|
|
193
|
+
* `undefined` means everything: an empty key matches nothing instead of tearing the queue down.
|
|
194
|
+
*/
|
|
141
195
|
cancelActiveAndPending(deviceId, reason) {
|
|
142
|
-
|
|
143
|
-
|
|
196
|
+
const cancelReason = _nullishCoalesce(reason, () => ( new Error("Cancelled by cancelActiveAndPending")));
|
|
197
|
+
if (deviceId !== void 0) {
|
|
198
|
+
let cancelled = false;
|
|
199
|
+
const targets = [this._jobs, this._cancelScopes];
|
|
200
|
+
for (const map of targets) {
|
|
201
|
+
for (const target of map.values()) {
|
|
202
|
+
if (target.deviceId !== deviceId) continue;
|
|
203
|
+
target.abortController.abort(cancelReason);
|
|
204
|
+
cancelled = true;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return cancelled;
|
|
144
208
|
}
|
|
145
|
-
this.
|
|
146
|
-
|
|
209
|
+
const reached = this._active !== null || this._jobs.size > 0 || this._cancelScopes.size > 0;
|
|
210
|
+
this.clear(cancelReason);
|
|
211
|
+
return reached;
|
|
147
212
|
}
|
|
148
213
|
/** Get info about the currently active job, or null if idle. */
|
|
149
214
|
getActiveJob(deviceId) {
|
|
@@ -155,10 +220,6 @@ var DeviceJobQueue = class {
|
|
|
155
220
|
startedAt: this._active.startedAt
|
|
156
221
|
};
|
|
157
222
|
}
|
|
158
|
-
/** True if any job is currently running. */
|
|
159
|
-
isBusy() {
|
|
160
|
-
return this._jobs.size > 0;
|
|
161
|
-
}
|
|
162
223
|
clear(reason) {
|
|
163
224
|
const cancelledGeneration = this._generation;
|
|
164
225
|
this._generation++;
|
|
@@ -172,9 +233,232 @@ var DeviceJobQueue = class {
|
|
|
172
233
|
if (this._active) {
|
|
173
234
|
this._active.abortController.abort(cancelReason);
|
|
174
235
|
}
|
|
236
|
+
for (const scope of this._cancelScopes.values()) {
|
|
237
|
+
scope.abortController.abort(cancelReason);
|
|
238
|
+
}
|
|
175
239
|
}
|
|
176
240
|
};
|
|
177
241
|
|
|
242
|
+
// src/utils/hardwareRuntimeId.ts
|
|
243
|
+
|
|
244
|
+
var HARDWARE_RUNTIME_ID_PREFIX = "hwk:runtime";
|
|
245
|
+
var RANDOM_ID_BYTES = 16;
|
|
246
|
+
var RANDOM_ID_PATTERN = /^[0-9a-f]{32}$/;
|
|
247
|
+
var KINDS = /* @__PURE__ */ new Set([
|
|
248
|
+
"operation",
|
|
249
|
+
"search-target",
|
|
250
|
+
"link"
|
|
251
|
+
]);
|
|
252
|
+
var VENDORS = /* @__PURE__ */ new Set(["trezor", "ledger", "keystone"]);
|
|
253
|
+
function create(kind, vendor) {
|
|
254
|
+
return `${HARDWARE_RUNTIME_ID_PREFIX}:${kind}:${vendor}:${_utils.bytesToHex.call(void 0,
|
|
255
|
+
_utils.randomBytes.call(void 0, RANDOM_ID_BYTES)
|
|
256
|
+
)}`;
|
|
257
|
+
}
|
|
258
|
+
function createHardwareOperationId(vendor) {
|
|
259
|
+
return create("operation", vendor);
|
|
260
|
+
}
|
|
261
|
+
function createHardwareSearchTargetId(vendor) {
|
|
262
|
+
return create("search-target", vendor);
|
|
263
|
+
}
|
|
264
|
+
function createHardwareLinkId(vendor) {
|
|
265
|
+
return create("link", vendor);
|
|
266
|
+
}
|
|
267
|
+
function hasHardwareRuntimeIdPrefix(value) {
|
|
268
|
+
return typeof value === "string" && value.startsWith(`${HARDWARE_RUNTIME_ID_PREFIX}:`);
|
|
269
|
+
}
|
|
270
|
+
function parseHardwareRuntimeId(value) {
|
|
271
|
+
if (!hasHardwareRuntimeIdPrefix(value)) return void 0;
|
|
272
|
+
const parts = value.split(":");
|
|
273
|
+
if (parts.length !== 5) return void 0;
|
|
274
|
+
const [, , kind, vendor, nonce] = parts;
|
|
275
|
+
if (!KINDS.has(kind) || !VENDORS.has(vendor) || !RANDOM_ID_PATTERN.test(nonce)) {
|
|
276
|
+
return void 0;
|
|
277
|
+
}
|
|
278
|
+
return { kind, vendor };
|
|
279
|
+
}
|
|
280
|
+
function isHardwareOperationId(value) {
|
|
281
|
+
return _optionalChain([parseHardwareRuntimeId, 'call', _3 => _3(value), 'optionalAccess', _4 => _4.kind]) === "operation";
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// src/utils/OperationRegistry.ts
|
|
285
|
+
var OPERATION_DEFAULT_TTL_MS = 6e5;
|
|
286
|
+
var uniqueKeys = (keys) => Array.from(new Set(keys.filter(Boolean)));
|
|
287
|
+
var OperationRegistry = class {
|
|
288
|
+
constructor(options) {
|
|
289
|
+
this._active = /* @__PURE__ */ new Map();
|
|
290
|
+
this._ended = /* @__PURE__ */ new Map();
|
|
291
|
+
this._vendor = options.vendor;
|
|
292
|
+
this._ttlMs = _nullishCoalesce(options.ttlMs, () => ( OPERATION_DEFAULT_TTL_MS));
|
|
293
|
+
this._onEnded = options.onEnded;
|
|
294
|
+
}
|
|
295
|
+
create(params) {
|
|
296
|
+
const operationId = createHardwareOperationId(this._vendor);
|
|
297
|
+
const operation = {
|
|
298
|
+
operationId,
|
|
299
|
+
connectId: params.connectId,
|
|
300
|
+
device: params.device,
|
|
301
|
+
connectionType: params.connectionType,
|
|
302
|
+
connectionKeys: uniqueKeys([
|
|
303
|
+
params.searchTargetId,
|
|
304
|
+
params.connectId,
|
|
305
|
+
..._nullishCoalesce(params.connectionKeys, () => ( []))
|
|
306
|
+
])
|
|
307
|
+
};
|
|
308
|
+
const timer = this._createTimer(operationId);
|
|
309
|
+
this._active.set(operationId, { ...operation, timer, retainCount: 0 });
|
|
310
|
+
return operation;
|
|
311
|
+
}
|
|
312
|
+
resolve(operationId) {
|
|
313
|
+
const active = this._active.get(operationId);
|
|
314
|
+
if (!active) {
|
|
315
|
+
const ended = this._ended.get(operationId);
|
|
316
|
+
if (ended) {
|
|
317
|
+
throw _chunkUFNTICCXjs.createHwkError.call(void 0, {
|
|
318
|
+
code: 10113 /* OperationEnded */,
|
|
319
|
+
message: `Hardware operation has ended (${ended.reason})`,
|
|
320
|
+
params: { operationId, reason: ended.reason }
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
throw _chunkUFNTICCXjs.createHwkError.call(void 0, {
|
|
324
|
+
code: 10112 /* OperationNotFound */,
|
|
325
|
+
message: "Hardware operation was not found",
|
|
326
|
+
params: { operationId }
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
this._touch(active);
|
|
330
|
+
return active;
|
|
331
|
+
}
|
|
332
|
+
/** Keep an operation alive while one device job is actively using it. */
|
|
333
|
+
retain(operationId) {
|
|
334
|
+
const active = this.resolve(operationId);
|
|
335
|
+
active.retainCount += 1;
|
|
336
|
+
this._touch(active);
|
|
337
|
+
let released = false;
|
|
338
|
+
return () => {
|
|
339
|
+
if (released) return;
|
|
340
|
+
released = true;
|
|
341
|
+
const current = this._active.get(operationId);
|
|
342
|
+
if (!current) return;
|
|
343
|
+
current.retainCount = Math.max(0, current.retainCount - 1);
|
|
344
|
+
this._touch(current);
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
/** Return a live operation without refreshing its TTL; ended and unknown ids give undefined. */
|
|
348
|
+
findActive(operationId) {
|
|
349
|
+
return this._active.get(operationId);
|
|
350
|
+
}
|
|
351
|
+
/** Return active or tombstoned binding data without refreshing its TTL. */
|
|
352
|
+
find(operationId) {
|
|
353
|
+
return _nullishCoalesce(this._active.get(operationId), () => ( _optionalChain([this, 'access', _5 => _5._ended, 'access', _6 => _6.get, 'call', _7 => _7(operationId), 'optionalAccess', _8 => _8.operation])));
|
|
354
|
+
}
|
|
355
|
+
findActiveByConnectionKey(connectionKey) {
|
|
356
|
+
if (!connectionKey) return void 0;
|
|
357
|
+
return [...this._active.values()].find(
|
|
358
|
+
(operation) => operation.connectionKeys.includes(connectionKey)
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
/** Only an explicitly supplied operation job key owns the call's UI requests. */
|
|
362
|
+
findOperationIdByJobKey(jobKey) {
|
|
363
|
+
return isHardwareOperationId(jobKey) ? jobKey : void 0;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* End an operation on the caller's explicit release. Throws for an unknown id; returns undefined
|
|
367
|
+
* when it had already ended.
|
|
368
|
+
*/
|
|
369
|
+
release(operationId) {
|
|
370
|
+
if (!this.find(operationId)) {
|
|
371
|
+
this.resolve(operationId);
|
|
372
|
+
return void 0;
|
|
373
|
+
}
|
|
374
|
+
return this.end(operationId, "explicit");
|
|
375
|
+
}
|
|
376
|
+
end(operationId, reason) {
|
|
377
|
+
const active = this._active.get(operationId);
|
|
378
|
+
if (!active) return void 0;
|
|
379
|
+
if (active.timer) clearTimeout(active.timer);
|
|
380
|
+
this._active.delete(operationId);
|
|
381
|
+
this._rememberEnded(active, reason);
|
|
382
|
+
_optionalChain([this, 'access', _9 => _9._onEnded, 'optionalCall', _10 => _10(active, reason)]);
|
|
383
|
+
return active;
|
|
384
|
+
}
|
|
385
|
+
endByConnectionKey(connectionKey, reason, exceptOperationId) {
|
|
386
|
+
if (!connectionKey) return;
|
|
387
|
+
for (const operation of [...this._active.values()]) {
|
|
388
|
+
if (operation.operationId === exceptOperationId) continue;
|
|
389
|
+
if (operation.connectionKeys.includes(connectionKey)) {
|
|
390
|
+
this.end(operation.operationId, reason);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
endAll(reason, exceptOperationId) {
|
|
395
|
+
for (const operationId of [...this._active.keys()]) {
|
|
396
|
+
if (operationId === exceptOperationId) continue;
|
|
397
|
+
this.end(operationId, reason);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
_touch(active) {
|
|
401
|
+
if (active.timer) clearTimeout(active.timer);
|
|
402
|
+
active.timer = active.retainCount === 0 ? this._createTimer(active.operationId) : void 0;
|
|
403
|
+
}
|
|
404
|
+
_createTimer(operationId) {
|
|
405
|
+
const timer = setTimeout(() => {
|
|
406
|
+
this.end(operationId, "timeout");
|
|
407
|
+
}, this._ttlMs);
|
|
408
|
+
_optionalChain([timer, 'access', _11 => _11.unref, 'optionalCall', _12 => _12()]);
|
|
409
|
+
return timer;
|
|
410
|
+
}
|
|
411
|
+
_rememberEnded(operation, reason) {
|
|
412
|
+
this._ended.set(operation.operationId, { reason, operation });
|
|
413
|
+
if (this._ended.size <= 100) return;
|
|
414
|
+
const oldest = this._ended.keys().next().value;
|
|
415
|
+
if (oldest) this._ended.delete(oldest);
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
// src/utils/hardwareOperationTarget.ts
|
|
420
|
+
function resolveHardwareOperationTarget(positionalTargetId, commonOperationId, expectedVendor) {
|
|
421
|
+
const targetId = _nullishCoalesce(positionalTargetId, () => ( void 0));
|
|
422
|
+
const commonId = commonOperationId || void 0;
|
|
423
|
+
const parsedTarget = parseHardwareRuntimeId(targetId);
|
|
424
|
+
const parsedCommon = parseHardwareRuntimeId(commonId);
|
|
425
|
+
const positionalOperationId = _optionalChain([parsedTarget, 'optionalAccess', _13 => _13.kind]) === "operation" ? targetId : void 0;
|
|
426
|
+
if (hasHardwareRuntimeIdPrefix(targetId) && !parsedTarget) {
|
|
427
|
+
return failure(10002 /* InvalidParams */, "Invalid hardware operation target id");
|
|
428
|
+
}
|
|
429
|
+
if (_optionalChain([parsedTarget, 'optionalAccess', _14 => _14.kind]) === "link") {
|
|
430
|
+
return failure(
|
|
431
|
+
10002 /* InvalidParams */,
|
|
432
|
+
"Hardware transport link id cannot be used as an operation target"
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
if (commonId && _optionalChain([parsedCommon, 'optionalAccess', _15 => _15.kind]) !== "operation") {
|
|
436
|
+
return failure(10002 /* InvalidParams */, "Invalid hardware operation id");
|
|
437
|
+
}
|
|
438
|
+
if (expectedVendor && [parsedTarget, parsedCommon].some((parsed) => parsed && parsed.vendor !== expectedVendor)) {
|
|
439
|
+
return failure(
|
|
440
|
+
10002 /* InvalidParams */,
|
|
441
|
+
`Hardware operation does not belong to ${expectedVendor}`
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
if (positionalOperationId && commonId && positionalOperationId !== commonId) {
|
|
445
|
+
return failure(10002 /* InvalidParams */, "Conflicting hardware operation ids", {
|
|
446
|
+
positionalOperationId,
|
|
447
|
+
commonOperationId: commonId
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
const operationId = _nullishCoalesce(commonId, () => ( positionalOperationId));
|
|
451
|
+
return success({ operationId, targetId: _nullishCoalesce(operationId, () => ( targetId)) });
|
|
452
|
+
}
|
|
453
|
+
function pickConnectionContext(params) {
|
|
454
|
+
return {
|
|
455
|
+
knownConnections: params.knownConnections,
|
|
456
|
+
extra: params.extra,
|
|
457
|
+
allowDeviceSelection: typeof params.allowDeviceSelection === "boolean" ? params.allowDeviceSelection : void 0,
|
|
458
|
+
supportedTransports: params.supportedTransports
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
|
|
178
462
|
// src/types/connector.ts
|
|
179
463
|
var EConnectorInteraction = /* @__PURE__ */ ((EConnectorInteraction2) => {
|
|
180
464
|
EConnectorInteraction2["Searching"] = "searching";
|
|
@@ -190,7 +474,7 @@ function createBridgedConnector(vendor, connectionType, bridge) {
|
|
|
190
474
|
return {
|
|
191
475
|
connectionType,
|
|
192
476
|
searchDevices: (options) => bridge.searchDevices({ vendor, options }),
|
|
193
|
-
connect: (deviceId) => bridge.connect({ vendor, deviceId }),
|
|
477
|
+
connect: (deviceId, options) => bridge.connect({ vendor, deviceId, ...options ? { options } : {} }),
|
|
194
478
|
disconnect: (sessionId) => bridge.disconnect({ vendor, sessionId }),
|
|
195
479
|
call: (sessionId, method, callParams) => bridge.call({ vendor, sessionId, method, callParams }),
|
|
196
480
|
cancel: (sessionId) => bridge.cancel({ vendor, sessionId }),
|
|
@@ -211,14 +495,14 @@ function createBridgedConnector(vendor, connectionType, bridge) {
|
|
|
211
495
|
},
|
|
212
496
|
off: (event, handler) => {
|
|
213
497
|
const inner = handlerMap.get(event);
|
|
214
|
-
const bridgeHandler = _optionalChain([inner, 'optionalAccess',
|
|
498
|
+
const bridgeHandler = _optionalChain([inner, 'optionalAccess', _16 => _16.get, 'call', _17 => _17(handler)]);
|
|
215
499
|
if (!bridgeHandler || !inner) return;
|
|
216
500
|
bridge.offEvent({ vendor }, bridgeHandler);
|
|
217
501
|
inner.delete(handler);
|
|
218
502
|
if (inner.size === 0) handlerMap.delete(event);
|
|
219
503
|
},
|
|
220
504
|
reset: () => bridge.reset({ vendor }),
|
|
221
|
-
configure: bridge.configure ? (config) => _optionalChain([bridge, 'access',
|
|
505
|
+
configure: bridge.configure ? (config) => _optionalChain([bridge, 'access', _18 => _18.configure, 'optionalCall', _19 => _19({ vendor, config })]) : void 0,
|
|
222
506
|
setKnownCredentials: bridge.setKnownCredentials ? (credentials) => bridge.setKnownCredentials({ vendor, credentials }) : void 0
|
|
223
507
|
};
|
|
224
508
|
}
|
|
@@ -279,6 +563,15 @@ function rehydrateConnectorError(error) {
|
|
|
279
563
|
..._nullishCoalesce(params, () => ( {}))
|
|
280
564
|
});
|
|
281
565
|
}
|
|
566
|
+
function withChildConnectionType(event, data, connectionType) {
|
|
567
|
+
if (event !== "device-connect" && event !== "features") return data;
|
|
568
|
+
const { device } = data;
|
|
569
|
+
if (device.connectionType) return data;
|
|
570
|
+
return {
|
|
571
|
+
...data,
|
|
572
|
+
device: { ...device, connectionType }
|
|
573
|
+
};
|
|
574
|
+
}
|
|
282
575
|
function isDeviceUnavailableError(error) {
|
|
283
576
|
const typed = error;
|
|
284
577
|
if (typed.code === 10100 /* DeviceNotFound */ || typed.code === 10101 /* DeviceDisconnected */) {
|
|
@@ -287,13 +580,13 @@ function isDeviceUnavailableError(error) {
|
|
|
287
580
|
return false;
|
|
288
581
|
}
|
|
289
582
|
function combinedDeviceNotFoundError(message) {
|
|
290
|
-
return
|
|
583
|
+
return _chunkUFNTICCXjs.createHwkError.call(void 0, {
|
|
291
584
|
code: 10100 /* DeviceNotFound */,
|
|
292
585
|
message
|
|
293
586
|
});
|
|
294
587
|
}
|
|
295
588
|
function combinedSessionNotFoundError(message) {
|
|
296
|
-
return
|
|
589
|
+
return _chunkUFNTICCXjs.createHwkError.call(void 0, {
|
|
297
590
|
code: 10101 /* DeviceDisconnected */,
|
|
298
591
|
message
|
|
299
592
|
});
|
|
@@ -322,19 +615,26 @@ function createCombinedConnector(connectors) {
|
|
|
322
615
|
};
|
|
323
616
|
const broadcastCredentials = async () => {
|
|
324
617
|
await Promise.all(
|
|
325
|
-
connectors.map((child) => Promise.resolve(_optionalChain([child, 'access',
|
|
618
|
+
connectors.map((child) => Promise.resolve(_optionalChain([child, 'access', _20 => _20.setKnownCredentials, 'optionalCall', _21 => _21(sharedCredentials)])))
|
|
326
619
|
);
|
|
327
620
|
};
|
|
328
621
|
for (const child of connectors) {
|
|
329
622
|
child.on("device-trezor-thp-credentials-changed", (data) => {
|
|
330
|
-
|
|
623
|
+
const removed = new Set((_nullishCoalesce(data.removed, () => ( []))).map(credentialKey));
|
|
624
|
+
const kept = sharedCredentials.filter((cred) => !removed.has(credentialKey(cred)));
|
|
625
|
+
const dropped = kept.length !== sharedCredentials.length;
|
|
626
|
+
sharedCredentials.splice(0, sharedCredentials.length, ...kept);
|
|
627
|
+
if (mergeShared(data.credentials) || dropped) void broadcastCredentials();
|
|
331
628
|
});
|
|
332
629
|
}
|
|
630
|
+
const onTransport = (child, transportType) => !transportType || child.connectionType === transportType;
|
|
333
631
|
const searchDevices = async (options = {}) => {
|
|
632
|
+
const selectedConnectors = connectors.map((child, index) => ({ child, index })).filter(({ child }) => onTransport(child, options.transportType));
|
|
633
|
+
if (!selectedConnectors.length) return [];
|
|
334
634
|
const perConnector = [];
|
|
335
|
-
await new Promise((resolve) => {
|
|
635
|
+
await new Promise((resolve, reject) => {
|
|
336
636
|
let finished = false;
|
|
337
|
-
let remaining =
|
|
637
|
+
let remaining = selectedConnectors.length;
|
|
338
638
|
let settleTimer;
|
|
339
639
|
const finish = () => {
|
|
340
640
|
if (finished) return;
|
|
@@ -342,19 +642,20 @@ function createCombinedConnector(connectors) {
|
|
|
342
642
|
if (settleTimer) clearTimeout(settleTimer);
|
|
343
643
|
resolve();
|
|
344
644
|
};
|
|
345
|
-
|
|
346
|
-
void child.searchDevices().then(
|
|
645
|
+
selectedConnectors.forEach(({ child, index }) => {
|
|
646
|
+
void child.searchDevices(options.purpose ? { purpose: options.purpose } : void 0).then(
|
|
347
647
|
(devices) => devices.map((device) => ({
|
|
348
648
|
...device,
|
|
349
649
|
connectionType: _nullishCoalesce(device.connectionType, () => ( child.connectionType))
|
|
350
650
|
}))
|
|
351
|
-
).catch(
|
|
352
|
-
()
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
651
|
+
).catch((error) => {
|
|
652
|
+
if (options.transportType) {
|
|
653
|
+
finished = true;
|
|
654
|
+
if (settleTimer) clearTimeout(settleTimer);
|
|
655
|
+
reject(error);
|
|
656
|
+
}
|
|
657
|
+
return [];
|
|
658
|
+
}).then((devices) => {
|
|
358
659
|
remaining -= 1;
|
|
359
660
|
if (!finished) {
|
|
360
661
|
perConnector.push({ index, devices });
|
|
@@ -371,7 +672,9 @@ function createCombinedConnector(connectors) {
|
|
|
371
672
|
});
|
|
372
673
|
});
|
|
373
674
|
perConnector.sort((a, b) => a.index - b.index);
|
|
374
|
-
deviceOwner
|
|
675
|
+
for (const [id, owner] of deviceOwner) {
|
|
676
|
+
if (onTransport(owner, options.transportType)) deviceOwner.delete(id);
|
|
677
|
+
}
|
|
375
678
|
const merged = [];
|
|
376
679
|
perConnector.forEach(({ index, devices }) => {
|
|
377
680
|
for (const device of devices) {
|
|
@@ -381,11 +684,12 @@ function createCombinedConnector(connectors) {
|
|
|
381
684
|
});
|
|
382
685
|
return merged.sort((a, b) => rank(a) - rank(b));
|
|
383
686
|
};
|
|
384
|
-
const resolveOwner = async (deviceId) => {
|
|
385
|
-
|
|
386
|
-
|
|
687
|
+
const resolveOwner = async (deviceId, transportType) => {
|
|
688
|
+
const cachedOwner = deviceId ? deviceOwner.get(deviceId) : void 0;
|
|
689
|
+
if (cachedOwner && onTransport(cachedOwner, transportType)) {
|
|
690
|
+
return { owner: cachedOwner, deviceId };
|
|
387
691
|
}
|
|
388
|
-
const devices = await searchDevices({ waitForAll: Boolean(deviceId) });
|
|
692
|
+
const devices = await searchDevices({ waitForAll: Boolean(deviceId), transportType });
|
|
389
693
|
if (deviceId) {
|
|
390
694
|
const owner = deviceOwner.get(deviceId);
|
|
391
695
|
if (!owner)
|
|
@@ -396,13 +700,14 @@ function createCombinedConnector(connectors) {
|
|
|
396
700
|
if (!first) throw combinedDeviceNotFoundError("Combined connector: no devices found");
|
|
397
701
|
return { owner: deviceOwner.get(first.connectId), deviceId: first.connectId };
|
|
398
702
|
};
|
|
399
|
-
const connectByExplicitId = async (deviceId) => {
|
|
703
|
+
const connectByExplicitId = async (deviceId, transportType) => {
|
|
400
704
|
const cachedOwner = deviceOwner.get(deviceId);
|
|
401
|
-
if (cachedOwner) {
|
|
705
|
+
if (cachedOwner && onTransport(cachedOwner, transportType)) {
|
|
402
706
|
return { session: await cachedOwner.connect(deviceId), owner: cachedOwner };
|
|
403
707
|
}
|
|
404
708
|
let lastError;
|
|
405
709
|
for (const child of connectors) {
|
|
710
|
+
if (!onTransport(child, transportType)) continue;
|
|
406
711
|
try {
|
|
407
712
|
const session = await child.connect(deviceId);
|
|
408
713
|
deviceOwner.set(deviceId, child);
|
|
@@ -415,7 +720,7 @@ function createCombinedConnector(connectors) {
|
|
|
415
720
|
}
|
|
416
721
|
}
|
|
417
722
|
const message = lastError instanceof Error ? lastError.message : `Combined connector: device not found: ${deviceId}`;
|
|
418
|
-
throw
|
|
723
|
+
throw _chunkUFNTICCXjs.createHwkError.call(void 0, {
|
|
419
724
|
code: 10100 /* DeviceNotFound */,
|
|
420
725
|
message
|
|
421
726
|
});
|
|
@@ -424,14 +729,15 @@ function createCombinedConnector(connectors) {
|
|
|
424
729
|
// Nominal value only — the per-device `connectionType` is authoritative
|
|
425
730
|
// for a fused connector.
|
|
426
731
|
connectionType: connectors[0].connectionType,
|
|
427
|
-
|
|
428
|
-
|
|
732
|
+
availableTransports: [...new Set(connectors.map((child) => child.connectionType))],
|
|
733
|
+
searchDevices: (options) => searchDevices(options),
|
|
734
|
+
connect: async (deviceId, options) => {
|
|
429
735
|
let owner;
|
|
430
736
|
let session;
|
|
431
737
|
if (deviceId) {
|
|
432
|
-
({ session, owner } = await connectByExplicitId(deviceId));
|
|
738
|
+
({ session, owner } = await connectByExplicitId(deviceId, _optionalChain([options, 'optionalAccess', _22 => _22.transportType])));
|
|
433
739
|
} else {
|
|
434
|
-
const resolved = await resolveOwner();
|
|
740
|
+
const resolved = await resolveOwner(void 0, _optionalChain([options, 'optionalAccess', _23 => _23.transportType]));
|
|
435
741
|
owner = resolved.owner;
|
|
436
742
|
session = await owner.connect(resolved.deviceId);
|
|
437
743
|
}
|
|
@@ -453,15 +759,18 @@ function createCombinedConnector(connectors) {
|
|
|
453
759
|
},
|
|
454
760
|
cancel: async (sessionId) => {
|
|
455
761
|
const owner = sessionOwner.get(sessionId);
|
|
456
|
-
if (
|
|
457
|
-
|
|
762
|
+
if (owner) {
|
|
763
|
+
await owner.cancel(sessionId);
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
await Promise.all(connectors.map((child) => child.cancel(sessionId)));
|
|
458
767
|
},
|
|
459
768
|
uiResponse: (response) => {
|
|
460
769
|
for (const child of connectors) child.uiResponse(response);
|
|
461
770
|
},
|
|
462
771
|
on: (event, handler) => {
|
|
463
772
|
const attached = connectors.map((child) => {
|
|
464
|
-
const forward = (data) => handler(data);
|
|
773
|
+
const forward = (data) => handler(withChildConnectionType(event, data, child.connectionType));
|
|
465
774
|
child.on(event, forward);
|
|
466
775
|
return { child, handler: forward };
|
|
467
776
|
});
|
|
@@ -474,7 +783,7 @@ function createCombinedConnector(connectors) {
|
|
|
474
783
|
},
|
|
475
784
|
off: (event, handler) => {
|
|
476
785
|
const inner = forwarders.get(event);
|
|
477
|
-
const attached = _optionalChain([inner, 'optionalAccess',
|
|
786
|
+
const attached = _optionalChain([inner, 'optionalAccess', _24 => _24.get, 'call', _25 => _25(handler)]);
|
|
478
787
|
if (!attached || !inner) return;
|
|
479
788
|
for (const { child, handler: forward } of attached) {
|
|
480
789
|
child.off(event, forward);
|
|
@@ -489,7 +798,7 @@ function createCombinedConnector(connectors) {
|
|
|
489
798
|
forwarders.clear();
|
|
490
799
|
},
|
|
491
800
|
configure: connectors.some((c) => c.configure) ? async (config) => {
|
|
492
|
-
await Promise.all(connectors.map((child) => Promise.resolve(_optionalChain([child, 'access',
|
|
801
|
+
await Promise.all(connectors.map((child) => Promise.resolve(_optionalChain([child, 'access', _26 => _26.configure, 'optionalCall', _27 => _27(config)]))));
|
|
493
802
|
deviceOwner.clear();
|
|
494
803
|
sessionOwner.clear();
|
|
495
804
|
} : void 0,
|
|
@@ -533,10 +842,148 @@ var TypedEventEmitter = class {
|
|
|
533
842
|
}
|
|
534
843
|
/** Number of listeners registered for `event`. 0 if none. */
|
|
535
844
|
listenerCount(event) {
|
|
536
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
845
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _28 => _28._listeners, 'access', _29 => _29.get, 'call', _30 => _30(event), 'optionalAccess', _31 => _31.size]), () => ( 0));
|
|
537
846
|
}
|
|
538
847
|
};
|
|
539
848
|
|
|
849
|
+
// src/utils/requestSaveDeviceBinding.ts
|
|
850
|
+
function emitDeviceBindingStatus(emitter, selectionRequestId, status) {
|
|
851
|
+
emitter.emit(_chunkPY5FNLTSjs.UI_REQUEST.DEVICE_BINDING_STATUS, {
|
|
852
|
+
type: _chunkPY5FNLTSjs.UI_REQUEST.DEVICE_BINDING_STATUS,
|
|
853
|
+
payload: { selectionRequestId, status }
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
async function requestSaveDeviceBinding(emitter, registry, binding, signal) {
|
|
857
|
+
const type = _chunkPY5FNLTSjs.UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING;
|
|
858
|
+
const emitStatus = (status) => emitDeviceBindingStatus(emitter, binding.selectionRequestId, status);
|
|
859
|
+
const declined = (reason) => {
|
|
860
|
+
emitStatus("failed");
|
|
861
|
+
return { saved: false, reason };
|
|
862
|
+
};
|
|
863
|
+
if (!emitter.listenerCount(type)) {
|
|
864
|
+
return declined("skipped");
|
|
865
|
+
}
|
|
866
|
+
if (_optionalChain([signal, 'optionalAccess', _32 => _32.aborted])) throw signal.reason;
|
|
867
|
+
const requestId = registry.createRequestId();
|
|
868
|
+
const pending = registry.wait(type, { requestId, operationId: binding.operationId });
|
|
869
|
+
void pending.catch(() => void 0);
|
|
870
|
+
const cancel = () => registry.cancel(type, requestId);
|
|
871
|
+
_optionalChain([signal, 'optionalAccess', _33 => _33.addEventListener, 'call', _34 => _34("abort", cancel, { once: true })]);
|
|
872
|
+
try {
|
|
873
|
+
emitter.emit(type, { type, payload: { ...binding, requestId } });
|
|
874
|
+
const response = await pending;
|
|
875
|
+
if (_optionalChain([signal, 'optionalAccess', _35 => _35.aborted])) throw signal.reason;
|
|
876
|
+
if (_optionalChain([response, 'optionalAccess', _36 => _36.saved]) !== true) {
|
|
877
|
+
return declined(_nullishCoalesce(_optionalChain([response, 'optionalAccess', _37 => _37.reason]), () => ( "skipped")));
|
|
878
|
+
}
|
|
879
|
+
emitStatus("saved");
|
|
880
|
+
return { saved: true };
|
|
881
|
+
} catch (error) {
|
|
882
|
+
if (_optionalChain([signal, 'optionalAccess', _38 => _38.aborted])) {
|
|
883
|
+
emitStatus("cancelled");
|
|
884
|
+
throw error;
|
|
885
|
+
}
|
|
886
|
+
return declined("skipped");
|
|
887
|
+
} finally {
|
|
888
|
+
_optionalChain([signal, 'optionalAccess', _39 => _39.removeEventListener, 'call', _40 => _40("abort", cancel)]);
|
|
889
|
+
registry.cancel(type, requestId);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
// src/utils/requestBleDeviceSelection.ts
|
|
894
|
+
async function requestBleDeviceSelection({
|
|
895
|
+
emitter,
|
|
896
|
+
registry,
|
|
897
|
+
request,
|
|
898
|
+
scan,
|
|
899
|
+
signal,
|
|
900
|
+
allowUsbFallback = false,
|
|
901
|
+
pollIntervalMs = 1500
|
|
902
|
+
}) {
|
|
903
|
+
const type = _chunkPY5FNLTSjs.UI_REQUEST.REQUEST_SELECT_DEVICE;
|
|
904
|
+
if (signal.aborted) throw signal.reason;
|
|
905
|
+
if (!emitter.listenerCount(type)) {
|
|
906
|
+
throw _chunkUFNTICCXjs.createHwkError.call(void 0, {
|
|
907
|
+
code: 10100 /* DeviceNotFound */,
|
|
908
|
+
message: "Select a Bluetooth device before continuing"
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
const requestId = registry.createRequestId();
|
|
912
|
+
const { operationId } = request;
|
|
913
|
+
let devices = allowUsbFallback ? request.devices.filter((device) => device.connectionType === "ble") : request.devices;
|
|
914
|
+
const publishedDevices = /* @__PURE__ */ new Map();
|
|
915
|
+
let stopped = false;
|
|
916
|
+
let timer;
|
|
917
|
+
let wake;
|
|
918
|
+
const stop = () => {
|
|
919
|
+
stopped = true;
|
|
920
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
921
|
+
_optionalChain([wake, 'optionalCall', _41 => _41()]);
|
|
922
|
+
};
|
|
923
|
+
const waitForNextScan = () => new Promise((resolve) => {
|
|
924
|
+
wake = resolve;
|
|
925
|
+
timer = setTimeout(resolve, pollIntervalMs);
|
|
926
|
+
if (stopped) resolve();
|
|
927
|
+
});
|
|
928
|
+
const cancel = () => registry.cancel(type, requestId);
|
|
929
|
+
const reply = registry.wait(type, { requestId, operationId }).finally(stop);
|
|
930
|
+
void reply.catch(() => void 0);
|
|
931
|
+
const publish = () => {
|
|
932
|
+
for (const device of devices) publishedDevices.set(device.connectId, device);
|
|
933
|
+
emitter.emit(type, {
|
|
934
|
+
type,
|
|
935
|
+
payload: { ...request, devices, requestId, scanning: true }
|
|
936
|
+
});
|
|
937
|
+
};
|
|
938
|
+
signal.addEventListener("abort", cancel, { once: true });
|
|
939
|
+
const rescan = () => scan().catch((error) => {
|
|
940
|
+
if (stopped || signal.aborted || devices.length) return void 0;
|
|
941
|
+
throw error;
|
|
942
|
+
});
|
|
943
|
+
let polling;
|
|
944
|
+
try {
|
|
945
|
+
publish();
|
|
946
|
+
polling = (async () => {
|
|
947
|
+
await Promise.resolve();
|
|
948
|
+
while (!stopped) {
|
|
949
|
+
const snapshot = await rescan();
|
|
950
|
+
if (stopped || signal.aborted) return;
|
|
951
|
+
const usbFallback = allowUsbFallback ? _optionalChain([snapshot, 'optionalAccess', _42 => _42.find, 'call', _43 => _43((device2) => device2.connectionType === "usb")]) : void 0;
|
|
952
|
+
if (usbFallback) return usbFallback;
|
|
953
|
+
if (snapshot) {
|
|
954
|
+
devices = snapshot;
|
|
955
|
+
publish();
|
|
956
|
+
}
|
|
957
|
+
await waitForNextScan();
|
|
958
|
+
}
|
|
959
|
+
})();
|
|
960
|
+
const userSelection = reply.then((selected) => publishedDevices.get(selected.sdkConnectId));
|
|
961
|
+
const device = await Promise.race([
|
|
962
|
+
userSelection,
|
|
963
|
+
polling.then((usbFallback) => _nullishCoalesce(usbFallback, () => ( userSelection)))
|
|
964
|
+
]);
|
|
965
|
+
stop();
|
|
966
|
+
await polling;
|
|
967
|
+
if (signal.aborted) throw signal.reason;
|
|
968
|
+
if (!device) {
|
|
969
|
+
throw _chunkUFNTICCXjs.createHwkError.call(void 0, {
|
|
970
|
+
code: 10100 /* DeviceNotFound */,
|
|
971
|
+
message: "Selected Bluetooth device is no longer available"
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
emitDeviceBindingStatus(emitter, requestId, "verifying");
|
|
975
|
+
return { device, requestId };
|
|
976
|
+
} catch (error) {
|
|
977
|
+
emitDeviceBindingStatus(emitter, requestId, signal.aborted ? "cancelled" : "failed");
|
|
978
|
+
throw error;
|
|
979
|
+
} finally {
|
|
980
|
+
stop();
|
|
981
|
+
signal.removeEventListener("abort", cancel);
|
|
982
|
+
registry.cancel(type, requestId);
|
|
983
|
+
await _optionalChain([polling, 'optionalAccess', _44 => _44.catch, 'call', _45 => _45(() => void 0)]);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
|
|
540
987
|
// src/utils/semver.ts
|
|
541
988
|
function compareSemver(a, b) {
|
|
542
989
|
const pa = a.split(".").map(Number);
|
|
@@ -564,15 +1011,481 @@ function padHex64(hex) {
|
|
|
564
1011
|
function hexToBytes(hex) {
|
|
565
1012
|
return _utils.hexToBytes.call(void 0, stripHex(hex));
|
|
566
1013
|
}
|
|
567
|
-
function
|
|
1014
|
+
function bytesToHex3(bytes) {
|
|
568
1015
|
return _utils.bytesToHex.call(void 0, bytes);
|
|
569
1016
|
}
|
|
570
1017
|
|
|
1018
|
+
// src/utils/boundedCbor.ts
|
|
1019
|
+
var MAX_CBOR_DEPTH = 64;
|
|
1020
|
+
var DEFAULT_MAX_CBOR_BYTES = 8 * 1024 * 1024;
|
|
1021
|
+
var ARGUMENT_BYTES = [1, 2, 4, 8];
|
|
1022
|
+
function malformed(reason) {
|
|
1023
|
+
return _chunkUFNTICCXjs.createHwkError.call(void 0, {
|
|
1024
|
+
code: 10002 /* InvalidParams */,
|
|
1025
|
+
message: `Malformed CBOR payload: ${reason}`
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
function assertBoundedCbor(input, maxBytes = DEFAULT_MAX_CBOR_BYTES) {
|
|
1029
|
+
if (input.length === 0) throw malformed("empty");
|
|
1030
|
+
if (input.length > maxBytes) throw malformed(`larger than ${maxBytes} bytes`);
|
|
1031
|
+
let offset = 0;
|
|
1032
|
+
const readArgument = (info) => {
|
|
1033
|
+
if (info < 24) return info;
|
|
1034
|
+
const size = ARGUMENT_BYTES[info - 24];
|
|
1035
|
+
if (offset + size > input.length) throw malformed("truncated length");
|
|
1036
|
+
let value = 0;
|
|
1037
|
+
for (let i = 0; i < size; i += 1) value = value * 256 + input[offset + i];
|
|
1038
|
+
offset += size;
|
|
1039
|
+
return value;
|
|
1040
|
+
};
|
|
1041
|
+
const walkItem = (depth) => {
|
|
1042
|
+
if (depth > MAX_CBOR_DEPTH) throw malformed("nested too deeply");
|
|
1043
|
+
if (offset >= input.length) throw malformed("truncated item");
|
|
1044
|
+
const initial = input[offset];
|
|
1045
|
+
offset += 1;
|
|
1046
|
+
const major = Math.floor(initial / 32);
|
|
1047
|
+
const info = initial % 32;
|
|
1048
|
+
if (info >= 28) throw malformed("indefinite or reserved length");
|
|
1049
|
+
const argument = readArgument(info);
|
|
1050
|
+
const remaining = input.length - offset;
|
|
1051
|
+
if (major === 2 || major === 3) {
|
|
1052
|
+
if (argument > remaining) throw malformed("string longer than the payload");
|
|
1053
|
+
offset += argument;
|
|
1054
|
+
} else if (major === 4 || major === 5) {
|
|
1055
|
+
const items = major === 5 ? argument * 2 : argument;
|
|
1056
|
+
if (items > remaining) throw malformed("container longer than the payload");
|
|
1057
|
+
for (let i = 0; i < items; i += 1) walkItem(depth + 1);
|
|
1058
|
+
} else if (major === 6) {
|
|
1059
|
+
walkItem(depth + 1);
|
|
1060
|
+
}
|
|
1061
|
+
};
|
|
1062
|
+
walkItem(0);
|
|
1063
|
+
if (offset !== input.length) throw malformed("trailing bytes");
|
|
1064
|
+
}
|
|
1065
|
+
function boundedCborFromHex(hex, maxBytes) {
|
|
1066
|
+
if (!/^(?:[0-9a-f]{2})+$/i.test(hex)) throw malformed("not an even-length hex string");
|
|
1067
|
+
const bytes = Buffer.from(hex, "hex");
|
|
1068
|
+
assertBoundedCbor(bytes, maxBytes);
|
|
1069
|
+
return bytes;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
// src/utils/solanaOffchainMessage.ts
|
|
1073
|
+
var SOLANA_OFFCHAIN_SIGNING_DOMAIN = Uint8Array.of(
|
|
1074
|
+
255,
|
|
1075
|
+
...Array.from("solana offchain", (character) => character.charCodeAt(0))
|
|
1076
|
+
);
|
|
1077
|
+
var SOLANA_PUBLIC_KEY_LENGTH = 32;
|
|
1078
|
+
var MAX_SOLANA_OFFCHAIN_SIGNERS = 255;
|
|
1079
|
+
function compareBytes(a, b) {
|
|
1080
|
+
for (let index = 0; index < a.length; index += 1) {
|
|
1081
|
+
const difference = (_nullishCoalesce(a[index], () => ( 0))) - (_nullishCoalesce(b[index], () => ( 0)));
|
|
1082
|
+
if (difference !== 0) return difference;
|
|
1083
|
+
}
|
|
1084
|
+
return a.length - b.length;
|
|
1085
|
+
}
|
|
1086
|
+
function bytesEqual(a, b) {
|
|
1087
|
+
return a.length === b.length && a.every((value, index) => value === b[index]);
|
|
1088
|
+
}
|
|
1089
|
+
function decodeUtf8Strict(bytes) {
|
|
1090
|
+
return decodeURIComponent(
|
|
1091
|
+
Array.from(bytes, (value) => `%${value.toString(16).padStart(2, "0")}`).join("")
|
|
1092
|
+
);
|
|
1093
|
+
}
|
|
1094
|
+
function prepareSolanaOffchainMessageV1({
|
|
1095
|
+
message,
|
|
1096
|
+
requiredSigners
|
|
1097
|
+
}) {
|
|
1098
|
+
if (message.length === 0) {
|
|
1099
|
+
throw new Error("Solana off-chain message cannot be empty");
|
|
1100
|
+
}
|
|
1101
|
+
if (requiredSigners.length === 0 || requiredSigners.length > MAX_SOLANA_OFFCHAIN_SIGNERS) {
|
|
1102
|
+
throw new Error("Solana off-chain message requires between 1 and 255 signers");
|
|
1103
|
+
}
|
|
1104
|
+
let messageText;
|
|
1105
|
+
try {
|
|
1106
|
+
messageText = decodeUtf8Strict(message);
|
|
1107
|
+
} catch (e3) {
|
|
1108
|
+
throw new Error("Solana off-chain message must contain valid UTF-8");
|
|
1109
|
+
}
|
|
1110
|
+
const signerBytes = requiredSigners.map((signer, index) => {
|
|
1111
|
+
let bytes;
|
|
1112
|
+
try {
|
|
1113
|
+
bytes = hexToBytes(signer);
|
|
1114
|
+
} catch (e4) {
|
|
1115
|
+
throw new Error(`Solana off-chain signer ${index} must be a hex public key`);
|
|
1116
|
+
}
|
|
1117
|
+
if (bytes.length !== SOLANA_PUBLIC_KEY_LENGTH) {
|
|
1118
|
+
throw new Error(`Solana off-chain signer ${index} must be 32 bytes`);
|
|
1119
|
+
}
|
|
1120
|
+
return bytes;
|
|
1121
|
+
});
|
|
1122
|
+
signerBytes.sort(compareBytes);
|
|
1123
|
+
if (signerBytes.some((bytes, index) => index > 0 && bytesEqual(signerBytes[index - 1], bytes))) {
|
|
1124
|
+
throw new Error("Solana off-chain signers must be unique");
|
|
1125
|
+
}
|
|
1126
|
+
const signersOffset = SOLANA_OFFCHAIN_SIGNING_DOMAIN.length + 2;
|
|
1127
|
+
const messageOffset = signersOffset + signerBytes.length * SOLANA_PUBLIC_KEY_LENGTH;
|
|
1128
|
+
const serializedMessage = new Uint8Array(messageOffset + message.length);
|
|
1129
|
+
serializedMessage.set(SOLANA_OFFCHAIN_SIGNING_DOMAIN);
|
|
1130
|
+
serializedMessage.set([1, signerBytes.length], SOLANA_OFFCHAIN_SIGNING_DOMAIN.length);
|
|
1131
|
+
signerBytes.forEach(
|
|
1132
|
+
(signer, index) => serializedMessage.set(signer, signersOffset + index * SOLANA_PUBLIC_KEY_LENGTH)
|
|
1133
|
+
);
|
|
1134
|
+
serializedMessage.set(message, messageOffset);
|
|
1135
|
+
return {
|
|
1136
|
+
messageText,
|
|
1137
|
+
requiredSigners: signerBytes.map(bytesToHex3),
|
|
1138
|
+
serializedMessage
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
// src/utils/logSummary.ts
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
var MAX_DEPTH = 6;
|
|
1146
|
+
var MAX_ARRAY_ITEMS = 20;
|
|
1147
|
+
var MAX_PLAIN_STRING = 64;
|
|
1148
|
+
var MAX_ERROR_STRING = 500;
|
|
1149
|
+
var normalizeKey = (key) => key.replace(/[_-]/g, "").toLowerCase();
|
|
1150
|
+
var keySet = (keys) => new Set(keys.map(normalizeKey));
|
|
1151
|
+
var KEEP_KEYS = keySet([
|
|
1152
|
+
"path",
|
|
1153
|
+
"paths",
|
|
1154
|
+
"derivationPath",
|
|
1155
|
+
"fullPath",
|
|
1156
|
+
"basePath",
|
|
1157
|
+
"method",
|
|
1158
|
+
"methodName",
|
|
1159
|
+
"chainId",
|
|
1160
|
+
"coin",
|
|
1161
|
+
"network",
|
|
1162
|
+
"networkName",
|
|
1163
|
+
"scriptType",
|
|
1164
|
+
"template",
|
|
1165
|
+
"appName",
|
|
1166
|
+
"_tag",
|
|
1167
|
+
"code",
|
|
1168
|
+
"errorCode",
|
|
1169
|
+
"statusCode"
|
|
1170
|
+
]);
|
|
1171
|
+
var ERROR_TEXT_KEYS = keySet(["message", "error", "errorMessage", "originalMessage"]);
|
|
1172
|
+
var ERROR_CONTEXT_KEYS = keySet(["error", "err", "originalError", "cause"]);
|
|
1173
|
+
var SECRET_KEYS = keySet([
|
|
1174
|
+
"ufvk",
|
|
1175
|
+
"orchardFvk",
|
|
1176
|
+
"fvk",
|
|
1177
|
+
"viewingKey",
|
|
1178
|
+
"passphraseState",
|
|
1179
|
+
"passphrase",
|
|
1180
|
+
"password",
|
|
1181
|
+
"pin",
|
|
1182
|
+
"mnemonic",
|
|
1183
|
+
"mnemonics",
|
|
1184
|
+
"word",
|
|
1185
|
+
"words",
|
|
1186
|
+
"seed",
|
|
1187
|
+
"entropy",
|
|
1188
|
+
"privateKey",
|
|
1189
|
+
"xprv",
|
|
1190
|
+
"mac",
|
|
1191
|
+
// THP pairing and channel material.
|
|
1192
|
+
"credential",
|
|
1193
|
+
"credentials",
|
|
1194
|
+
"hostStaticKey",
|
|
1195
|
+
"trezorStaticPublicKey",
|
|
1196
|
+
// Wallet sessions and host connection records.
|
|
1197
|
+
"session",
|
|
1198
|
+
"sessionId",
|
|
1199
|
+
"knownConnections",
|
|
1200
|
+
"extra"
|
|
1201
|
+
]);
|
|
1202
|
+
var KEY_MATERIAL_KEYS = keySet([
|
|
1203
|
+
"xpub",
|
|
1204
|
+
"ypub",
|
|
1205
|
+
"zpub",
|
|
1206
|
+
"tpub",
|
|
1207
|
+
"extendedPublicKey",
|
|
1208
|
+
"publicKey",
|
|
1209
|
+
"pubkey",
|
|
1210
|
+
"pub",
|
|
1211
|
+
"chainCode",
|
|
1212
|
+
"tapInternalKey"
|
|
1213
|
+
]);
|
|
1214
|
+
var SIGNATURE_KEYS = keySet(["signature", "signatures", "sig", "r", "s", "v", "partialSig"]);
|
|
1215
|
+
var SIGNED_TX_KEYS = keySet(["signedTx", "signedTransaction", "signedTxHex"]);
|
|
1216
|
+
var SIGNED_PSBT_KEYS = keySet(["signedPsbt"]);
|
|
1217
|
+
var PAYLOAD_KEYS = keySet([
|
|
1218
|
+
"serializedTx",
|
|
1219
|
+
"rawTx",
|
|
1220
|
+
"rawTxHex",
|
|
1221
|
+
"txHex",
|
|
1222
|
+
"tx",
|
|
1223
|
+
"transaction",
|
|
1224
|
+
"psbt",
|
|
1225
|
+
"message",
|
|
1226
|
+
"messageHex",
|
|
1227
|
+
"data",
|
|
1228
|
+
"dataJson",
|
|
1229
|
+
"typedData",
|
|
1230
|
+
"hex",
|
|
1231
|
+
"bytes",
|
|
1232
|
+
"apdu",
|
|
1233
|
+
"domainSeparatorHash",
|
|
1234
|
+
"messageHash",
|
|
1235
|
+
"encodedNetwork",
|
|
1236
|
+
"encodedToken",
|
|
1237
|
+
"refBlockBytes",
|
|
1238
|
+
"refBlockHash",
|
|
1239
|
+
"opReturnData",
|
|
1240
|
+
"scriptSig",
|
|
1241
|
+
"witness",
|
|
1242
|
+
"extraData",
|
|
1243
|
+
// Structured transaction contents (Trezor-style and Tron params).
|
|
1244
|
+
"contract",
|
|
1245
|
+
"inputs",
|
|
1246
|
+
"outputs",
|
|
1247
|
+
"refTxs",
|
|
1248
|
+
"paymentRequest",
|
|
1249
|
+
"paymentRequests",
|
|
1250
|
+
"additionalInfo",
|
|
1251
|
+
"accessList",
|
|
1252
|
+
"memos"
|
|
1253
|
+
]);
|
|
1254
|
+
var ADDRESS_KEYS = keySet([
|
|
1255
|
+
"to",
|
|
1256
|
+
"from",
|
|
1257
|
+
"recipient",
|
|
1258
|
+
"verifyingContract",
|
|
1259
|
+
"requiredSigners",
|
|
1260
|
+
"tokenMint",
|
|
1261
|
+
"tokenAccount",
|
|
1262
|
+
"tokenProgram"
|
|
1263
|
+
]);
|
|
1264
|
+
var TX_IN_RESULT_KEYS = keySet(["serializedTx", "rawTx", "rawTxHex", "txHex", "tx"]);
|
|
1265
|
+
var AMOUNT_KEYS = keySet(["value", "amount", "amounts", "fee", "fees", "tokenAmount"]);
|
|
1266
|
+
var ERROR_FIELDS = ["_tag", "code", "errorCode", "statusCode", "originalError"];
|
|
1267
|
+
var XPUB_RE = /^[a-zA-Z]pub[1-9A-HJ-NP-Za-km-z]{90,}$/;
|
|
1268
|
+
var HEX_RE = /^(0x)?[0-9a-fA-F]*$/;
|
|
1269
|
+
var EVM_TX_TYPES = {
|
|
1270
|
+
1: "eip2930",
|
|
1271
|
+
2: "eip1559",
|
|
1272
|
+
3: "eip4844",
|
|
1273
|
+
4: "eip7702"
|
|
1274
|
+
};
|
|
1275
|
+
function sha256Short(input) {
|
|
1276
|
+
return _utils.bytesToHex.call(void 0, _sha256.sha256.call(void 0, typeof input === "string" ? _utils.utf8ToBytes.call(void 0, input) : input)).slice(0, 16);
|
|
1277
|
+
}
|
|
1278
|
+
function toBytes(value) {
|
|
1279
|
+
if (value instanceof Uint8Array) return value;
|
|
1280
|
+
if (value instanceof ArrayBuffer) return new Uint8Array(value);
|
|
1281
|
+
if (ArrayBuffer.isView(value)) {
|
|
1282
|
+
return new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
1283
|
+
}
|
|
1284
|
+
if (value && typeof value === "object" && value.type === "Buffer" && Array.isArray(value.data)) {
|
|
1285
|
+
return Uint8Array.from(value.data);
|
|
1286
|
+
}
|
|
1287
|
+
return void 0;
|
|
1288
|
+
}
|
|
1289
|
+
function isPlainHex(value) {
|
|
1290
|
+
return value.length > 0 && HEX_RE.test(value) && value !== "0x";
|
|
1291
|
+
}
|
|
1292
|
+
function stripHexPrefix(value) {
|
|
1293
|
+
return value.startsWith("0x") || value.startsWith("0X") ? value.slice(2) : value;
|
|
1294
|
+
}
|
|
1295
|
+
function maskAddress(value) {
|
|
1296
|
+
if (value.length <= 12) return `<addr len=${value.length}>`;
|
|
1297
|
+
return `${value.slice(0, 6)}\u2026${value.slice(-4)}`;
|
|
1298
|
+
}
|
|
1299
|
+
function summarizeKeyMaterial(value) {
|
|
1300
|
+
const bytes = toBytes(value);
|
|
1301
|
+
if (bytes) return `\u2026 len=${bytes.length}`;
|
|
1302
|
+
const text = String(value);
|
|
1303
|
+
return XPUB_RE.test(text) ? `${text.slice(0, 4)}\u2026 len=${text.length}` : `\u2026 len=${text.length}`;
|
|
1304
|
+
}
|
|
1305
|
+
function lengthOf(value) {
|
|
1306
|
+
const bytes = toBytes(value);
|
|
1307
|
+
if (bytes) return bytes.length;
|
|
1308
|
+
if (typeof value === "string") return value.length;
|
|
1309
|
+
const json = safeJson(value);
|
|
1310
|
+
return json === void 0 ? 0 : json.length;
|
|
1311
|
+
}
|
|
1312
|
+
function safeJson(value) {
|
|
1313
|
+
try {
|
|
1314
|
+
return JSON.stringify(value, (_k, v) => typeof v === "bigint" ? `${v}n` : v);
|
|
1315
|
+
} catch (e5) {
|
|
1316
|
+
return void 0;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
function evmTxType(hex) {
|
|
1320
|
+
const body = stripHexPrefix(hex);
|
|
1321
|
+
if (body.length < 2) return void 0;
|
|
1322
|
+
const first = parseInt(body.slice(0, 2), 16);
|
|
1323
|
+
if (first >= 192) return "legacy";
|
|
1324
|
+
return EVM_TX_TYPES[first];
|
|
1325
|
+
}
|
|
1326
|
+
function describe(key, value, ctx) {
|
|
1327
|
+
if (!ctx.describePayload) return void 0;
|
|
1328
|
+
try {
|
|
1329
|
+
const hint = ctx.describePayload(key, value, { method: ctx.method, role: ctx.role });
|
|
1330
|
+
return typeof hint === "string" && hint.length > 0 ? hint : void 0;
|
|
1331
|
+
} catch (e6) {
|
|
1332
|
+
return void 0;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
function jsonSummary(json, parsed) {
|
|
1336
|
+
const primaryType = parsed && typeof parsed === "object" ? parsed.primaryType : void 0;
|
|
1337
|
+
const hint = typeof primaryType === "string" && primaryType.length <= MAX_PLAIN_STRING ? ` primaryType=${primaryType}` : "";
|
|
1338
|
+
return `<json len=${json.length} sha256=${sha256Short(json)}${hint}>`;
|
|
1339
|
+
}
|
|
1340
|
+
function summarizePayload(key, value, ctx) {
|
|
1341
|
+
if (value === null || value === void 0 || typeof value === "boolean") return value;
|
|
1342
|
+
if (typeof value === "number") return value;
|
|
1343
|
+
const bytes = toBytes(value);
|
|
1344
|
+
if (bytes) {
|
|
1345
|
+
const hint = describe(key, bytes, ctx);
|
|
1346
|
+
return `<hex len=${bytes.length} sha256=${sha256Short(bytes)}${hint ? ` ${hint}` : ""}>`;
|
|
1347
|
+
}
|
|
1348
|
+
if (typeof value === "string") {
|
|
1349
|
+
const trimmed = value.trim();
|
|
1350
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
1351
|
+
try {
|
|
1352
|
+
return jsonSummary(value, JSON.parse(value));
|
|
1353
|
+
} catch (e7) {
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
const hints = [];
|
|
1357
|
+
if (key === "serializedtx" && ctx.method.startsWith("evm") && isPlainHex(value)) {
|
|
1358
|
+
const type = evmTxType(value);
|
|
1359
|
+
if (type) hints.push(`type=${type}`);
|
|
1360
|
+
}
|
|
1361
|
+
const extra = describe(key, value, ctx);
|
|
1362
|
+
if (extra) hints.push(extra);
|
|
1363
|
+
const kind = isPlainHex(value) ? "hex" : "str";
|
|
1364
|
+
const suffix = hints.length ? ` ${hints.join(" ")}` : "";
|
|
1365
|
+
return `<${kind} len=${value.length} sha256=${sha256Short(value)}${suffix}>`;
|
|
1366
|
+
}
|
|
1367
|
+
const json = safeJson(value);
|
|
1368
|
+
if (json === void 0) return "<object unhashable>";
|
|
1369
|
+
return jsonSummary(json, value);
|
|
1370
|
+
}
|
|
1371
|
+
function summarizeString(value, key, ctx) {
|
|
1372
|
+
if (key && KEEP_KEYS.has(key)) return value;
|
|
1373
|
+
if (key && ctx.inError && ERROR_TEXT_KEYS.has(key)) {
|
|
1374
|
+
return value.length > MAX_ERROR_STRING ? `${value.slice(0, MAX_ERROR_STRING)}\u2026` : value;
|
|
1375
|
+
}
|
|
1376
|
+
if (XPUB_RE.test(value)) return summarizeKeyMaterial(value);
|
|
1377
|
+
if (value.length <= MAX_PLAIN_STRING) return value;
|
|
1378
|
+
const kind = isPlainHex(value) ? "hex" : "str";
|
|
1379
|
+
return `<${kind} len=${value.length} sha256=${sha256Short(value)}>`;
|
|
1380
|
+
}
|
|
1381
|
+
function summarizeError(err, depth, ctx) {
|
|
1382
|
+
const e = err;
|
|
1383
|
+
const out = {
|
|
1384
|
+
name: err.name,
|
|
1385
|
+
message: summarizeString(err.message, "message", ctx)
|
|
1386
|
+
};
|
|
1387
|
+
for (const field of ERROR_FIELDS) {
|
|
1388
|
+
if (e[field] !== void 0) {
|
|
1389
|
+
out[field] = summarizeValue(e[field], normalizeKey(field), depth + 1, ctx);
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
return out;
|
|
1393
|
+
}
|
|
1394
|
+
function summarizeByKey(rawKey, value, depth, ctx) {
|
|
1395
|
+
const k = normalizeKey(rawKey);
|
|
1396
|
+
if (value === void 0 || value === null) return value;
|
|
1397
|
+
if (SECRET_KEYS.has(k)) return `<redacted len=${lengthOf(value)}>`;
|
|
1398
|
+
if (KEY_MATERIAL_KEYS.has(k)) {
|
|
1399
|
+
if (typeof value === "string" || toBytes(value)) return summarizeKeyMaterial(value);
|
|
1400
|
+
}
|
|
1401
|
+
if (SIGNATURE_KEYS.has(k)) {
|
|
1402
|
+
if (Array.isArray(value)) return `<signatures count=${value.length}>`;
|
|
1403
|
+
return `<signature len=${lengthOf(value)}>`;
|
|
1404
|
+
}
|
|
1405
|
+
if (SIGNED_PSBT_KEYS.has(k)) return `<psbt len=${lengthOf(value)}>`;
|
|
1406
|
+
if (SIGNED_TX_KEYS.has(k) || ctx.role === "result" && TX_IN_RESULT_KEYS.has(k)) {
|
|
1407
|
+
return `<signedTx len=${lengthOf(value)}>`;
|
|
1408
|
+
}
|
|
1409
|
+
if (AMOUNT_KEYS.has(k)) return "<amount>";
|
|
1410
|
+
if (ctx.inError && ERROR_TEXT_KEYS.has(k) && typeof value === "string") {
|
|
1411
|
+
return summarizeString(value, k, ctx);
|
|
1412
|
+
}
|
|
1413
|
+
if (PAYLOAD_KEYS.has(k)) return summarizePayload(k, value, ctx);
|
|
1414
|
+
if (ADDRESS_KEYS.has(k) || k.endsWith("address") || k.endsWith("addresses")) {
|
|
1415
|
+
if (typeof value === "string") return maskAddress(value);
|
|
1416
|
+
if (Array.isArray(value)) {
|
|
1417
|
+
return capArray(value, (item) => typeof item === "string" ? maskAddress(item) : "<addr>");
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
const inError = ERROR_CONTEXT_KEYS.has(k);
|
|
1421
|
+
const childCtx = inError === ctx.inError ? ctx : { ...ctx, inError };
|
|
1422
|
+
return summarizeValue(value, k, depth, childCtx);
|
|
1423
|
+
}
|
|
1424
|
+
function capArray(items, map) {
|
|
1425
|
+
const out = items.slice(0, MAX_ARRAY_ITEMS).map(map);
|
|
1426
|
+
if (items.length > MAX_ARRAY_ITEMS) out.push(`\u2026+${items.length - MAX_ARRAY_ITEMS} more`);
|
|
1427
|
+
return out;
|
|
1428
|
+
}
|
|
1429
|
+
function summarizeValue(value, key, depth, ctx) {
|
|
1430
|
+
switch (typeof value) {
|
|
1431
|
+
case "undefined":
|
|
1432
|
+
case "boolean":
|
|
1433
|
+
return value;
|
|
1434
|
+
case "number":
|
|
1435
|
+
return Number.isFinite(value) ? value : String(value);
|
|
1436
|
+
case "bigint":
|
|
1437
|
+
return `${value}n`;
|
|
1438
|
+
case "string":
|
|
1439
|
+
return summarizeString(value, key, ctx);
|
|
1440
|
+
case "function":
|
|
1441
|
+
return "<function>";
|
|
1442
|
+
case "symbol":
|
|
1443
|
+
return "<symbol>";
|
|
1444
|
+
default:
|
|
1445
|
+
break;
|
|
1446
|
+
}
|
|
1447
|
+
if (value === null) return null;
|
|
1448
|
+
const bytes = toBytes(value);
|
|
1449
|
+
if (bytes) return `<hex len=${bytes.length} sha256=${sha256Short(bytes)}>`;
|
|
1450
|
+
const obj = value;
|
|
1451
|
+
if (ctx.ancestors.has(obj)) return "<circular>";
|
|
1452
|
+
if (depth >= MAX_DEPTH) return "<depth>";
|
|
1453
|
+
ctx.ancestors.add(obj);
|
|
1454
|
+
try {
|
|
1455
|
+
if (value instanceof Error) return summarizeError(value, depth, { ...ctx, inError: true });
|
|
1456
|
+
if (Array.isArray(value)) {
|
|
1457
|
+
return capArray(value, (item) => summarizeValue(item, key, depth + 1, ctx));
|
|
1458
|
+
}
|
|
1459
|
+
const out = {};
|
|
1460
|
+
for (const [childKey, child] of Object.entries(value)) {
|
|
1461
|
+
out[childKey] = summarizeByKey(childKey, child, depth + 1, ctx);
|
|
1462
|
+
}
|
|
1463
|
+
return out;
|
|
1464
|
+
} finally {
|
|
1465
|
+
ctx.ancestors.delete(obj);
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
function summarizeForLog(value, options = {}) {
|
|
1469
|
+
try {
|
|
1470
|
+
return summarizeValue(value, void 0, 0, {
|
|
1471
|
+
method: _nullishCoalesce(options.method, () => ( "")),
|
|
1472
|
+
role: _nullishCoalesce(options.role, () => ( "params")),
|
|
1473
|
+
describePayload: options.describePayload,
|
|
1474
|
+
inError: false,
|
|
1475
|
+
ancestors: /* @__PURE__ */ new Set()
|
|
1476
|
+
});
|
|
1477
|
+
} catch (e8) {
|
|
1478
|
+
return "<unloggable>";
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
|
|
571
1482
|
// src/utils/deviceIdentity.ts
|
|
572
1483
|
var ONEKEY_BLE_SERVICE_UUID = "00000001-0000-1000-8000-00805f9b34fb";
|
|
573
1484
|
var TREZOR_BLE_SERVICE_UUID = "8c000001-a59b-4d58-a9ad-073df69fa1b1";
|
|
574
1485
|
var LEDGER_USB_VENDOR_ID = 11415;
|
|
575
|
-
var
|
|
1486
|
+
var KEYSTONE_USB_VENDOR_ID = 4617;
|
|
1487
|
+
var KEYSTONE_USB_PRODUCT_ID = 12289;
|
|
1488
|
+
var lower = (value) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _46 => _46.trim, 'call', _47 => _47(), 'access', _48 => _48.toLowerCase, 'call', _49 => _49()]), () => ( ""));
|
|
576
1489
|
var hasServiceUuid = (input, uuid) => {
|
|
577
1490
|
const expected = uuid.toLowerCase();
|
|
578
1491
|
const values = [
|
|
@@ -594,6 +1507,11 @@ function detectHardwareVendorFromDescriptor(input) {
|
|
|
594
1507
|
if (typeof input.vendor === "number" && input.vendor === LEDGER_USB_VENDOR_ID || input.vendorId === LEDGER_USB_VENDOR_ID || manufacturerName.includes("ledger")) {
|
|
595
1508
|
return "ledger";
|
|
596
1509
|
}
|
|
1510
|
+
const usbVendorId = typeof input.vendor === "number" ? input.vendor : input.vendorId;
|
|
1511
|
+
const usbProductId = typeof input.product === "number" ? input.product : input.productId;
|
|
1512
|
+
if (usbVendorId === KEYSTONE_USB_VENDOR_ID && usbProductId === KEYSTONE_USB_PRODUCT_ID || manufacturerName.includes("keystone")) {
|
|
1513
|
+
return "keystone";
|
|
1514
|
+
}
|
|
597
1515
|
return void 0;
|
|
598
1516
|
}
|
|
599
1517
|
function isKnownNonTargetHardwareVendor(input, targetVendor) {
|
|
@@ -610,35 +1528,69 @@ async function batchCall(params, callFn, onProgress) {
|
|
|
610
1528
|
return result;
|
|
611
1529
|
}
|
|
612
1530
|
results.push(result.payload);
|
|
613
|
-
_optionalChain([onProgress, 'optionalCall',
|
|
1531
|
+
_optionalChain([onProgress, 'optionalCall', _50 => _50({ index: i, total: params.length })]);
|
|
614
1532
|
}
|
|
615
1533
|
return { success: true, payload: results };
|
|
616
1534
|
}
|
|
617
1535
|
|
|
618
1536
|
// src/utils/methodCatalog.ts
|
|
619
1537
|
var HARDWARE_METHOD_CATALOG = {
|
|
620
|
-
evmGetAddress: { chain: "evm", allNetwork: true },
|
|
621
|
-
evmSignTransaction: {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
1538
|
+
evmGetAddress: { chain: "evm", allNetwork: true, replayAfterTransportFailure: "safe" },
|
|
1539
|
+
evmSignTransaction: {
|
|
1540
|
+
chain: "evm",
|
|
1541
|
+
allNetwork: false,
|
|
1542
|
+
replayAfterTransportFailure: "unsafe"
|
|
1543
|
+
},
|
|
1544
|
+
evmSignMessage: { chain: "evm", allNetwork: false, replayAfterTransportFailure: "unsafe" },
|
|
1545
|
+
evmSignTypedData: { chain: "evm", allNetwork: false, replayAfterTransportFailure: "unsafe" },
|
|
1546
|
+
btcGetAddress: { chain: "btc", allNetwork: true, replayAfterTransportFailure: "safe" },
|
|
1547
|
+
btcGetPublicKey: { chain: "btc", allNetwork: true, replayAfterTransportFailure: "safe" },
|
|
1548
|
+
btcSignTransaction: {
|
|
1549
|
+
chain: "btc",
|
|
1550
|
+
allNetwork: false,
|
|
1551
|
+
replayAfterTransportFailure: "unsafe"
|
|
1552
|
+
},
|
|
1553
|
+
btcSignPsbt: { chain: "btc", allNetwork: false, replayAfterTransportFailure: "unsafe" },
|
|
1554
|
+
btcSignMessage: { chain: "btc", allNetwork: false, replayAfterTransportFailure: "unsafe" },
|
|
1555
|
+
btcGetMasterFingerprint: {
|
|
1556
|
+
chain: "btc",
|
|
1557
|
+
allNetwork: false,
|
|
1558
|
+
replayAfterTransportFailure: "safe"
|
|
1559
|
+
},
|
|
1560
|
+
solGetAddress: { chain: "sol", allNetwork: true, replayAfterTransportFailure: "safe" },
|
|
1561
|
+
solSignTransaction: {
|
|
1562
|
+
chain: "sol",
|
|
1563
|
+
allNetwork: false,
|
|
1564
|
+
replayAfterTransportFailure: "unsafe"
|
|
1565
|
+
},
|
|
1566
|
+
solSignMessage: { chain: "sol", allNetwork: false, replayAfterTransportFailure: "unsafe" },
|
|
1567
|
+
tronGetAddress: { chain: "tron", allNetwork: true, replayAfterTransportFailure: "safe" },
|
|
1568
|
+
tronSignTransaction: {
|
|
1569
|
+
chain: "tron",
|
|
1570
|
+
allNetwork: false,
|
|
1571
|
+
replayAfterTransportFailure: "unsafe"
|
|
1572
|
+
},
|
|
1573
|
+
tronSignMessage: { chain: "tron", allNetwork: false, replayAfterTransportFailure: "unsafe" },
|
|
1574
|
+
zcashGetFullViewingKey: {
|
|
1575
|
+
chain: "zcash",
|
|
1576
|
+
allNetwork: false,
|
|
1577
|
+
replayAfterTransportFailure: "safe"
|
|
1578
|
+
},
|
|
1579
|
+
zcashGetShieldedAddress: {
|
|
1580
|
+
chain: "zcash",
|
|
1581
|
+
allNetwork: false,
|
|
1582
|
+
replayAfterTransportFailure: "safe"
|
|
1583
|
+
}
|
|
636
1584
|
};
|
|
637
1585
|
var ALL_NETWORK_METHOD_NAMES = Object.entries(HARDWARE_METHOD_CATALOG).filter(([, metadata]) => metadata.allNetwork).map(([method]) => method);
|
|
638
1586
|
var ALL_NETWORK_METHOD_SET = new Set(ALL_NETWORK_METHOD_NAMES);
|
|
639
1587
|
function getHardwareMethodMetadata(method) {
|
|
640
1588
|
return HARDWARE_METHOD_CATALOG[method];
|
|
641
1589
|
}
|
|
1590
|
+
var SAFE_NON_CHAIN_METHODS = /* @__PURE__ */ new Set(["getFeatures", "authenticateDevice"]);
|
|
1591
|
+
function canReplayHardwareMethodAfterTransportFailure(method) {
|
|
1592
|
+
return _optionalChain([getHardwareMethodMetadata, 'call', _51 => _51(method), 'optionalAccess', _52 => _52.replayAfterTransportFailure]) === "safe" || SAFE_NON_CHAIN_METHODS.has(method);
|
|
1593
|
+
}
|
|
642
1594
|
function isAllNetworkMethodName(method) {
|
|
643
1595
|
return ALL_NETWORK_METHOD_SET.has(method);
|
|
644
1596
|
}
|
|
@@ -666,7 +1618,7 @@ async function runAllNetworkGetAddress({
|
|
|
666
1618
|
continue;
|
|
667
1619
|
}
|
|
668
1620
|
const method = item.methodName;
|
|
669
|
-
const unsupportedNetwork = _optionalChain([buildUnsupportedNetworkResponse, 'optionalCall',
|
|
1621
|
+
const unsupportedNetwork = _optionalChain([buildUnsupportedNetworkResponse, 'optionalCall', _53 => _53(item, method)]);
|
|
670
1622
|
if (unsupportedNetwork) {
|
|
671
1623
|
responses.push(unsupportedNetwork);
|
|
672
1624
|
continue;
|
|
@@ -698,6 +1650,38 @@ async function runAllNetworkGetAddress({
|
|
|
698
1650
|
}
|
|
699
1651
|
return success(responses);
|
|
700
1652
|
}
|
|
1653
|
+
function isUserRefusal(code) {
|
|
1654
|
+
return code === 10005 /* UserAborted */ || code === 10001 /* UserRejected */ || code === 10401 /* PinCancelled */;
|
|
1655
|
+
}
|
|
1656
|
+
function isWalletSafetyFailure(code) {
|
|
1657
|
+
const codes = [
|
|
1658
|
+
10106 /* DeviceMismatch */,
|
|
1659
|
+
10114 /* DeviceSearchMismatch */,
|
|
1660
|
+
10103 /* DeviceLocked */,
|
|
1661
|
+
10400 /* PinInvalid */,
|
|
1662
|
+
10404 /* PinMismatch */,
|
|
1663
|
+
10402 /* PassphraseRejected */,
|
|
1664
|
+
10403 /* PassphraseStateMismatch */,
|
|
1665
|
+
10405 /* PassphraseAlwaysOnDevice */
|
|
1666
|
+
];
|
|
1667
|
+
return code !== void 0 && codes.includes(code);
|
|
1668
|
+
}
|
|
1669
|
+
function isConnectionLost(code) {
|
|
1670
|
+
const codes = [
|
|
1671
|
+
10101 /* DeviceDisconnected */,
|
|
1672
|
+
10003 /* OperationTimeout */,
|
|
1673
|
+
10300 /* TransportError */,
|
|
1674
|
+
10113 /* OperationEnded */,
|
|
1675
|
+
10112 /* OperationNotFound */
|
|
1676
|
+
];
|
|
1677
|
+
return code !== void 0 && codes.includes(code);
|
|
1678
|
+
}
|
|
1679
|
+
function buildAllNetworkCancelledFailure(signal) {
|
|
1680
|
+
const reason = signal.reason;
|
|
1681
|
+
const code = typeof _optionalChain([reason, 'optionalAccess', _54 => _54.code]) === "number" ? reason.code : 10005 /* UserAborted */;
|
|
1682
|
+
const message = typeof _optionalChain([reason, 'optionalAccess', _55 => _55.message]) === "string" ? reason.message : "";
|
|
1683
|
+
return failure(code, message || "All-network get-address cancelled");
|
|
1684
|
+
}
|
|
701
1685
|
function buildUnsupportedMethodResponse(item) {
|
|
702
1686
|
return {
|
|
703
1687
|
...item,
|
|
@@ -766,5 +1750,37 @@ var DEVICE_CONNECT_RETRY_DELAY_MS = 1e3;
|
|
|
766
1750
|
|
|
767
1751
|
|
|
768
1752
|
|
|
769
|
-
|
|
1753
|
+
|
|
1754
|
+
|
|
1755
|
+
|
|
1756
|
+
|
|
1757
|
+
|
|
1758
|
+
|
|
1759
|
+
|
|
1760
|
+
|
|
1761
|
+
|
|
1762
|
+
|
|
1763
|
+
|
|
1764
|
+
|
|
1765
|
+
|
|
1766
|
+
|
|
1767
|
+
|
|
1768
|
+
|
|
1769
|
+
|
|
1770
|
+
|
|
1771
|
+
|
|
1772
|
+
|
|
1773
|
+
|
|
1774
|
+
|
|
1775
|
+
|
|
1776
|
+
|
|
1777
|
+
|
|
1778
|
+
|
|
1779
|
+
|
|
1780
|
+
|
|
1781
|
+
|
|
1782
|
+
|
|
1783
|
+
|
|
1784
|
+
|
|
1785
|
+
exports.ALL_NETWORK_METHOD_NAMES = ALL_NETWORK_METHOD_NAMES; exports.CHAIN_FINGERPRINT_PATHS = CHAIN_FINGERPRINT_PATHS; exports.DEVICE = DEVICE; exports.DEVICE_CONNECT_RETRY_DELAY_MS = DEVICE_CONNECT_RETRY_DELAY_MS; exports.DEVICE_EVENT = DEVICE_EVENT; exports.DeviceJobQueue = DeviceJobQueue; exports.EConnectorInteraction = EConnectorInteraction; exports.HARDWARE_METHOD_CATALOG = HARDWARE_METHOD_CATALOG; exports.HARDWARE_RUNTIME_ID_PREFIX = HARDWARE_RUNTIME_ID_PREFIX; exports.HardwareErrorCode = _chunkUFNTICCXjs.HardwareErrorCode; exports.MISSING_BIP32_MASTER_FINGERPRINT = MISSING_BIP32_MASTER_FINGERPRINT; exports.OPERATION_DEFAULT_TTL_MS = OPERATION_DEFAULT_TTL_MS; exports.ORPHAN_ELIGIBLE_ERROR_CODES = _chunkUFNTICCXjs.ORPHAN_ELIGIBLE_ERROR_CODES; exports.OperationRegistry = OperationRegistry; exports.SDK = SDK; exports.TypedEventEmitter = TypedEventEmitter; exports.UI_EVENT = _chunkPY5FNLTSjs.UI_EVENT; exports.UI_REQUEST = _chunkPY5FNLTSjs.UI_REQUEST; exports.UI_REQUEST_CANCELLED_TAG = _chunkPY5FNLTSjs.UI_REQUEST_CANCELLED_TAG; exports.UI_REQUEST_DEFAULT_TIMEOUT_MS = _chunkPY5FNLTSjs.UI_REQUEST_DEFAULT_TIMEOUT_MS; exports.UI_REQUEST_PREEMPTED_TAG = _chunkPY5FNLTSjs.UI_REQUEST_PREEMPTED_TAG; exports.UI_REQUEST_TIMEOUT_TAG = _chunkPY5FNLTSjs.UI_REQUEST_TIMEOUT_TAG; exports.UI_RESPONSE = _chunkPY5FNLTSjs.UI_RESPONSE; exports.UiRequestRegistry = _chunkPY5FNLTSjs.UiRequestRegistry; exports.assertBoundedCbor = assertBoundedCbor; exports.batchCall = batchCall; exports.boundedCborFromHex = boundedCborFromHex; exports.buildAllNetworkCancelledFailure = buildAllNetworkCancelledFailure; exports.buildUnsupportedMethodResponse = buildUnsupportedMethodResponse; exports.bytesToHex = bytesToHex3; exports.canReplayHardwareMethodAfterTransportFailure = canReplayHardwareMethodAfterTransportFailure; exports.compareSemver = compareSemver; exports.createBridgedConnector = createBridgedConnector; exports.createCombinedConnector = createCombinedConnector; exports.createHardwareLinkId = createHardwareLinkId; exports.createHardwareOperationId = createHardwareOperationId; exports.createHardwareSearchTargetId = createHardwareSearchTargetId; exports.createHwkError = _chunkUFNTICCXjs.createHwkError; exports.defaultOriginForCode = _chunkUFNTICCXjs.defaultOriginForCode; exports.defaultRecoveryForCode = _chunkUFNTICCXjs.defaultRecoveryForCode; exports.deriveDeviceFingerprint = deriveDeviceFingerprint; exports.detectHardwareVendorFromDescriptor = detectHardwareVendorFromDescriptor; exports.emitDeviceBindingStatus = emitDeviceBindingStatus; exports.enrichErrorMessage = _chunkYLCHSNXOjs.enrichErrorMessage; exports.ensure0x = ensure0x; exports.failure = failure; exports.getAllNetworkMethodChain = getAllNetworkMethodChain; exports.getHardwareMethodMetadata = getHardwareMethodMetadata; exports.hasHardwareRuntimeIdPrefix = hasHardwareRuntimeIdPrefix; exports.hexToBytes = hexToBytes; exports.isAllNetworkMethodName = isAllNetworkMethodName; exports.isConnectionLost = isConnectionLost; exports.isHardwareOperationId = isHardwareOperationId; exports.isHwkRecoveryHint = _chunkUFNTICCXjs.isHwkRecoveryHint; exports.isKnownNonTargetHardwareVendor = isKnownNonTargetHardwareVendor; exports.isUserRefusal = isUserRefusal; exports.isWalletSafetyFailure = isWalletSafetyFailure; exports.operationMayHaveCompletedParams = _chunkUFNTICCXjs.operationMayHaveCompletedParams; exports.padHex64 = padHex64; exports.parseBip32MasterFingerprint = parseBip32MasterFingerprint; exports.parseHardwareRuntimeId = parseHardwareRuntimeId; exports.parseWalletMasterFingerprint = parseWalletMasterFingerprint; exports.pickConnectionContext = pickConnectionContext; exports.prepareSolanaOffchainMessageV1 = prepareSolanaOffchainMessageV1; exports.rehydrateConnectorError = rehydrateConnectorError; exports.requestBleDeviceSelection = requestBleDeviceSelection; exports.requestSaveDeviceBinding = requestSaveDeviceBinding; exports.resolveHardwareOperationTarget = resolveHardwareOperationTarget; exports.resolveSearchTargetReusePolicy = resolveSearchTargetReusePolicy; exports.runAllNetworkGetAddress = runAllNetworkGetAddress; exports.serializeConnectorError = serializeConnectorError; exports.stripHex = stripHex; exports.success = success; exports.summarizeForLog = summarizeForLog; exports.toPhysicalDeviceSearchTarget = toPhysicalDeviceSearchTarget;
|
|
770
1786
|
//# sourceMappingURL=index.js.map
|