@onekeyfe/hwk-keystone-adapter 1.2.3-alpha.2 → 1.2.3-alpha.4
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 +14 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1398,7 +1398,9 @@ var KeystoneAdapter = class _KeystoneAdapter {
|
|
|
1398
1398
|
if (!params) return failure(HardwareErrorCode.InvalidParams, "btcSignPsbt requires params");
|
|
1399
1399
|
if (!params.psbt)
|
|
1400
1400
|
return failure(HardwareErrorCode.InvalidParams, "btcSignPsbt requires params.psbt");
|
|
1401
|
-
if (
|
|
1401
|
+
if (!params.path)
|
|
1402
|
+
return failure(HardwareErrorCode.InvalidParams, "btcSignPsbt requires params.path");
|
|
1403
|
+
if (!isKeystoneSignableBtcAccountPath(splitAccountPath(params.path).accountPath)) {
|
|
1402
1404
|
return failure(HardwareErrorCode.DevicePathForbidden, KEYSTONE_BTC_ACCOUNT_FORBIDDEN_MESSAGE);
|
|
1403
1405
|
}
|
|
1404
1406
|
try {
|
|
@@ -1596,10 +1598,11 @@ var KeystoneAdapter = class _KeystoneAdapter {
|
|
|
1596
1598
|
}
|
|
1597
1599
|
// ---------------------------------------------------------------------------
|
|
1598
1600
|
// TRON — routed through `TronSignRequest`/`TronSignature` (see
|
|
1599
|
-
// urEngine/TronSignRequest.ts),
|
|
1600
|
-
//
|
|
1601
|
-
//
|
|
1602
|
-
// unverified response
|
|
1601
|
+
// urEngine/TronSignRequest.ts), whose key layout follows keystone-sdk-rust
|
|
1602
|
+
// (tags 5201/5202, firmware >= 2.5.0). The OneKey Pro air-gap encoding under
|
|
1603
|
+
// the same tag is a different layout the firmware rejects. Not keystone-sdk's
|
|
1604
|
+
// bundled `sdk.tron` module either (protobuf-based, unverified response
|
|
1605
|
+
// semantics).
|
|
1603
1606
|
// ---------------------------------------------------------------------------
|
|
1604
1607
|
async tronGetAddress(connectIdArg, deviceIdArg, paramsArg, book) {
|
|
1605
1608
|
const operationTarget = resolveHardwareOperationTarget(connectIdArg, paramsArg?.operationId);
|
|
@@ -1788,14 +1791,17 @@ var KeystoneAdapter = class _KeystoneAdapter {
|
|
|
1788
1791
|
if (!requestedByKey.size) {
|
|
1789
1792
|
return { book };
|
|
1790
1793
|
}
|
|
1791
|
-
|
|
1794
|
+
const operation = isHardwareOperationId(params.operationId) ? this._operations.find(params.operationId) : void 0;
|
|
1795
|
+
const operationRoute = operation ? this._operationRoutes.get(operation.connectId) : void 0;
|
|
1796
|
+
const routedToQr = operationRoute?.operationId === operation?.operationId && operationRoute?.connectionType === "qr";
|
|
1797
|
+
if (this._forcedTransport !== "qr" && !routedToQr && !record?.usbSessionId && this._usbConnector && target.expectedWalletId) {
|
|
1792
1798
|
record = await this._tryUsbAttach(
|
|
1793
1799
|
target.expectedWalletId,
|
|
1794
1800
|
record?.masterFingerprint ?? target.expectedMasterFingerprint
|
|
1795
1801
|
) ?? record;
|
|
1796
1802
|
_KeystoneAdapter._throwIfAborted(signal);
|
|
1797
1803
|
}
|
|
1798
|
-
if (this._forcedTransport !== "qr" && record?.usbSessionId) {
|
|
1804
|
+
if (this._forcedTransport !== "qr" && !routedToQr && record?.usbSessionId) {
|
|
1799
1805
|
const bundleSessionId = record.usbSessionId;
|
|
1800
1806
|
const assertBundleSession = () => {
|
|
1801
1807
|
if (record?.usbSessionId !== bundleSessionId) {
|
|
@@ -2516,7 +2522,7 @@ var KeystoneAdapter = class _KeystoneAdapter {
|
|
|
2516
2522
|
_errorToFailure(err) {
|
|
2517
2523
|
if (err && typeof err === "object") {
|
|
2518
2524
|
const e = err;
|
|
2519
|
-
if (typeof e.code === "number") {
|
|
2525
|
+
if (typeof e.code === "number" && e.code >= 1e4 && e.code <= 99999) {
|
|
2520
2526
|
const { origin } = e;
|
|
2521
2527
|
return failure(
|
|
2522
2528
|
e.code,
|