@onekeyfe/hwk-keystone-adapter 1.2.8-alpha.124 → 1.2.8-alpha.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1932,9 +1932,20 @@ var KeystoneAdapter = class _KeystoneAdapter {
|
|
|
1932
1932
|
message: "Account export contains an invalid derivation path"
|
|
1933
1933
|
});
|
|
1934
1934
|
}
|
|
1935
|
-
|
|
1935
|
+
const usableSchemas = schemas.filter(
|
|
1936
|
+
(schema) => !firmware || firmware.supportedChains.includes(schema.hwkChain)
|
|
1937
|
+
);
|
|
1938
|
+
const isColdStart = !target.expectedMasterFingerprint;
|
|
1939
|
+
if (firmware && isColdStart && !responseUr.accountExport && !usableSchemas.length) {
|
|
1940
|
+
throw (0, import_hwk_adapter_core3.createHwkError)({
|
|
1941
|
+
code: import_hwk_adapter_core3.HardwareErrorCode.ChainNotSupported,
|
|
1942
|
+
message: `Keystone ${firmware.variant} firmware cannot use any requested chain`,
|
|
1943
|
+
params: { firmwareVariant: firmware.variant }
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1946
|
+
for (const schema of usableSchemas) {
|
|
1936
1947
|
const exported = responseUr.accountExport ? parsed.accounts.find((account) => normalizePath(account.path) === schema.path) : requireExportedPath(parsed, schema.path);
|
|
1937
|
-
if (exported
|
|
1948
|
+
if (exported) {
|
|
1938
1949
|
scanned.set(accountKey(schema.hwkChain, schema.path), {
|
|
1939
1950
|
...exported,
|
|
1940
1951
|
hwkChain: schema.hwkChain
|
|
@@ -2374,13 +2385,13 @@ var KeystoneAdapter = class _KeystoneAdapter {
|
|
|
2374
2385
|
params: { reason: "account-not-exported" }
|
|
2375
2386
|
});
|
|
2376
2387
|
}
|
|
2388
|
+
this._assertQrChainSupported(bundle.firmwareVersion, hwkChain);
|
|
2377
2389
|
if (!target.record || !scanned) {
|
|
2378
2390
|
throw (0, import_hwk_adapter_core3.createHwkError)({
|
|
2379
2391
|
code: import_hwk_adapter_core3.HardwareErrorCode.DeviceMismatch,
|
|
2380
2392
|
message: `Keystone did not return the requested derivation path (${syncPath})`
|
|
2381
2393
|
});
|
|
2382
2394
|
}
|
|
2383
|
-
this._assertQrChainSupported(bundle.firmwareVersion, hwkChain);
|
|
2384
2395
|
return { record: target.record, account: scanned };
|
|
2385
2396
|
}
|
|
2386
2397
|
if (bundle?.channel === "usb" && target.record?.usbSessionId !== bundle.usbSessionId) {
|
|
@@ -2443,7 +2454,7 @@ var KeystoneAdapter = class _KeystoneAdapter {
|
|
|
2443
2454
|
const responseUr = await this._resolveUr(void 0, requestUr, false, connectId, signal);
|
|
2444
2455
|
_KeystoneAdapter._throwIfAborted(signal);
|
|
2445
2456
|
const parsed = responseUr.accountExport ? this.urEngine.parseAccountExport(responseUr) : this.urEngine.parseAccountResponse(responseUr);
|
|
2446
|
-
requireExportedPath(parsed, normalizePath(accountPath)
|
|
2457
|
+
if (!responseUr.accountExport) requireExportedPath(parsed, normalizePath(accountPath));
|
|
2447
2458
|
this._assertQrChainSupported(parsed.deviceVersion, chain);
|
|
2448
2459
|
const record = this._upsertDeviceRecord(parsed);
|
|
2449
2460
|
return { record };
|