@ledgerhq/live-cli 24.28.0-nightly.20251118023800 → 24.28.0-nightly.20251119110540
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/lib/cli.js +160 -157
- package/package.json +2 -2
package/lib/cli.js
CHANGED
|
@@ -34238,9 +34238,9 @@ var init_Transport = __esm({
|
|
|
34238
34238
|
* @returns {Promise<Buffer>} A promise that resolves with the response data from the device.
|
|
34239
34239
|
*/
|
|
34240
34240
|
send = async (cla, ins, p1, p210, data6 = Buffer.alloc(0), statusList = [StatusCodes.OK], { abortTimeoutMs } = {}) => {
|
|
34241
|
-
const
|
|
34241
|
+
const tracer2 = this.tracer.withUpdatedContext({ function: "send" });
|
|
34242
34242
|
if (data6.length >= 256) {
|
|
34243
|
-
|
|
34243
|
+
tracer2.trace("data.length exceeded 256 bytes limit", { dataLength: data6.length });
|
|
34244
34244
|
throw new TransportError("data.length exceed 256 bytes limit. Got: " + data6.length, "DataLengthTooBig");
|
|
34245
34245
|
}
|
|
34246
34246
|
const response = await this.exchange(
|
|
@@ -34303,12 +34303,12 @@ var init_Transport = __esm({
|
|
|
34303
34303
|
* @returns a Promise resolving with the output of the given job
|
|
34304
34304
|
*/
|
|
34305
34305
|
async exchangeAtomicImpl(f52) {
|
|
34306
|
-
const
|
|
34306
|
+
const tracer2 = this.tracer.withUpdatedContext({
|
|
34307
34307
|
function: "exchangeAtomicImpl",
|
|
34308
34308
|
unresponsiveTimeout: this.unresponsiveTimeout
|
|
34309
34309
|
});
|
|
34310
34310
|
if (this.exchangeBusyPromise) {
|
|
34311
|
-
|
|
34311
|
+
tracer2.trace("Atomic exchange is already busy");
|
|
34312
34312
|
throw new TransportRaceCondition("An action was already pending on the Ledger device. Please deny or reconnect.");
|
|
34313
34313
|
}
|
|
34314
34314
|
let resolveBusy;
|
|
@@ -34318,7 +34318,7 @@ var init_Transport = __esm({
|
|
|
34318
34318
|
this.exchangeBusyPromise = busyPromise;
|
|
34319
34319
|
let unresponsiveReached = false;
|
|
34320
34320
|
const timeout10 = setTimeout(() => {
|
|
34321
|
-
|
|
34321
|
+
tracer2.trace(`Timeout reached, emitting Transport event "unresponsive"`, {
|
|
34322
34322
|
unresponsiveTimeout: this.unresponsiveTimeout
|
|
34323
34323
|
});
|
|
34324
34324
|
unresponsiveReached = true;
|
|
@@ -34327,12 +34327,12 @@ var init_Transport = __esm({
|
|
|
34327
34327
|
try {
|
|
34328
34328
|
const res = await f52();
|
|
34329
34329
|
if (unresponsiveReached) {
|
|
34330
|
-
|
|
34330
|
+
tracer2.trace("Device was unresponsive, emitting responsive");
|
|
34331
34331
|
this.emit("responsive");
|
|
34332
34332
|
}
|
|
34333
34333
|
return res;
|
|
34334
34334
|
} finally {
|
|
34335
|
-
|
|
34335
|
+
tracer2.trace("Finalize, clearing busy guard");
|
|
34336
34336
|
clearTimeout(timeout10);
|
|
34337
34337
|
if (resolveBusy)
|
|
34338
34338
|
resolveBusy();
|
|
@@ -310189,14 +310189,14 @@ var require_logging = __commonJS({
|
|
|
310189
310189
|
}
|
|
310190
310190
|
}
|
|
310191
310191
|
var allEnabled = enabledTracers.has("all");
|
|
310192
|
-
function trace3(severity,
|
|
310193
|
-
if (isTracerEnabled(
|
|
310194
|
-
exports2.log(severity, (/* @__PURE__ */ new Date()).toISOString() + " | " +
|
|
310192
|
+
function trace3(severity, tracer2, text) {
|
|
310193
|
+
if (isTracerEnabled(tracer2)) {
|
|
310194
|
+
exports2.log(severity, (/* @__PURE__ */ new Date()).toISOString() + " | " + tracer2 + " | " + text);
|
|
310195
310195
|
}
|
|
310196
310196
|
}
|
|
310197
310197
|
exports2.trace = trace3;
|
|
310198
|
-
function isTracerEnabled(
|
|
310199
|
-
return !disabledTracers.has(
|
|
310198
|
+
function isTracerEnabled(tracer2) {
|
|
310199
|
+
return !disabledTracers.has(tracer2) && (allEnabled || enabledTracers.has(tracer2));
|
|
310200
310200
|
}
|
|
310201
310201
|
exports2.isTracerEnabled = isTracerEnabled;
|
|
310202
310202
|
}
|
|
@@ -500833,13 +500833,13 @@ var init_TransportNodeHid = __esm({
|
|
|
500833
500833
|
* @returns a promise of apdu response
|
|
500834
500834
|
*/
|
|
500835
500835
|
async exchange(apdu) {
|
|
500836
|
-
const
|
|
500836
|
+
const tracer2 = this.tracer.withUpdatedContext({
|
|
500837
500837
|
function: "exchange"
|
|
500838
500838
|
});
|
|
500839
|
-
|
|
500839
|
+
tracer2.trace("Exchanging APDU ...");
|
|
500840
500840
|
const b17 = await this.exchangeAtomicImpl(async () => {
|
|
500841
500841
|
const { channel, packetSize } = this;
|
|
500842
|
-
|
|
500842
|
+
tracer2.withType("apdu").trace(`=> ${apdu.toString("hex")}`, { channel, packetSize });
|
|
500843
500843
|
const framingHelper = hid_framing_default(channel, packetSize);
|
|
500844
500844
|
const blocks2 = framingHelper.makeBlocks(apdu);
|
|
500845
500845
|
for (let i58 = 0; i58 < blocks2.length; i58++) {
|
|
@@ -500851,7 +500851,7 @@ var init_TransportNodeHid = __esm({
|
|
|
500851
500851
|
const buffer2 = await this.readHID();
|
|
500852
500852
|
acc = framingHelper.reduceResponse(acc, buffer2);
|
|
500853
500853
|
}
|
|
500854
|
-
|
|
500854
|
+
tracer2.withType("apdu").trace(`<= ${result2.toString("hex")}`, { channel, packetSize });
|
|
500855
500855
|
return result2;
|
|
500856
500856
|
});
|
|
500857
500857
|
return b17;
|
|
@@ -519494,7 +519494,7 @@ var require_package7 = __commonJS({
|
|
|
519494
519494
|
module2.exports = {
|
|
519495
519495
|
name: "@ledgerhq/live-common",
|
|
519496
519496
|
description: "Common ground for the Ledger Live apps",
|
|
519497
|
-
version: "34.53.0-nightly.
|
|
519497
|
+
version: "34.53.0-nightly.20251119110540",
|
|
519498
519498
|
repository: {
|
|
519499
519499
|
type: "git",
|
|
519500
519500
|
url: "https://github.com/LedgerHQ/ledger-live.git"
|
|
@@ -519796,8 +519796,8 @@ var require_package7 = __commonJS({
|
|
|
519796
519796
|
nock: "^13.0.5",
|
|
519797
519797
|
react: "catalog:",
|
|
519798
519798
|
"react-dom": "catalog:",
|
|
519799
|
-
"react-native": "
|
|
519800
|
-
"react-native-svg": "
|
|
519799
|
+
"react-native": "catalog:",
|
|
519800
|
+
"react-native-svg": "catalog:",
|
|
519801
519801
|
"react-test-renderer": "catalog:",
|
|
519802
519802
|
"redux-actions": "2.6.5",
|
|
519803
519803
|
timemachine: "^0.3.2",
|
|
@@ -519833,7 +519833,7 @@ var require_package8 = __commonJS({
|
|
|
519833
519833
|
"package.json"(exports2, module2) {
|
|
519834
519834
|
module2.exports = {
|
|
519835
519835
|
name: "@ledgerhq/live-cli",
|
|
519836
|
-
version: "24.28.0-nightly.
|
|
519836
|
+
version: "24.28.0-nightly.20251119110540",
|
|
519837
519837
|
description: "ledger-live CLI version",
|
|
519838
519838
|
repository: {
|
|
519839
519839
|
type: "git",
|
|
@@ -552873,14 +552873,14 @@ var withDevice = (deviceId, options24) => (job2) => new import_rxjs8.Observable(
|
|
|
552873
552873
|
const jobId = queuedJobManager.setLastQueuedJob(deviceId, new Promise((resolve) => {
|
|
552874
552874
|
resolveQueuedJob = resolve;
|
|
552875
552875
|
}));
|
|
552876
|
-
const
|
|
552877
|
-
|
|
552876
|
+
const tracer2 = new LocalTracer(LOG_TYPE2, { jobId, deviceId, origin: "hw:withDevice" });
|
|
552877
|
+
tracer2.trace(`New job for device: ${deviceId || "USB"}`);
|
|
552878
552878
|
const finalize4 = async (transport, cleanups) => {
|
|
552879
|
-
|
|
552879
|
+
tracer2.trace("Closing and cleaning transport", { function: "finalize" });
|
|
552880
552880
|
try {
|
|
552881
552881
|
await close(transport, deviceId);
|
|
552882
552882
|
} catch (error) {
|
|
552883
|
-
|
|
552883
|
+
tracer2.trace(`An error occurred when closing transport (ignoring it): ${error}`, {
|
|
552884
552884
|
error,
|
|
552885
552885
|
function: "finalize"
|
|
552886
552886
|
});
|
|
@@ -552889,19 +552889,19 @@ var withDevice = (deviceId, options24) => (job2) => new import_rxjs8.Observable(
|
|
|
552889
552889
|
};
|
|
552890
552890
|
let unsubscribed;
|
|
552891
552891
|
let sub;
|
|
552892
|
-
|
|
552892
|
+
tracer2.trace("Waiting for the previous job in the queue to complete", {
|
|
552893
552893
|
previousJobId: previousQueuedJob.id
|
|
552894
552894
|
});
|
|
552895
552895
|
previousQueuedJob.job.then(() => {
|
|
552896
|
-
|
|
552896
|
+
tracer2.trace("Previous queued job resolved, now trying to get a Transport instance", {
|
|
552897
552897
|
previousJobId: previousQueuedJob.id,
|
|
552898
552898
|
currentJobId: jobId
|
|
552899
552899
|
});
|
|
552900
|
-
return open(deviceId, options24,
|
|
552900
|
+
return open(deviceId, options24, tracer2.getContext());
|
|
552901
552901
|
}).then(async (transport) => {
|
|
552902
|
-
|
|
552902
|
+
tracer2.trace("Got a Transport instance from open");
|
|
552903
552903
|
if (unsubscribed) {
|
|
552904
|
-
|
|
552904
|
+
tracer2.trace("Unsubscribed (1) while processing job");
|
|
552905
552905
|
return finalize4(transport, [resolveQueuedJob]);
|
|
552906
552906
|
}
|
|
552907
552907
|
if (needsCleanup[identifyTransport(transport)]) {
|
|
@@ -552911,7 +552911,7 @@ var withDevice = (deviceId, options24) => (job2) => new import_rxjs8.Observable(
|
|
|
552911
552911
|
}
|
|
552912
552912
|
return transport;
|
|
552913
552913
|
}).catch((e35) => {
|
|
552914
|
-
|
|
552914
|
+
tracer2.trace(`Error while opening Transport: ${e35}`, { error: e35 });
|
|
552915
552915
|
resolveQueuedJob();
|
|
552916
552916
|
if (e35 instanceof BluetoothRequired)
|
|
552917
552917
|
throw e35;
|
|
@@ -552926,21 +552926,21 @@ var withDevice = (deviceId, options24) => (job2) => new import_rxjs8.Observable(
|
|
|
552926
552926
|
console.error(e35);
|
|
552927
552927
|
throw new CantOpenDevice(e35.message);
|
|
552928
552928
|
}).then((transport) => {
|
|
552929
|
-
|
|
552929
|
+
tracer2.trace("Executing job", { hasTransport: !!transport, unsubscribed });
|
|
552930
552930
|
if (!transport)
|
|
552931
552931
|
return;
|
|
552932
552932
|
if (unsubscribed) {
|
|
552933
|
-
|
|
552933
|
+
tracer2.trace("Unsubscribed (2) while processing job");
|
|
552934
552934
|
return finalize4(transport, [resolveQueuedJob]);
|
|
552935
552935
|
}
|
|
552936
|
-
sub = job2(transport).pipe((0, import_operators3.catchError)((error) => initialErrorRemapping(error,
|
|
552936
|
+
sub = job2(transport).pipe((0, import_operators3.catchError)((error) => initialErrorRemapping(error, tracer2.getContext())), (0, import_operators3.catchError)(errorRemapping), transportFinally(() => {
|
|
552937
552937
|
return finalize4(transport, [resolveQueuedJob]);
|
|
552938
552938
|
})).subscribe({
|
|
552939
552939
|
next: (event) => {
|
|
552940
552940
|
o41.next(event);
|
|
552941
552941
|
},
|
|
552942
552942
|
error: (error) => {
|
|
552943
|
-
|
|
552943
|
+
tracer2.trace("Job error", { error });
|
|
552944
552944
|
if (error.statusCode) {
|
|
552945
552945
|
o41.error(new TransportStatusError(error.statusCode));
|
|
552946
552946
|
} else {
|
|
@@ -552952,11 +552952,11 @@ var withDevice = (deviceId, options24) => (job2) => new import_rxjs8.Observable(
|
|
|
552952
552952
|
}
|
|
552953
552953
|
});
|
|
552954
552954
|
}).catch((error) => {
|
|
552955
|
-
|
|
552955
|
+
tracer2.trace(`Caught error on job execution step: ${error}`, { error });
|
|
552956
552956
|
o41.error(error);
|
|
552957
552957
|
});
|
|
552958
552958
|
return () => {
|
|
552959
|
-
|
|
552959
|
+
tracer2.trace(`Unsubscribing withDevice flow. Ongoing job to unsubscribe from ? ${!!sub}`);
|
|
552960
552960
|
unsubscribed = true;
|
|
552961
552961
|
if (sub)
|
|
552962
552962
|
sub.unsubscribe();
|
|
@@ -818483,12 +818483,11 @@ function genericGetAccountShape(network, kind) {
|
|
|
818483
818483
|
const spendableBalance = BigInt(nativeBalance - BigInt(nativeAsset?.locked ?? "0"));
|
|
818484
818484
|
const oldOps = (initialAccount?.operations || []).map((op) => op.accountId === accountId2 ? op : { ...op, accountId: accountId2, id: encodeOperationId(accountId2, op.hash, op.type) });
|
|
818485
818485
|
const lastPagingToken = oldOps[0]?.extra?.pagingToken || "";
|
|
818486
|
-
|
|
818487
|
-
|
|
818488
|
-
|
|
818489
|
-
}
|
|
818486
|
+
const syncHash = await getSyncHash(currency24.id, syncConfig.blacklistedTokenIds);
|
|
818487
|
+
const syncFromScratch = !initialAccount?.blockHeight || initialAccount?.syncHash !== syncHash;
|
|
818488
|
+
const minHeight = syncFromScratch ? 0 : (oldOps[0]?.blockHeight ?? 0) + 1;
|
|
818490
818489
|
const paginationParams = { minHeight, order: "asc" };
|
|
818491
|
-
if (lastPagingToken) {
|
|
818490
|
+
if (lastPagingToken && !syncFromScratch) {
|
|
818492
818491
|
paginationParams.lastPagingToken = lastPagingToken;
|
|
818493
818492
|
}
|
|
818494
818493
|
const [newCoreOps] = await alpacaApi.listOperations(address3, paginationParams);
|
|
@@ -818501,7 +818500,7 @@ function genericGetAccountShape(network, kind) {
|
|
|
818501
818500
|
operations: newAssetOperations,
|
|
818502
818501
|
getTokenFromAsset: alpacaApi.getTokenFromAsset
|
|
818503
818502
|
});
|
|
818504
|
-
const subAccounts = mergeSubAccounts5(initialAccount?.subAccounts ?? [], newSubAccounts);
|
|
818503
|
+
const subAccounts = syncFromScratch ? newSubAccounts : mergeSubAccounts5(initialAccount?.subAccounts ?? [], newSubAccounts);
|
|
818505
818504
|
const newOpsWithSubs = newOps.map((op) => {
|
|
818506
818505
|
const subOperations = inferSubOperations(op.hash, newSubAccounts);
|
|
818507
818506
|
return cleanedOperation({
|
|
@@ -818510,10 +818509,8 @@ function genericGetAccountShape(network, kind) {
|
|
|
818510
818509
|
});
|
|
818511
818510
|
});
|
|
818512
818511
|
const confirmedOperations = alpacaApi.refreshOperations && initialAccount?.pendingOperations.length ? await alpacaApi.refreshOperations(initialAccount.pendingOperations) : [];
|
|
818513
|
-
const
|
|
818514
|
-
|
|
818515
|
-
...newOpsWithSubs
|
|
818516
|
-
]);
|
|
818512
|
+
const newOperations = [...confirmedOperations, ...newOpsWithSubs];
|
|
818513
|
+
const operations4 = syncFromScratch ? newOperations : mergeOps(oldOps, newOperations);
|
|
818517
818514
|
const res = {
|
|
818518
818515
|
id: accountId2,
|
|
818519
818516
|
xpub: address3,
|
|
@@ -818522,7 +818519,8 @@ function genericGetAccountShape(network, kind) {
|
|
|
818522
818519
|
spendableBalance: new import_bignumber362.default(spendableBalance.toString()),
|
|
818523
818520
|
operations: operations4,
|
|
818524
818521
|
subAccounts,
|
|
818525
|
-
operationsCount: operations4.length
|
|
818522
|
+
operationsCount: operations4.length,
|
|
818523
|
+
syncHash
|
|
818526
818524
|
};
|
|
818527
818525
|
return res;
|
|
818528
818526
|
};
|
|
@@ -835273,6 +835271,8 @@ function getProviderIdUseCase({ deviceInfo, forceProvider }) {
|
|
|
835273
835271
|
}
|
|
835274
835272
|
|
|
835275
835273
|
// ../../libs/device-core/lib-es/managerApi/repositories/HttpManagerApiRepository.js
|
|
835274
|
+
init_lib_es2();
|
|
835275
|
+
var tracer = new LocalTracer("live-dmk-tracer", { function: "HttpManagerApiRepository" });
|
|
835276
835276
|
var HttpManagerApiRepository = class {
|
|
835277
835277
|
managerApiBase;
|
|
835278
835278
|
liveCommonVersion;
|
|
@@ -835285,6 +835285,9 @@ var HttpManagerApiRepository = class {
|
|
|
835285
835285
|
// parameters.
|
|
835286
835286
|
fetchLatestFirmware = makeLRUCache(async ({ current_se_firmware_final_version, device_version, providerId, userId }) => {
|
|
835287
835287
|
const salt = getUserHashes(userId).firmwareSalt;
|
|
835288
|
+
tracer.trace("Fetch latest firmware", {
|
|
835289
|
+
salt
|
|
835290
|
+
});
|
|
835288
835291
|
const { data: data6 } = await network_default({
|
|
835289
835292
|
method: "GET",
|
|
835290
835293
|
url: import_url8.default.format({
|
|
@@ -835686,12 +835689,12 @@ init_lib_es2();
|
|
|
835686
835689
|
init_Transport();
|
|
835687
835690
|
init_lib_es2();
|
|
835688
835691
|
function parseGetDeviceNameResponse(response) {
|
|
835689
|
-
const
|
|
835692
|
+
const tracer2 = new LocalTracer("hw", {
|
|
835690
835693
|
function: "parseGetDeviceNameResponse"
|
|
835691
835694
|
});
|
|
835692
835695
|
const status = response.readUInt16BE(response.length - 2);
|
|
835693
|
-
if (
|
|
835694
|
-
|
|
835696
|
+
if (tracer2)
|
|
835697
|
+
tracer2.trace("Result status from 0xe0d20000", { status });
|
|
835695
835698
|
switch (status) {
|
|
835696
835699
|
case StatusCodes.OK:
|
|
835697
835700
|
return response.slice(0, response.length - 2).toString("utf-8");
|
|
@@ -835706,17 +835709,17 @@ function parseGetDeviceNameResponse(response) {
|
|
|
835706
835709
|
var CLEANING_APDU = [224, 80, 0, 0, void 0];
|
|
835707
835710
|
var GET_DEVICE_NAME_APDU = [224, 210, 0, 0, Buffer.from([])];
|
|
835708
835711
|
async function getDeviceName(transport) {
|
|
835709
|
-
const
|
|
835712
|
+
const tracer2 = new LocalTracer("hw", {
|
|
835710
835713
|
transport: transport.getTraceContext(),
|
|
835711
835714
|
function: "getDeviceName"
|
|
835712
835715
|
});
|
|
835713
|
-
|
|
835716
|
+
tracer2.trace("Start");
|
|
835714
835717
|
try {
|
|
835715
835718
|
await transport.send(...CLEANING_APDU);
|
|
835716
835719
|
} catch (error) {
|
|
835717
|
-
|
|
835720
|
+
tracer2.trace(`Error on 0xe0500000: ${error}`, { error });
|
|
835718
835721
|
}
|
|
835719
|
-
|
|
835722
|
+
tracer2.trace("Sent cleaning 0xe0500000");
|
|
835720
835723
|
const res = await transport.send(...GET_DEVICE_NAME_APDU, [
|
|
835721
835724
|
StatusCodes.OK,
|
|
835722
835725
|
StatusCodes.DEVICE_NOT_ONBOARDED,
|
|
@@ -835759,21 +835762,21 @@ var RESPONSE_STATUS_SET = [
|
|
|
835759
835762
|
StatusCodes.INVALID_BACKUP_STATE
|
|
835760
835763
|
];
|
|
835761
835764
|
async function backupAppStorage(transport) {
|
|
835762
|
-
const
|
|
835765
|
+
const tracer2 = new LocalTracer("hw", {
|
|
835763
835766
|
transport: transport.getTraceContext(),
|
|
835764
835767
|
function: "backupAppStorage"
|
|
835765
835768
|
});
|
|
835766
|
-
|
|
835769
|
+
tracer2.trace("Start");
|
|
835767
835770
|
const apdu = [...BACKUP_APP_STORAGE, Buffer.from([])];
|
|
835768
835771
|
const response = await transport.send(...apdu, RESPONSE_STATUS_SET);
|
|
835769
835772
|
return parseResponse2(response);
|
|
835770
835773
|
}
|
|
835771
835774
|
function parseResponse2(data6) {
|
|
835772
|
-
const
|
|
835775
|
+
const tracer2 = new LocalTracer("hw", {
|
|
835773
835776
|
function: "parseResponse@backupAppStorage"
|
|
835774
835777
|
});
|
|
835775
835778
|
const status = data6.readUInt16BE(data6.length - 2);
|
|
835776
|
-
|
|
835779
|
+
tracer2.trace("Result status from 0xe06b0000", { status });
|
|
835777
835780
|
switch (status) {
|
|
835778
835781
|
case StatusCodes.OK:
|
|
835779
835782
|
return data6.subarray(0, data6.length - 2);
|
|
@@ -835806,22 +835809,22 @@ var RESPONSE_STATUS_SET2 = [
|
|
|
835806
835809
|
StatusCodes.INVALID_APP_NAME_LENGTH
|
|
835807
835810
|
];
|
|
835808
835811
|
async function getAppStorageInfo(transport, appName) {
|
|
835809
|
-
const
|
|
835812
|
+
const tracer2 = new LocalTracer("hw", {
|
|
835810
835813
|
transport: transport.getTraceContext(),
|
|
835811
835814
|
function: "getAppStorageInfo"
|
|
835812
835815
|
});
|
|
835813
|
-
|
|
835816
|
+
tracer2.trace("Start");
|
|
835814
835817
|
const params = Buffer.from(appName, "ascii");
|
|
835815
835818
|
const apdu = [...GET_APP_STORAGE_INFO, params];
|
|
835816
835819
|
const response = await transport.send(...apdu, RESPONSE_STATUS_SET2);
|
|
835817
835820
|
return parseResponse3(response);
|
|
835818
835821
|
}
|
|
835819
835822
|
function parseResponse3(data6) {
|
|
835820
|
-
const
|
|
835823
|
+
const tracer2 = new LocalTracer("hw", {
|
|
835821
835824
|
function: "parseResponse@getAppStorageInfo"
|
|
835822
835825
|
});
|
|
835823
835826
|
const status = data6.readUInt16BE(data6.length - 2);
|
|
835824
|
-
|
|
835827
|
+
tracer2.trace("Result status from 0xe06a0000", { status });
|
|
835825
835828
|
switch (status) {
|
|
835826
835829
|
case StatusCodes.OK: {
|
|
835827
835830
|
let offset2 = 0;
|
|
@@ -835864,21 +835867,21 @@ var RESPONSE_STATUS_SET3 = [
|
|
|
835864
835867
|
StatusCodes.INVALID_BACKUP_HEADER
|
|
835865
835868
|
];
|
|
835866
835869
|
async function restoreAppStorage(transport, chunk5) {
|
|
835867
|
-
const
|
|
835870
|
+
const tracer2 = new LocalTracer("hw", {
|
|
835868
835871
|
transport: transport.getTraceContext(),
|
|
835869
835872
|
function: "restoreAppStorage"
|
|
835870
835873
|
});
|
|
835871
|
-
|
|
835874
|
+
tracer2.trace("Start");
|
|
835872
835875
|
const apdu = [...RESTORE_APP_STORAGE, chunk5];
|
|
835873
835876
|
const response = await transport.send(...apdu, RESPONSE_STATUS_SET3);
|
|
835874
835877
|
parseResponse4(response);
|
|
835875
835878
|
}
|
|
835876
835879
|
function parseResponse4(data6) {
|
|
835877
|
-
const
|
|
835880
|
+
const tracer2 = new LocalTracer("hw", {
|
|
835878
835881
|
function: "parseResponse@restoreAppStorage"
|
|
835879
835882
|
});
|
|
835880
835883
|
const status = data6.readUInt16BE(data6.length - 2);
|
|
835881
|
-
|
|
835884
|
+
tracer2.trace("Result status from 0xe06d0000", { status });
|
|
835882
835885
|
switch (status) {
|
|
835883
835886
|
case StatusCodes.OK:
|
|
835884
835887
|
return;
|
|
@@ -835913,21 +835916,21 @@ var RESPONSE_STATUS_SET4 = [
|
|
|
835913
835916
|
StatusCodes.INVALID_CHUNK_LENGTH
|
|
835914
835917
|
];
|
|
835915
835918
|
async function restoreAppStorageCommit(transport) {
|
|
835916
|
-
const
|
|
835919
|
+
const tracer2 = new LocalTracer("hw", {
|
|
835917
835920
|
transport: transport.getTraceContext(),
|
|
835918
835921
|
function: "restoreAppStorageCommit"
|
|
835919
835922
|
});
|
|
835920
|
-
|
|
835923
|
+
tracer2.trace("Start");
|
|
835921
835924
|
const apdu = [...RESTORE_APP_STORAGE_COMMIT, Buffer.from([])];
|
|
835922
835925
|
const response = await transport.send(...apdu, RESPONSE_STATUS_SET4);
|
|
835923
835926
|
parseResponse5(response);
|
|
835924
835927
|
}
|
|
835925
835928
|
function parseResponse5(data6) {
|
|
835926
|
-
const
|
|
835929
|
+
const tracer2 = new LocalTracer("hw", {
|
|
835927
835930
|
function: "parseResponse@restoreAppStorageCommit"
|
|
835928
835931
|
});
|
|
835929
835932
|
const status = data6.readUInt16BE(data6.length - 2);
|
|
835930
|
-
|
|
835933
|
+
tracer2.trace("Result status from 0xe06e0000", { status });
|
|
835931
835934
|
switch (status) {
|
|
835932
835935
|
case StatusCodes.OK:
|
|
835933
835936
|
return;
|
|
@@ -835959,11 +835962,11 @@ var RESPONSE_STATUS_SET5 = [
|
|
|
835959
835962
|
StatusCodes.INVALID_BACKUP_LENGTH
|
|
835960
835963
|
];
|
|
835961
835964
|
async function restoreAppStorageInit(transport, appName, backupSize) {
|
|
835962
|
-
const
|
|
835965
|
+
const tracer2 = new LocalTracer("hw", {
|
|
835963
835966
|
transport: transport.getTraceContext(),
|
|
835964
835967
|
function: "restoreAppStorageInit"
|
|
835965
835968
|
});
|
|
835966
|
-
|
|
835969
|
+
tracer2.trace("Start");
|
|
835967
835970
|
const params = Buffer.concat([
|
|
835968
835971
|
Buffer.from(backupSize.toString(16).padStart(8, "0"), "hex"),
|
|
835969
835972
|
// BACKUP_LEN
|
|
@@ -835975,11 +835978,11 @@ async function restoreAppStorageInit(transport, appName, backupSize) {
|
|
|
835975
835978
|
parseResponse6(response);
|
|
835976
835979
|
}
|
|
835977
835980
|
function parseResponse6(data6) {
|
|
835978
|
-
const
|
|
835981
|
+
const tracer2 = new LocalTracer("hw", {
|
|
835979
835982
|
function: "parseResponse@restoreAppStorageInit"
|
|
835980
835983
|
});
|
|
835981
835984
|
const status = data6.readUInt16BE(data6.length - 2);
|
|
835982
|
-
|
|
835985
|
+
tracer2.trace("Result status from 0xe06c0000", { status });
|
|
835983
835986
|
switch (status) {
|
|
835984
835987
|
case StatusCodes.OK:
|
|
835985
835988
|
return;
|
|
@@ -836086,21 +836089,21 @@ var RESPONSE_STATUS_SET6 = [
|
|
|
836086
836089
|
StatusCodes.PIN_NOT_SET
|
|
836087
836090
|
];
|
|
836088
836091
|
async function reinstallConfigurationConsent(transport, args3) {
|
|
836089
|
-
const
|
|
836092
|
+
const tracer2 = new LocalTracer("hw", {
|
|
836090
836093
|
transport: transport.getTraceContext(),
|
|
836091
836094
|
function: "reinstallConfigurationConsent"
|
|
836092
836095
|
});
|
|
836093
|
-
|
|
836096
|
+
tracer2.trace("Start");
|
|
836094
836097
|
const apdu = [...REINSTALL_CONFIG, Buffer.from(args3)];
|
|
836095
836098
|
const response = await transport.send(...apdu, RESPONSE_STATUS_SET6);
|
|
836096
836099
|
return parseResponse7(response);
|
|
836097
836100
|
}
|
|
836098
836101
|
function parseResponse7(data6) {
|
|
836099
|
-
const
|
|
836102
|
+
const tracer2 = new LocalTracer("hw", {
|
|
836100
836103
|
function: "parseResponse@reinstallConfigurationConsent"
|
|
836101
836104
|
});
|
|
836102
836105
|
const status = data6.readUInt16BE(data6.length - 2);
|
|
836103
|
-
|
|
836106
|
+
tracer2.trace("Result status from 0xe06f0000", { status });
|
|
836104
836107
|
switch (status) {
|
|
836105
836108
|
case StatusCodes.OK:
|
|
836106
836109
|
return;
|
|
@@ -836135,13 +836138,13 @@ var isDashboardName = (name2) => dashboardNames.includes(name2);
|
|
|
836135
836138
|
var ManagerAllowedFlag = 8;
|
|
836136
836139
|
var PinValidatedFlag = 128;
|
|
836137
836140
|
async function getDeviceInfo_default(transport) {
|
|
836138
|
-
const
|
|
836141
|
+
const tracer2 = new LocalTracer("hw", {
|
|
836139
836142
|
...transport.getTraceContext(),
|
|
836140
836143
|
function: "getDeviceInfo"
|
|
836141
836144
|
});
|
|
836142
|
-
|
|
836145
|
+
tracer2.trace("Starting get device info");
|
|
836143
836146
|
const probablyOnDashboard = await getAppAndVersion_default(transport).then(({ name: name2 }) => isDashboardName(name2)).catch((e35) => {
|
|
836144
|
-
|
|
836147
|
+
tracer2.trace(`Error from getAppAndVersion: ${e35}`, { error: e35 });
|
|
836145
836148
|
if (e35 instanceof TransportStatusError) {
|
|
836146
836149
|
if (e35.statusCode === 28160) {
|
|
836147
836150
|
return true;
|
|
@@ -836153,11 +836156,11 @@ async function getDeviceInfo_default(transport) {
|
|
|
836153
836156
|
throw e35;
|
|
836154
836157
|
});
|
|
836155
836158
|
if (!probablyOnDashboard) {
|
|
836156
|
-
|
|
836159
|
+
tracer2.trace(`Device not on dashboard`);
|
|
836157
836160
|
throw new DeviceOnDashboardExpected();
|
|
836158
836161
|
}
|
|
836159
836162
|
const res = await getVersion(transport).catch((e35) => {
|
|
836160
|
-
|
|
836163
|
+
tracer2.trace(`Error from getVersion: ${e35}`, { error: e35 });
|
|
836161
836164
|
if (e35 instanceof TransportStatusError) {
|
|
836162
836165
|
if (e35.statusCode === 27910 || e35.statusCode === 27911) {
|
|
836163
836166
|
throw new DeviceNotOnboarded();
|
|
@@ -836242,12 +836245,12 @@ var ALLOW_SECURE_CHANNEL_DELAY = 500;
|
|
|
836242
836245
|
var warningsSubject = new import_rxjs187.Subject();
|
|
836243
836246
|
var warnings2 = warningsSubject.asObservable();
|
|
836244
836247
|
function createDeviceSocket(transport, { url: url4, unresponsiveExpectedDuringBulk, context }) {
|
|
836245
|
-
const
|
|
836248
|
+
const tracer2 = new LocalTracer(LOG_TYPE3, {
|
|
836246
836249
|
...context,
|
|
836247
836250
|
function: "createDeviceSocket",
|
|
836248
836251
|
transportContext: transport.getTraceContext()
|
|
836249
836252
|
});
|
|
836250
|
-
|
|
836253
|
+
tracer2.trace("Starting web socket communication", { url: url4, unresponsiveExpectedDuringBulk });
|
|
836251
836254
|
return new import_rxjs187.Observable((o41) => {
|
|
836252
836255
|
let deviceError = null;
|
|
836253
836256
|
let unsubscribed = false;
|
|
@@ -836257,13 +836260,13 @@ function createDeviceSocket(transport, { url: url4, unresponsiveExpectedDuringBu
|
|
|
836257
836260
|
let allowSecureChannelTimeout = null;
|
|
836258
836261
|
const ws3 = new import_isomorphic_ws3.default(url4);
|
|
836259
836262
|
ws3.onopen = () => {
|
|
836260
|
-
|
|
836263
|
+
tracer2.trace("Socket opened", { url: url4 });
|
|
836261
836264
|
o41.next({
|
|
836262
836265
|
type: "opened"
|
|
836263
836266
|
});
|
|
836264
836267
|
};
|
|
836265
836268
|
ws3.onerror = (e35) => {
|
|
836266
|
-
|
|
836269
|
+
tracer2.trace("Socket error", { e: e35 });
|
|
836267
836270
|
if (inBulkMode)
|
|
836268
836271
|
return;
|
|
836269
836272
|
o41.error(new WebsocketConnectionError(e35.message, {
|
|
@@ -836271,13 +836274,13 @@ function createDeviceSocket(transport, { url: url4, unresponsiveExpectedDuringBu
|
|
|
836271
836274
|
}));
|
|
836272
836275
|
};
|
|
836273
836276
|
ws3.onclose = () => {
|
|
836274
|
-
|
|
836277
|
+
tracer2.trace("Socket closed", { url: url4, inBulkMode, correctlyFinished });
|
|
836275
836278
|
if (inBulkMode)
|
|
836276
836279
|
return;
|
|
836277
836280
|
if (correctlyFinished) {
|
|
836278
836281
|
o41.complete();
|
|
836279
836282
|
} else {
|
|
836280
|
-
|
|
836283
|
+
tracer2.trace(`Socket closed, not correctly finished, device error: ${deviceError}`, {
|
|
836281
836284
|
deviceError,
|
|
836282
836285
|
inBulkMode
|
|
836283
836286
|
});
|
|
@@ -836290,10 +836293,10 @@ function createDeviceSocket(transport, { url: url4, unresponsiveExpectedDuringBu
|
|
|
836290
836293
|
deviceError = null;
|
|
836291
836294
|
try {
|
|
836292
836295
|
const input = JSON.parse(e35.data);
|
|
836293
|
-
|
|
836296
|
+
tracer2.trace("Socket in", { type: input.query });
|
|
836294
836297
|
switch (input.query) {
|
|
836295
836298
|
case "exchange": {
|
|
836296
|
-
|
|
836299
|
+
tracer2.trace("Socket in: exchange", {
|
|
836297
836300
|
nonce: input?.nonce,
|
|
836298
836301
|
uuid: input?.uuid,
|
|
836299
836302
|
session: input?.session
|
|
@@ -836361,13 +836364,13 @@ function createDeviceSocket(transport, { url: url4, unresponsiveExpectedDuringBu
|
|
|
836361
836364
|
response,
|
|
836362
836365
|
data: data6.toString("hex")
|
|
836363
836366
|
};
|
|
836364
|
-
|
|
836367
|
+
tracer2.trace("Socket out", { response: msg.response });
|
|
836365
836368
|
const strMsg = JSON.stringify(msg);
|
|
836366
836369
|
ws3.send(strMsg);
|
|
836367
836370
|
break;
|
|
836368
836371
|
}
|
|
836369
836372
|
case "bulk": {
|
|
836370
|
-
|
|
836373
|
+
tracer2.trace("Socket in: bulk", {
|
|
836371
836374
|
apduCount: input?.data?.length,
|
|
836372
836375
|
nonce: input?.nonce,
|
|
836373
836376
|
uuid: input?.uuid,
|
|
@@ -836395,7 +836398,7 @@ function createDeviceSocket(transport, { url: url4, unresponsiveExpectedDuringBu
|
|
|
836395
836398
|
});
|
|
836396
836399
|
});
|
|
836397
836400
|
if (unsubscribed) {
|
|
836398
|
-
|
|
836401
|
+
tracer2.trace("unsubscribed before end of bulk");
|
|
836399
836402
|
return;
|
|
836400
836403
|
}
|
|
836401
836404
|
correctlyFinished = true;
|
|
@@ -836404,7 +836407,7 @@ function createDeviceSocket(transport, { url: url4, unresponsiveExpectedDuringBu
|
|
|
836404
836407
|
}
|
|
836405
836408
|
case "success": {
|
|
836406
836409
|
const payload = input.result || input.data;
|
|
836407
|
-
|
|
836410
|
+
tracer2.trace("Socket in: success", {
|
|
836408
836411
|
payload,
|
|
836409
836412
|
inBulkMode,
|
|
836410
836413
|
nonce: input?.nonce,
|
|
@@ -836424,7 +836427,7 @@ function createDeviceSocket(transport, { url: url4, unresponsiveExpectedDuringBu
|
|
|
836424
836427
|
break;
|
|
836425
836428
|
}
|
|
836426
836429
|
case "error": {
|
|
836427
|
-
|
|
836430
|
+
tracer2.trace("Socket in: error", {
|
|
836428
836431
|
errorData: input?.data,
|
|
836429
836432
|
inBulkMode,
|
|
836430
836433
|
nonce: input?.nonce,
|
|
@@ -836438,7 +836441,7 @@ function createDeviceSocket(transport, { url: url4, unresponsiveExpectedDuringBu
|
|
|
836438
836441
|
});
|
|
836439
836442
|
}
|
|
836440
836443
|
case "warning": {
|
|
836441
|
-
|
|
836444
|
+
tracer2.trace("Socket in: warning", {
|
|
836442
836445
|
warningData: input?.data,
|
|
836443
836446
|
inBulkMode,
|
|
836444
836447
|
nonce: input?.nonce,
|
|
@@ -836455,23 +836458,23 @@ function createDeviceSocket(transport, { url: url4, unresponsiveExpectedDuringBu
|
|
|
836455
836458
|
break;
|
|
836456
836459
|
}
|
|
836457
836460
|
default:
|
|
836458
|
-
|
|
836461
|
+
tracer2.trace("Socket in: cannot handle msg of type", { input });
|
|
836459
836462
|
}
|
|
836460
836463
|
} catch (err) {
|
|
836461
836464
|
deviceError = err;
|
|
836462
|
-
|
|
836465
|
+
tracer2.trace("Socket message error", { err });
|
|
836463
836466
|
o41.error(err);
|
|
836464
836467
|
}
|
|
836465
836468
|
};
|
|
836466
836469
|
const onDisconnect = (e35) => {
|
|
836467
836470
|
transport.off("disconnect", onDisconnect);
|
|
836468
|
-
|
|
836471
|
+
tracer2.trace(`Socket disconnected. Emitting a DisconnectedDeviceDuringOperation. Error: ${e35}`, { error: e35 });
|
|
836469
836472
|
const error = new DisconnectedDeviceDuringOperation(e35 && e35.message || "");
|
|
836470
836473
|
deviceError = error;
|
|
836471
836474
|
o41.error(error);
|
|
836472
836475
|
};
|
|
836473
836476
|
const onUnresponsiveDevice = () => {
|
|
836474
|
-
|
|
836477
|
+
tracer2.trace(`Device unresponsive`, {
|
|
836475
836478
|
inBulkMode,
|
|
836476
836479
|
unresponsiveExpectedDuringBulk,
|
|
836477
836480
|
allowSecureChannelTimeout,
|
|
@@ -836848,11 +836851,11 @@ init_lib_es2();
|
|
|
836848
836851
|
var APP_INSTALL_RETRY_DELAY = 500;
|
|
836849
836852
|
var APP_INSTALL_RETRY_LIMIT = 5;
|
|
836850
836853
|
function installApp(transport, targetId, app, { retryLimit = APP_INSTALL_RETRY_LIMIT, retryDelayMs = APP_INSTALL_RETRY_DELAY } = {}) {
|
|
836851
|
-
const
|
|
836854
|
+
const tracer2 = new LocalTracer(LOG_TYPE, {
|
|
836852
836855
|
...transport.getTraceContext(),
|
|
836853
836856
|
function: "installApp"
|
|
836854
836857
|
});
|
|
836855
|
-
|
|
836858
|
+
tracer2.trace("Install app", {
|
|
836856
836859
|
targetId,
|
|
836857
836860
|
appName: app?.name,
|
|
836858
836861
|
appVersion: app?.version,
|
|
@@ -836871,12 +836874,12 @@ function installApp(transport, targetId, app, { retryLimit = APP_INSTALL_RETRY_L
|
|
|
836871
836874
|
count: retryLimit,
|
|
836872
836875
|
delay: (error, retryCount) => {
|
|
836873
836876
|
if (error instanceof LockedDeviceError || error instanceof ManagerDeviceLockedError || error instanceof UnresponsiveDeviceError) {
|
|
836874
|
-
|
|
836877
|
+
tracer2.trace(`Not retrying on error: ${error}`, {
|
|
836875
836878
|
error
|
|
836876
836879
|
});
|
|
836877
836880
|
return (0, import_rxjs190.throwError)(() => error);
|
|
836878
836881
|
}
|
|
836879
|
-
|
|
836882
|
+
tracer2.trace(`Retrying (${retryCount}/${retryLimit}) on error: ${error}`, {
|
|
836880
836883
|
error,
|
|
836881
836884
|
retryLimit,
|
|
836882
836885
|
retryDelayMs
|
|
@@ -836893,7 +836896,7 @@ function installApp(transport, targetId, app, { retryLimit = APP_INSTALL_RETRY_L
|
|
|
836893
836896
|
})),
|
|
836894
836897
|
// extract a stream of progress percentage
|
|
836895
836898
|
(0, import_operators39.catchError)((e35) => {
|
|
836896
|
-
|
|
836899
|
+
tracer2.trace(`Error: ${e35}`, { error: e35 });
|
|
836897
836900
|
if (!e35 || !e35.message)
|
|
836898
836901
|
return (0, import_rxjs190.throwError)(() => e35);
|
|
836899
836902
|
const status = e35.message.slice(e35.message.length - 4);
|
|
@@ -837131,8 +837134,8 @@ function getLatestFirmwareForDeviceUseCase(deviceInfo, managerApiRepository = Ht
|
|
|
837131
837134
|
var appsWithDynamicHashes = ["Fido U2F", "Security Key"];
|
|
837132
837135
|
var emptyHashData = "0".repeat(64);
|
|
837133
837136
|
var listApps2 = ({ transport, deviceInfo, deviceProxyModel, managerDevModeEnabled, forceProvider, managerApiRepository }) => {
|
|
837134
|
-
const
|
|
837135
|
-
|
|
837137
|
+
const tracer2 = new LocalTracer("list-apps", { transport: transport.getTraceContext() });
|
|
837138
|
+
tracer2.trace("Using new version", { deviceInfo });
|
|
837136
837139
|
if (deviceInfo.isOSU || deviceInfo.isBootloader) {
|
|
837137
837140
|
return (0, import_rxjs193.throwError)(() => new UnexpectedBootloader(""));
|
|
837138
837141
|
}
|
|
@@ -837171,7 +837174,7 @@ var listApps2 = ({ transport, deviceInfo, deviceProxyModel, managerDevModeEnable
|
|
|
837171
837174
|
});
|
|
837172
837175
|
}
|
|
837173
837176
|
if (deviceInfo.managerAllowed) {
|
|
837174
|
-
|
|
837177
|
+
tracer2.trace("Using direct apdu listapps");
|
|
837175
837178
|
listAppsResponsePromise = listAppsWithSingleCommand().catch((e35) => {
|
|
837176
837179
|
if (e35 instanceof TransportStatusError && [
|
|
837177
837180
|
StatusCodes.CLA_NOT_SUPPORTED,
|
|
@@ -837181,13 +837184,13 @@ var listApps2 = ({ transport, deviceInfo, deviceProxyModel, managerDevModeEnable
|
|
|
837181
837184
|
27905
|
|
837182
837185
|
// No StatusCodes definition
|
|
837183
837186
|
].includes(e35.statusCode)) {
|
|
837184
|
-
|
|
837187
|
+
tracer2.trace("Fallback to scriptrunner listapps");
|
|
837185
837188
|
return listAppsWithManagerApi();
|
|
837186
837189
|
}
|
|
837187
837190
|
throw e35;
|
|
837188
837191
|
});
|
|
837189
837192
|
} else {
|
|
837190
|
-
|
|
837193
|
+
tracer2.trace("Using scriptrunner listapps");
|
|
837191
837194
|
listAppsResponsePromise = listAppsWithManagerApi();
|
|
837192
837195
|
}
|
|
837193
837196
|
const filteredListAppsPromise = listAppsResponsePromise.then((result3) => {
|
|
@@ -837240,7 +837243,7 @@ var listApps2 = ({ transport, deviceInfo, deviceProxyModel, managerDevModeEnable
|
|
|
837240
837243
|
return;
|
|
837241
837244
|
}
|
|
837242
837245
|
const matchFromCatalog = catalogForDevice.find(({ name: name2 }) => name2 === localName);
|
|
837243
|
-
|
|
837246
|
+
tracer2.trace(`Falling back to catalog for ${localName}`, {
|
|
837244
837247
|
localName,
|
|
837245
837248
|
matchFromCatalog: Boolean(matchFromCatalog)
|
|
837246
837249
|
});
|
|
@@ -837248,7 +837251,7 @@ var listApps2 = ({ transport, deviceInfo, deviceProxyModel, managerDevModeEnable
|
|
|
837248
837251
|
installedList.push(matchFromCatalog);
|
|
837249
837252
|
}
|
|
837250
837253
|
});
|
|
837251
|
-
|
|
837254
|
+
tracer2.trace("Installed and in catalog apps", {
|
|
837252
837255
|
installedApps: installedList.length,
|
|
837253
837256
|
inCatalogApps: catalogForDevice.length
|
|
837254
837257
|
});
|
|
@@ -838469,14 +838472,14 @@ var withTransport = (deviceId, options24) => {
|
|
|
838469
838472
|
const jobId = queuedJobManager.setLastQueuedJob(deviceId, new Promise((resolve) => {
|
|
838470
838473
|
resolveQueuedJob = resolve;
|
|
838471
838474
|
}));
|
|
838472
|
-
const
|
|
838475
|
+
const tracer2 = new LocalTracer(LOG_TYPE4, {
|
|
838473
838476
|
jobId,
|
|
838474
838477
|
deviceId,
|
|
838475
838478
|
origin: "deviceSdk:withTransport"
|
|
838476
838479
|
});
|
|
838477
|
-
|
|
838480
|
+
tracer2.trace(`New job for device: ${deviceId || "USB"}`);
|
|
838478
838481
|
const finalize4 = (transport, cleanups) => {
|
|
838479
|
-
|
|
838482
|
+
tracer2.trace("Closing and cleaning transport");
|
|
838480
838483
|
return close(transport, deviceId).catch(() => {
|
|
838481
838484
|
}).then(() => {
|
|
838482
838485
|
cleanups.forEach((c59) => c59());
|
|
@@ -838485,9 +838488,9 @@ var withTransport = (deviceId, options24) => {
|
|
|
838485
838488
|
let unsubscribed;
|
|
838486
838489
|
let sub;
|
|
838487
838490
|
const setupTransport = async (transport) => {
|
|
838488
|
-
|
|
838491
|
+
tracer2.trace("Setting up the transport instance");
|
|
838489
838492
|
if (unsubscribed) {
|
|
838490
|
-
|
|
838493
|
+
tracer2.trace("Unsubscribed (1) while processing job");
|
|
838491
838494
|
return finalize4(transport, [resolveQueuedJob]);
|
|
838492
838495
|
}
|
|
838493
838496
|
if (needsCleanup2[identifyTransport2(transport)]) {
|
|
@@ -838498,7 +838501,7 @@ var withTransport = (deviceId, options24) => {
|
|
|
838498
838501
|
return transport;
|
|
838499
838502
|
};
|
|
838500
838503
|
const onErrorDuringTransportSetup = (error) => {
|
|
838501
|
-
|
|
838504
|
+
tracer2.trace("Error while setting up a transport: ", { error });
|
|
838502
838505
|
resolveQueuedJob();
|
|
838503
838506
|
if (error instanceof BluetoothRequired)
|
|
838504
838507
|
throw error;
|
|
@@ -838516,50 +838519,50 @@ var withTransport = (deviceId, options24) => {
|
|
|
838516
838519
|
throw new CantOpenDevice("Unknown error");
|
|
838517
838520
|
};
|
|
838518
838521
|
const buildRefreshableTransport = (transport) => {
|
|
838519
|
-
|
|
838522
|
+
tracer2.trace("Creating a refreshable transport from a given instance");
|
|
838520
838523
|
const transportRef = {
|
|
838521
838524
|
current: transport,
|
|
838522
838525
|
_refreshedCounter: 0,
|
|
838523
838526
|
refreshTransport: Promise.resolve
|
|
838524
838527
|
};
|
|
838525
|
-
|
|
838528
|
+
tracer2.updateContext({ transportRefreshedCounter: transportRef._refreshedCounter });
|
|
838526
838529
|
transportRef.refreshTransport = async () => {
|
|
838527
|
-
|
|
838530
|
+
tracer2.trace("Refreshing current transport");
|
|
838528
838531
|
return close(transportRef.current, deviceId).catch(() => {
|
|
838529
|
-
}).then(async () => open(deviceId, options24,
|
|
838532
|
+
}).then(async () => open(deviceId, options24, tracer2.getContext())).then(async (newTransport) => {
|
|
838530
838533
|
await setupTransport(transportRef.current);
|
|
838531
838534
|
transportRef.current = newTransport;
|
|
838532
838535
|
transportRef._refreshedCounter++;
|
|
838533
|
-
|
|
838534
|
-
|
|
838536
|
+
tracer2.updateContext({ transportRefreshedCounter: transportRef._refreshedCounter });
|
|
838537
|
+
tracer2.trace("Transport was refreshed");
|
|
838535
838538
|
}).catch(onErrorDuringTransportSetup);
|
|
838536
838539
|
};
|
|
838537
838540
|
return transportRef;
|
|
838538
838541
|
};
|
|
838539
|
-
|
|
838542
|
+
tracer2.trace("Waiting for the previous job in the queue to complete", {
|
|
838540
838543
|
previousJobId: previousQueuedJob.id
|
|
838541
838544
|
});
|
|
838542
838545
|
previousQueuedJob.job.then(() => {
|
|
838543
|
-
|
|
838546
|
+
tracer2.trace("Previous queued job resolved, now trying to get a Transport instance", {
|
|
838544
838547
|
previousJobId: previousQueuedJob.id,
|
|
838545
838548
|
currentJobId: jobId
|
|
838546
838549
|
});
|
|
838547
|
-
return open(deviceId, options24,
|
|
838550
|
+
return open(deviceId, options24, tracer2.getContext());
|
|
838548
838551
|
}).then((transport) => {
|
|
838549
838552
|
return buildRefreshableTransport(transport);
|
|
838550
838553
|
}).then(async (transportRef) => {
|
|
838551
838554
|
await setupTransport(transportRef.current);
|
|
838552
838555
|
return transportRef;
|
|
838553
838556
|
}).catch(onErrorDuringTransportSetup).then((transportRef) => {
|
|
838554
|
-
|
|
838557
|
+
tracer2.trace("Executing job", { hasTransport: !!transportRef, unsubscribed });
|
|
838555
838558
|
if (!transportRef.current)
|
|
838556
838559
|
return;
|
|
838557
838560
|
if (unsubscribed) {
|
|
838558
|
-
|
|
838561
|
+
tracer2.trace("Unsubscribed (2) while processing job");
|
|
838559
838562
|
return finalize4(transportRef.current, [resolveQueuedJob]);
|
|
838560
838563
|
}
|
|
838561
838564
|
sub = job2({ transportRef }).pipe(
|
|
838562
|
-
(0, import_operators49.catchError)((error) => initialErrorRemapping2(error,
|
|
838565
|
+
(0, import_operators49.catchError)((error) => initialErrorRemapping2(error, tracer2.getContext())),
|
|
838563
838566
|
(0, import_operators49.catchError)(errorRemapping2),
|
|
838564
838567
|
// close the transport and clean up everything
|
|
838565
838568
|
transportFinally2(() => {
|
|
@@ -838570,7 +838573,7 @@ var withTransport = (deviceId, options24) => {
|
|
|
838570
838573
|
subscriber.error(error);
|
|
838571
838574
|
});
|
|
838572
838575
|
return () => {
|
|
838573
|
-
|
|
838576
|
+
tracer2.trace(`Unsubscribing withDevice flow. Ongoing job to unsubscribe from ? ${!!sub}`);
|
|
838574
838577
|
unsubscribed = true;
|
|
838575
838578
|
if (sub)
|
|
838576
838579
|
sub.unsubscribe();
|
|
@@ -839063,8 +839066,8 @@ var LOG_TYPE5 = "device-sdk-command";
|
|
|
839063
839066
|
|
|
839064
839067
|
// ../../libs/ledger-live-common/lib-es/deviceSDK/commands/firmwareUpdate/installFirmware.js
|
|
839065
839068
|
function installFirmwareCommand(transport, { targetId, firmware }) {
|
|
839066
|
-
const
|
|
839067
|
-
|
|
839069
|
+
const tracer2 = new LocalTracer(LOG_TYPE5, { function: "installFirmwareCommand" });
|
|
839070
|
+
tracer2.trace("Starting", {
|
|
839068
839071
|
targetId,
|
|
839069
839072
|
osuFirmware: firmware
|
|
839070
839073
|
});
|
|
@@ -839080,9 +839083,9 @@ function installFirmwareCommand(transport, { targetId, firmware }) {
|
|
|
839080
839083
|
}
|
|
839081
839084
|
}),
|
|
839082
839085
|
unresponsiveExpectedDuringBulk: true,
|
|
839083
|
-
context:
|
|
839086
|
+
context: tracer2.getContext()
|
|
839084
839087
|
}).pipe((0, import_operators54.catchError)((error) => {
|
|
839085
|
-
|
|
839088
|
+
tracer2.trace("Socket firmware error", { error });
|
|
839086
839089
|
return remapSocketFirmwareError(error);
|
|
839087
839090
|
}), (0, import_operators54.filter)((e35) => {
|
|
839088
839091
|
return e35.type === "bulk-progress" || e35.type === "device-permission-requested";
|
|
@@ -839103,7 +839106,7 @@ function installFirmwareCommand(transport, { targetId, firmware }) {
|
|
|
839103
839106
|
}
|
|
839104
839107
|
return { type: "allowSecureChannelRequested" };
|
|
839105
839108
|
}), (0, import_operators54.catchError)((error) => {
|
|
839106
|
-
|
|
839109
|
+
tracer2.trace("Socket unresponsive error", { error });
|
|
839107
839110
|
return remapSocketUnresponsiveError(error);
|
|
839108
839111
|
}));
|
|
839109
839112
|
}
|
|
@@ -839142,8 +839145,8 @@ init_lib_es2();
|
|
|
839142
839145
|
var import_operators55 = require("rxjs/operators");
|
|
839143
839146
|
var filterProgressEvent = (e35) => e35.type === "bulk-progress";
|
|
839144
839147
|
function flashMcuOrBootloaderCommand(transport, { targetId, version: version19 }) {
|
|
839145
|
-
const
|
|
839146
|
-
|
|
839148
|
+
const tracer2 = new LocalTracer(LOG_TYPE5, { function: "flashMcuOrBootloaderCommand" });
|
|
839149
|
+
tracer2.trace("Starting", {
|
|
839147
839150
|
targetId,
|
|
839148
839151
|
version: version19
|
|
839149
839152
|
});
|
|
@@ -839156,7 +839159,7 @@ function flashMcuOrBootloaderCommand(transport, { targetId, version: version19 }
|
|
|
839156
839159
|
version: version19
|
|
839157
839160
|
}
|
|
839158
839161
|
}),
|
|
839159
|
-
context:
|
|
839162
|
+
context: tracer2.getContext()
|
|
839160
839163
|
}).pipe((0, import_operators55.filter)(filterProgressEvent), (0, import_operators55.map)((e35) => ({
|
|
839161
839164
|
type: "progress",
|
|
839162
839165
|
progress: e35.progress
|
|
@@ -839236,7 +839239,7 @@ function sharedLogicTaskWrapper(task, defaultTimeoutOverride) {
|
|
|
839236
839239
|
});
|
|
839237
839240
|
};
|
|
839238
839241
|
}
|
|
839239
|
-
var isDmkError = (error) => error && "_tag" in error;
|
|
839242
|
+
var isDmkError = (error) => !!error && typeof error === "object" && error !== null && "_tag" in error;
|
|
839240
839243
|
function retryOnErrorsCommandWrapper({ command: command4, allowedErrors, allowedDmkErrors = [] }) {
|
|
839241
839244
|
return (transportRef, argsWithoutTransport) => {
|
|
839242
839245
|
let sameErrorInARowCount = 0;
|
|
@@ -839376,12 +839379,12 @@ var waitForGetVersion = retryOnErrorsCommandWrapper({
|
|
|
839376
839379
|
]
|
|
839377
839380
|
});
|
|
839378
839381
|
function internalUpdateFirmwareTask({ deviceId, deviceName, updateContext }) {
|
|
839379
|
-
const
|
|
839382
|
+
const tracer2 = new LocalTracer(LOG_TYPE6, {
|
|
839380
839383
|
function: "updateFirmwareTask"
|
|
839381
839384
|
});
|
|
839382
839385
|
return new import_rxjs227.Observable((subscriber) => {
|
|
839383
839386
|
const sub = withTransport(deviceId, deviceName ? { matchDeviceByName: deviceName } : void 0)(({ transportRef }) => (0, import_rxjs227.concat)(quitApp(transportRef.current).pipe((0, import_operators60.switchMap)(() => {
|
|
839384
|
-
|
|
839387
|
+
tracer2.updateContext({ transportContext: transportRef.current.getTraceContext() });
|
|
839385
839388
|
return waitForGetVersion(transportRef, {});
|
|
839386
839389
|
}), (0, import_operators60.switchMap)((value2) => {
|
|
839387
839390
|
const { firmwareInfo } = value2;
|
|
@@ -839389,7 +839392,7 @@ function internalUpdateFirmwareTask({ deviceId, deviceName, updateContext }) {
|
|
|
839389
839392
|
firmwareInfo,
|
|
839390
839393
|
updateContext,
|
|
839391
839394
|
transport: transportRef.current,
|
|
839392
|
-
tracer
|
|
839395
|
+
tracer: tracer2
|
|
839393
839396
|
}).pipe((0, import_operators60.map)((e35) => {
|
|
839394
839397
|
if (e35.type === "unresponsive") {
|
|
839395
839398
|
return {
|
|
@@ -839407,15 +839410,15 @@ function internalUpdateFirmwareTask({ deviceId, deviceName, updateContext }) {
|
|
|
839407
839410
|
next: (event) => {
|
|
839408
839411
|
switch (event.type) {
|
|
839409
839412
|
case "allowSecureChannelRequested":
|
|
839410
|
-
|
|
839413
|
+
tracer2.trace("allowSecureChannelRequested");
|
|
839411
839414
|
subscriber.next(event);
|
|
839412
839415
|
break;
|
|
839413
839416
|
case "firmwareInstallPermissionRequested":
|
|
839414
|
-
|
|
839417
|
+
tracer2.trace("firmwareInstallPermissionRequested");
|
|
839415
839418
|
subscriber.next({ type: "installOsuDevicePermissionRequested" });
|
|
839416
839419
|
break;
|
|
839417
839420
|
case "firmwareInstallPermissionGranted":
|
|
839418
|
-
|
|
839421
|
+
tracer2.trace("firmwareInstallPermissionGranted");
|
|
839419
839422
|
subscriber.next({ type: "installOsuDevicePermissionGranted" });
|
|
839420
839423
|
break;
|
|
839421
839424
|
case "progress":
|
|
@@ -839430,7 +839433,7 @@ function internalUpdateFirmwareTask({ deviceId, deviceName, updateContext }) {
|
|
|
839430
839433
|
},
|
|
839431
839434
|
complete: () => subscriber.complete(),
|
|
839432
839435
|
error: (error) => {
|
|
839433
|
-
|
|
839436
|
+
tracer2.trace(`Error: ${error}`, { error });
|
|
839434
839437
|
if (error instanceof UserRefusedFirmwareUpdate) {
|
|
839435
839438
|
subscriber.next({ type: "installOsuDevicePermissionDenied" });
|
|
839436
839439
|
} else if (error instanceof UserRefusedAllowManager) {
|
|
@@ -839518,10 +839521,10 @@ var flashMcuOrBootloader = (updateContext, firmwareInfo, transportRef, deviceId,
|
|
|
839518
839521
|
});
|
|
839519
839522
|
});
|
|
839520
839523
|
};
|
|
839521
|
-
var installOsuFirmware = ({ transport, updateContext, firmwareInfo, tracer }) => {
|
|
839524
|
+
var installOsuFirmware = ({ transport, updateContext, firmwareInfo, tracer: tracer2 }) => {
|
|
839522
839525
|
const { targetId } = firmwareInfo;
|
|
839523
839526
|
const { osu } = updateContext;
|
|
839524
|
-
|
|
839527
|
+
tracer2.trace("Initiating osu firmware installation", { targetId, osu });
|
|
839525
839528
|
return installFirmwareCommand(transport, {
|
|
839526
839529
|
targetId,
|
|
839527
839530
|
firmware: osu
|
|
@@ -839757,17 +839760,17 @@ var FlagMasks;
|
|
|
839757
839760
|
FlagMasks2[FlagMasks2["ISSUE_TEMPERATURE"] = 32] = "ISSUE_TEMPERATURE";
|
|
839758
839761
|
})(FlagMasks || (FlagMasks = {}));
|
|
839759
839762
|
var getBatteryStatus = async (transport, statuses) => {
|
|
839760
|
-
const
|
|
839763
|
+
const tracer2 = new LocalTracer(LOG_TYPE, {
|
|
839761
839764
|
function: "getBatteryStatus",
|
|
839762
839765
|
statuses
|
|
839763
839766
|
});
|
|
839764
|
-
|
|
839767
|
+
tracer2.trace(`Starting`);
|
|
839765
839768
|
const result2 = [];
|
|
839766
839769
|
for (let i58 = 0; i58 < statuses.length; i58++) {
|
|
839767
839770
|
const res = await transport.send(224, 16, 0, statuses[i58]);
|
|
839768
839771
|
const status = res.readUInt16BE(res.length - 2);
|
|
839769
839772
|
if (status !== StatusCodes.OK) {
|
|
839770
|
-
|
|
839773
|
+
tracer2.trace(`Error: status ${status}`, { status, res });
|
|
839771
839774
|
throw new TransportStatusError(status);
|
|
839772
839775
|
}
|
|
839773
839776
|
switch (statuses[i58]) {
|
|
@@ -839991,11 +839994,11 @@ function toggleOnboardingEarlyCheckCmd({ transport, p2: p210 }) {
|
|
|
839991
839994
|
// ../../libs/ledger-live-common/lib-es/deviceSDK/tasks/toggleOnboardingEarlyCheck.js
|
|
839992
839995
|
init_lib_es();
|
|
839993
839996
|
function internalToggleOnboardingEarlyCheckTask({ deviceId, deviceName, toggleType }) {
|
|
839994
|
-
const
|
|
839997
|
+
const tracer2 = new LocalTracer(LOG_TYPE6, {
|
|
839995
839998
|
function: "toggleOnboardingEarlyCheckTask",
|
|
839996
839999
|
toggleType
|
|
839997
840000
|
});
|
|
839998
|
-
|
|
840001
|
+
tracer2.trace("Starting toggleOnboardingEarlyCheckTask");
|
|
839999
840002
|
const p210 = toggleType === "enter" ? ToggleTypeP2.EnterChecking : ToggleTypeP2.ExitChecking;
|
|
840000
840003
|
return new import_rxjs236.Observable((subscriber) => {
|
|
840001
840004
|
withTransport(deviceId, deviceName ? { matchDeviceByName: deviceName } : void 0)(({ transportRef }) => toggleOnboardingEarlyCheckCmd({
|
|
@@ -840005,7 +840008,7 @@ function internalToggleOnboardingEarlyCheckTask({ deviceId, deviceName, toggleTy
|
|
|
840005
840008
|
next: (_16) => subscriber.next({ type: "success" }),
|
|
840006
840009
|
error: (error) => {
|
|
840007
840010
|
if (error instanceof TransportStatusError) {
|
|
840008
|
-
|
|
840011
|
+
tracer2.trace("A TransportStatusError error occurred", { error });
|
|
840009
840012
|
if (error.statusCode === StatusCodes.SECURITY_STATUS_NOT_SATISFIED) {
|
|
840010
840013
|
subscriber.next({
|
|
840011
840014
|
type: "taskError",
|
|
@@ -840020,7 +840023,7 @@ function internalToggleOnboardingEarlyCheckTask({ deviceId, deviceName, toggleTy
|
|
|
840020
840023
|
return;
|
|
840021
840024
|
}
|
|
840022
840025
|
}
|
|
840023
|
-
|
|
840026
|
+
tracer2.trace("An unknown error occurred", { error });
|
|
840024
840027
|
subscriber.next({ type: "taskError", error: "Unknown" });
|
|
840025
840028
|
},
|
|
840026
840029
|
complete: () => subscriber.complete()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/live-cli",
|
|
3
|
-
"version": "24.28.0-nightly.
|
|
3
|
+
"version": "24.28.0-nightly.20251119110540",
|
|
4
4
|
"description": "ledger-live CLI version",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"tsup": "7.3.0",
|
|
60
60
|
"yaml": "2.8.1",
|
|
61
61
|
"@ledgerhq/types-cryptoassets": "^7.30.0",
|
|
62
|
-
"@ledgerhq/types-live": "^6.89.0-nightly.
|
|
62
|
+
"@ledgerhq/types-live": "^6.89.0-nightly.20251119110540"
|
|
63
63
|
},
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"directory": "dist"
|