@onekeyfe/hwk-trezor-connector 1.2.3-alpha.8 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +63 -95
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -55
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -44,6 +44,12 @@ declare abstract class TrezorConnectorBase implements IConnector {
|
|
|
44
44
|
* the change too — we mutate, not replace.
|
|
45
45
|
*/
|
|
46
46
|
setKnownCredentials(credentials: TrezorThpCredentials[]): void;
|
|
47
|
+
/**
|
|
48
|
+
* Push new credentials minted during pairing into the in-memory array.
|
|
49
|
+
* Deduplicates by the device-minted `credential` blob — the host has no
|
|
50
|
+
* other stable identity for a credential.
|
|
51
|
+
*/
|
|
52
|
+
private mergeKnownCredentials;
|
|
47
53
|
protected abstract enumerateDevices(): Promise<ConnectorDevice[]>;
|
|
48
54
|
protected abstract createByteTransport(device: ConnectorDevice): Promise<TrezorConnectorByteTransport>;
|
|
49
55
|
protected resolveUnlistedDevice(_deviceId: string): ConnectorDevice | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -44,6 +44,12 @@ declare abstract class TrezorConnectorBase implements IConnector {
|
|
|
44
44
|
* the change too — we mutate, not replace.
|
|
45
45
|
*/
|
|
46
46
|
setKnownCredentials(credentials: TrezorThpCredentials[]): void;
|
|
47
|
+
/**
|
|
48
|
+
* Push new credentials minted during pairing into the in-memory array.
|
|
49
|
+
* Deduplicates by the device-minted `credential` blob — the host has no
|
|
50
|
+
* other stable identity for a credential.
|
|
51
|
+
*/
|
|
52
|
+
private mergeKnownCredentials;
|
|
47
53
|
protected abstract enumerateDevices(): Promise<ConnectorDevice[]>;
|
|
48
54
|
protected abstract createByteTransport(device: ConnectorDevice): Promise<TrezorConnectorByteTransport>;
|
|
49
55
|
protected resolveUnlistedDevice(_deviceId: string): ConnectorDevice | undefined;
|
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ __export(index_exports, {
|
|
|
26
26
|
shouldLogTrezorDebugEntry: () => import_hwk_trezor_core2.shouldLogTrezorDebugEntry
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(index_exports);
|
|
29
|
-
var
|
|
29
|
+
var import_hwk_adapter_core2 = require("@onekeyfe/hwk-adapter-core");
|
|
30
30
|
var import_hwk_trezor_core = require("@onekeyfe/hwk-trezor-core");
|
|
31
31
|
|
|
32
32
|
// src/chains/utils.ts
|
|
@@ -2666,7 +2666,6 @@ function normalizeEthMessage(message, isHex) {
|
|
|
2666
2666
|
}
|
|
2667
2667
|
|
|
2668
2668
|
// src/chains/sol.ts
|
|
2669
|
-
var import_hwk_adapter_core2 = require("@onekeyfe/hwk-adapter-core");
|
|
2670
2669
|
async function solGetAddress(ctx, params) {
|
|
2671
2670
|
const request = readSolGetAddressParams(params);
|
|
2672
2671
|
const response = await ctx.deviceSession.call("SolanaGetAddress", {
|
|
@@ -2713,37 +2712,10 @@ async function solSignTransaction(ctx, params) {
|
|
|
2713
2712
|
}
|
|
2714
2713
|
return { signature };
|
|
2715
2714
|
}
|
|
2716
|
-
async function solSignMessage(
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
"Trezor supports finalized Solana off-chain message version 1 only"
|
|
2721
|
-
);
|
|
2722
|
-
}
|
|
2723
|
-
const preparedMessage = (0, import_hwk_adapter_core2.prepareSolanaOffchainMessageV1)({
|
|
2724
|
-
message: (0, import_hwk_adapter_core2.hexToBytes)(request.message),
|
|
2725
|
-
requiredSigners: request.requiredSigners
|
|
2726
|
-
});
|
|
2727
|
-
const response = await ctx.deviceSession.call("SolanaSignMessage", {
|
|
2728
|
-
address_n: parseBip32Path(request.path),
|
|
2729
|
-
message: {
|
|
2730
|
-
message: preparedMessage.messageText,
|
|
2731
|
-
signers: preparedMessage.requiredSigners
|
|
2732
|
-
}
|
|
2733
|
-
});
|
|
2734
|
-
if (response.type !== "SolanaMessageSignature") {
|
|
2735
|
-
throw new Error(`Expected SolanaMessageSignature response, received ${response.type}`);
|
|
2736
|
-
}
|
|
2737
|
-
const signature = readString(response.message, "signature");
|
|
2738
|
-
if (!signature) {
|
|
2739
|
-
throw new Error("SolanaMessageSignature response did not include a signature");
|
|
2740
|
-
}
|
|
2741
|
-
const signedData = readString(response.message, "signed_data");
|
|
2742
|
-
const expectedSignedData = (0, import_hwk_adapter_core2.bytesToHex)(preparedMessage.serializedMessage);
|
|
2743
|
-
if (!signedData || stripHexPrefix2(signedData).toLowerCase() !== expectedSignedData) {
|
|
2744
|
-
throw new Error("Trezor signed data does not match the requested Solana off-chain message");
|
|
2745
|
-
}
|
|
2746
|
-
return { signature: stripHexPrefix2(signature).toLowerCase() };
|
|
2715
|
+
async function solSignMessage(_ctx, _params) {
|
|
2716
|
+
throw createMethodNotSupportedError(
|
|
2717
|
+
"Trezor firmware does not support Solana message signing \u2014 only solSignTransaction is available"
|
|
2718
|
+
);
|
|
2747
2719
|
}
|
|
2748
2720
|
function readSolGetAddressParams(params) {
|
|
2749
2721
|
if (!params || typeof params !== "object") {
|
|
@@ -2774,25 +2746,6 @@ function readSolSignTxParams(params) {
|
|
|
2774
2746
|
assertHexString("serializedTx", serializedTx);
|
|
2775
2747
|
return params;
|
|
2776
2748
|
}
|
|
2777
|
-
function readSolSignMsgParams(params) {
|
|
2778
|
-
if (!params || typeof params !== "object") {
|
|
2779
|
-
throw createInvalidParamsError("solSignMessage params must be an object");
|
|
2780
|
-
}
|
|
2781
|
-
const request = params;
|
|
2782
|
-
if (typeof request.path !== "string" || request.path.trim().length === 0) {
|
|
2783
|
-
throw createInvalidParamsError("solSignMessage requires a non-empty path");
|
|
2784
|
-
}
|
|
2785
|
-
if (typeof request.message !== "string" || request.message.length === 0) {
|
|
2786
|
-
throw createInvalidParamsError("solSignMessage requires message as a hex string");
|
|
2787
|
-
}
|
|
2788
|
-
assertHexString("message", request.message);
|
|
2789
|
-
if (request.messageVersion === 1 && !Array.isArray(request.requiredSigners)) {
|
|
2790
|
-
throw createInvalidParamsError(
|
|
2791
|
-
"Solana off-chain message version 1 requires signer public keys"
|
|
2792
|
-
);
|
|
2793
|
-
}
|
|
2794
|
-
return request;
|
|
2795
|
-
}
|
|
2796
2749
|
function stripHexPrefix2(value) {
|
|
2797
2750
|
return value.startsWith("0x") || value.startsWith("0X") ? value.slice(2) : value;
|
|
2798
2751
|
}
|
|
@@ -7715,8 +7668,8 @@ var REQUIRED_DEVICE_CAPABILITIES = {
|
|
|
7715
7668
|
function normalizePassphraseMode(passphraseMode) {
|
|
7716
7669
|
if (passphraseMode === void 0) return "prompt";
|
|
7717
7670
|
if (passphraseMode === "prompt" || passphraseMode === "empty") return passphraseMode;
|
|
7718
|
-
throw (0,
|
|
7719
|
-
code:
|
|
7671
|
+
throw (0, import_hwk_adapter_core2.createHwkError)({
|
|
7672
|
+
code: import_hwk_adapter_core2.HardwareErrorCode.InvalidParams,
|
|
7720
7673
|
message: `Invalid Trezor passphrase mode: ${String(passphraseMode)}`
|
|
7721
7674
|
});
|
|
7722
7675
|
}
|
|
@@ -7732,8 +7685,8 @@ var MAX_AUTHENTICITY_PROOF_PART_SIZE = 64 * 1024;
|
|
|
7732
7685
|
var MAX_AUTHENTICITY_CERTIFICATE_COUNT = 4;
|
|
7733
7686
|
var validateAuthenticityProofPartSize = (size) => {
|
|
7734
7687
|
if (typeof size !== "number" || !Number.isSafeInteger(size) || size < 0 || size > MAX_AUTHENTICITY_PROOF_PART_SIZE) {
|
|
7735
|
-
throw (0,
|
|
7736
|
-
code:
|
|
7688
|
+
throw (0, import_hwk_adapter_core2.createHwkError)({
|
|
7689
|
+
code: import_hwk_adapter_core2.HardwareErrorCode.UnknownError,
|
|
7737
7690
|
message: `Invalid Trezor authenticity proof part size: ${String(size)}`
|
|
7738
7691
|
});
|
|
7739
7692
|
}
|
|
@@ -7761,15 +7714,15 @@ var readAuthenticityProofPart = async ({
|
|
|
7761
7714
|
request
|
|
7762
7715
|
);
|
|
7763
7716
|
if (response.type !== "AuthenticityProofChunk") {
|
|
7764
|
-
throw (0,
|
|
7765
|
-
code:
|
|
7717
|
+
throw (0, import_hwk_adapter_core2.createHwkError)({
|
|
7718
|
+
code: import_hwk_adapter_core2.HardwareErrorCode.UnknownError,
|
|
7766
7719
|
message: `Expected AuthenticityProofChunk, received ${response.type}`
|
|
7767
7720
|
});
|
|
7768
7721
|
}
|
|
7769
7722
|
const chunk = response.message?.chunk;
|
|
7770
7723
|
if (typeof chunk !== "string" || chunk.length !== requestedSize * 2) {
|
|
7771
|
-
throw (0,
|
|
7772
|
-
code:
|
|
7724
|
+
throw (0, import_hwk_adapter_core2.createHwkError)({
|
|
7725
|
+
code: import_hwk_adapter_core2.HardwareErrorCode.UnknownError,
|
|
7773
7726
|
message: "Trezor returned an invalid authenticity proof chunk"
|
|
7774
7727
|
});
|
|
7775
7728
|
}
|
|
@@ -7781,14 +7734,14 @@ var readAuthenticityProofPart = async ({
|
|
|
7781
7734
|
var readAuthenticityProofStream = async (deviceSession, sizes) => {
|
|
7782
7735
|
const readCertificates = async (proofType, values) => {
|
|
7783
7736
|
if (!Array.isArray(values)) {
|
|
7784
|
-
throw (0,
|
|
7785
|
-
code:
|
|
7737
|
+
throw (0, import_hwk_adapter_core2.createHwkError)({
|
|
7738
|
+
code: import_hwk_adapter_core2.HardwareErrorCode.UnknownError,
|
|
7786
7739
|
message: "Trezor returned invalid authenticity certificate sizes"
|
|
7787
7740
|
});
|
|
7788
7741
|
}
|
|
7789
7742
|
if (values.length > MAX_AUTHENTICITY_CERTIFICATE_COUNT) {
|
|
7790
|
-
throw (0,
|
|
7791
|
-
code:
|
|
7743
|
+
throw (0, import_hwk_adapter_core2.createHwkError)({
|
|
7744
|
+
code: import_hwk_adapter_core2.HardwareErrorCode.UnknownError,
|
|
7792
7745
|
message: `Trezor authenticity proof contains too many certificates: ${values.length}`
|
|
7793
7746
|
});
|
|
7794
7747
|
}
|
|
@@ -7837,13 +7790,13 @@ var TrezorConnectorBase = class {
|
|
|
7837
7790
|
chunkSize;
|
|
7838
7791
|
thp;
|
|
7839
7792
|
// Single owned array — passed by reference into every TrezorThpSession via
|
|
7840
|
-
// `createThpOptions`.
|
|
7841
|
-
//
|
|
7842
|
-
// without a connector rebuild.
|
|
7793
|
+
// `createThpOptions`. setKnownCredentials() and the auto-merge inside
|
|
7794
|
+
// onPairingCredentialsChanged both mutate this array in-place so the next
|
|
7795
|
+
// handshake sees fresh credentials without a connector rebuild.
|
|
7843
7796
|
knownCredentials = [];
|
|
7844
7797
|
deviceSessionFactory;
|
|
7845
7798
|
eventHandlers = /* @__PURE__ */ new Map();
|
|
7846
|
-
uiRequests = new
|
|
7799
|
+
uiRequests = new import_hwk_adapter_core2.UiRequestRegistry();
|
|
7847
7800
|
devices = /* @__PURE__ */ new Map();
|
|
7848
7801
|
sessions = /* @__PURE__ */ new Map();
|
|
7849
7802
|
constructor(options = {}) {
|
|
@@ -7876,6 +7829,21 @@ var TrezorConnectorBase = class {
|
|
|
7876
7829
|
this.knownCredentials.push(...credentials);
|
|
7877
7830
|
}
|
|
7878
7831
|
}
|
|
7832
|
+
/**
|
|
7833
|
+
* Push new credentials minted during pairing into the in-memory array.
|
|
7834
|
+
* Deduplicates by the device-minted `credential` blob — the host has no
|
|
7835
|
+
* other stable identity for a credential.
|
|
7836
|
+
*/
|
|
7837
|
+
mergeKnownCredentials(incoming) {
|
|
7838
|
+
for (const cred of incoming) {
|
|
7839
|
+
const blob = cred.credential;
|
|
7840
|
+
if (!blob) continue;
|
|
7841
|
+
const exists2 = this.knownCredentials.some(
|
|
7842
|
+
(existing) => existing.credential === blob
|
|
7843
|
+
);
|
|
7844
|
+
if (!exists2) this.knownCredentials.push(cred);
|
|
7845
|
+
}
|
|
7846
|
+
}
|
|
7879
7847
|
resolveUnlistedDevice(_deviceId) {
|
|
7880
7848
|
return void 0;
|
|
7881
7849
|
}
|
|
@@ -8011,14 +7979,14 @@ var TrezorConnectorBase = class {
|
|
|
8011
7979
|
durationMs: Date.now() - startedAt,
|
|
8012
7980
|
error: errorToLog(error)
|
|
8013
7981
|
});
|
|
8014
|
-
return { success: false, error: (0,
|
|
7982
|
+
return { success: false, error: (0, import_hwk_adapter_core2.serializeConnectorError)(error) };
|
|
8015
7983
|
}
|
|
8016
7984
|
}
|
|
8017
7985
|
async dispatchCall(sessionId, method, params) {
|
|
8018
7986
|
const session = this.sessions.get(sessionId);
|
|
8019
7987
|
if (!session) {
|
|
8020
|
-
throw (0,
|
|
8021
|
-
code:
|
|
7988
|
+
throw (0, import_hwk_adapter_core2.createHwkError)({
|
|
7989
|
+
code: import_hwk_adapter_core2.HardwareErrorCode.DeviceNotFound,
|
|
8022
7990
|
message: `Trezor session not found: ${sessionId}`
|
|
8023
7991
|
});
|
|
8024
7992
|
}
|
|
@@ -8071,8 +8039,8 @@ var TrezorConnectorBase = class {
|
|
|
8071
8039
|
return getTrezorResponseMessage(response);
|
|
8072
8040
|
}
|
|
8073
8041
|
if (response.type !== "AuthenticityProofSizes") {
|
|
8074
|
-
throw (0,
|
|
8075
|
-
code:
|
|
8042
|
+
throw (0, import_hwk_adapter_core2.createHwkError)({
|
|
8043
|
+
code: import_hwk_adapter_core2.HardwareErrorCode.UnknownError,
|
|
8076
8044
|
message: `Expected Trezor authenticity proof, received ${response.type}`
|
|
8077
8045
|
});
|
|
8078
8046
|
}
|
|
@@ -8104,8 +8072,8 @@ var TrezorConnectorBase = class {
|
|
|
8104
8072
|
}
|
|
8105
8073
|
const p = params ?? {};
|
|
8106
8074
|
if (!p.thpSessionId) {
|
|
8107
|
-
throw (0,
|
|
8108
|
-
code:
|
|
8075
|
+
throw (0, import_hwk_adapter_core2.createHwkError)({
|
|
8076
|
+
code: import_hwk_adapter_core2.HardwareErrorCode.InvalidParams,
|
|
8109
8077
|
message: "__thpSelectSession requires a thpSessionId"
|
|
8110
8078
|
});
|
|
8111
8079
|
}
|
|
@@ -8150,8 +8118,8 @@ var TrezorConnectorBase = class {
|
|
|
8150
8118
|
case "tronSignMessage":
|
|
8151
8119
|
return tronSignMessage(ctx, params);
|
|
8152
8120
|
default:
|
|
8153
|
-
throw (0,
|
|
8154
|
-
code:
|
|
8121
|
+
throw (0, import_hwk_adapter_core2.createHwkError)({
|
|
8122
|
+
code: import_hwk_adapter_core2.HardwareErrorCode.MethodNotSupported,
|
|
8155
8123
|
message: `TrezorConnector: method "${method}" is not implemented`
|
|
8156
8124
|
});
|
|
8157
8125
|
}
|
|
@@ -8175,8 +8143,8 @@ var TrezorConnectorBase = class {
|
|
|
8175
8143
|
};
|
|
8176
8144
|
this.log(hasAllRequired ? "info" : "warn", "capability.check", checkPayload);
|
|
8177
8145
|
if (hasAllRequired) return;
|
|
8178
|
-
throw (0,
|
|
8179
|
-
code:
|
|
8146
|
+
throw (0, import_hwk_adapter_core2.createHwkError)({
|
|
8147
|
+
code: import_hwk_adapter_core2.HardwareErrorCode.MethodNotSupported,
|
|
8180
8148
|
message: `Trezor device is missing required capability for ${method}: ${required.map((capability) => capability.name).join(", ")}`,
|
|
8181
8149
|
params: {
|
|
8182
8150
|
method,
|
|
@@ -8188,7 +8156,7 @@ var TrezorConnectorBase = class {
|
|
|
8188
8156
|
async cancel(_sessionId) {
|
|
8189
8157
|
}
|
|
8190
8158
|
uiResponse(_response) {
|
|
8191
|
-
if (_response.type ===
|
|
8159
|
+
if (_response.type === import_hwk_adapter_core2.UI_RESPONSE.CANCEL) {
|
|
8192
8160
|
this.uiRequests.cancel();
|
|
8193
8161
|
return;
|
|
8194
8162
|
}
|
|
@@ -8234,8 +8202,8 @@ var TrezorConnectorBase = class {
|
|
|
8234
8202
|
return device;
|
|
8235
8203
|
}
|
|
8236
8204
|
if (!device) {
|
|
8237
|
-
throw (0,
|
|
8238
|
-
code:
|
|
8205
|
+
throw (0, import_hwk_adapter_core2.createHwkError)({
|
|
8206
|
+
code: import_hwk_adapter_core2.HardwareErrorCode.DeviceNotFound,
|
|
8239
8207
|
message: deviceId ? `Trezor device not found: ${deviceId}` : "No Trezor device found"
|
|
8240
8208
|
});
|
|
8241
8209
|
}
|
|
@@ -8254,7 +8222,7 @@ var TrezorConnectorBase = class {
|
|
|
8254
8222
|
return this.thp.onPairingRequest(payload);
|
|
8255
8223
|
}
|
|
8256
8224
|
this.emit("ui-request", {
|
|
8257
|
-
type:
|
|
8225
|
+
type: import_hwk_adapter_core2.UI_REQUEST.REQUEST_TREZOR_THP_PAIRING,
|
|
8258
8226
|
payload: {
|
|
8259
8227
|
connectId: device.connectId,
|
|
8260
8228
|
availableMethods: payload.availableMethods,
|
|
@@ -8262,12 +8230,12 @@ var TrezorConnectorBase = class {
|
|
|
8262
8230
|
nfcData: payload.nfcData
|
|
8263
8231
|
}
|
|
8264
8232
|
});
|
|
8265
|
-
return this.uiRequests.wait(
|
|
8233
|
+
return this.uiRequests.wait(import_hwk_adapter_core2.UI_REQUEST.REQUEST_TREZOR_THP_PAIRING);
|
|
8266
8234
|
},
|
|
8267
8235
|
onButtonRequest: async (payload) => {
|
|
8268
8236
|
await this.thp?.onButtonRequest?.(payload);
|
|
8269
8237
|
this.emit("ui-request", {
|
|
8270
|
-
type:
|
|
8238
|
+
type: import_hwk_adapter_core2.UI_REQUEST.REQUEST_BUTTON,
|
|
8271
8239
|
payload: {
|
|
8272
8240
|
connectId: device.connectId,
|
|
8273
8241
|
...payload
|
|
@@ -8277,7 +8245,7 @@ var TrezorConnectorBase = class {
|
|
|
8277
8245
|
onButtonRequestComplete: async (payload) => {
|
|
8278
8246
|
await this.thp?.onButtonRequestComplete?.(payload);
|
|
8279
8247
|
this.emit("ui-event", {
|
|
8280
|
-
type:
|
|
8248
|
+
type: import_hwk_adapter_core2.EConnectorInteraction.InteractionComplete,
|
|
8281
8249
|
payload: {
|
|
8282
8250
|
sessionId: device.connectId
|
|
8283
8251
|
}
|
|
@@ -8287,9 +8255,9 @@ var TrezorConnectorBase = class {
|
|
|
8287
8255
|
if (this.thp?.onPinMatrixRequest) {
|
|
8288
8256
|
return this.thp.onPinMatrixRequest(payload);
|
|
8289
8257
|
}
|
|
8290
|
-
const pinPromise = this.uiRequests.wait(
|
|
8258
|
+
const pinPromise = this.uiRequests.wait(import_hwk_adapter_core2.UI_REQUEST.REQUEST_PIN);
|
|
8291
8259
|
this.emit("ui-request", {
|
|
8292
|
-
type:
|
|
8260
|
+
type: import_hwk_adapter_core2.UI_REQUEST.REQUEST_PIN,
|
|
8293
8261
|
payload: {
|
|
8294
8262
|
connectId: device.connectId,
|
|
8295
8263
|
type: payload.type
|
|
@@ -8301,9 +8269,9 @@ var TrezorConnectorBase = class {
|
|
|
8301
8269
|
if (this.thp?.onPassphraseRequest) {
|
|
8302
8270
|
return this.thp.onPassphraseRequest(payload);
|
|
8303
8271
|
}
|
|
8304
|
-
const passphrasePromise = this.uiRequests.wait(
|
|
8272
|
+
const passphrasePromise = this.uiRequests.wait(import_hwk_adapter_core2.UI_REQUEST.REQUEST_PASSPHRASE);
|
|
8305
8273
|
this.emit("ui-request", {
|
|
8306
|
-
type:
|
|
8274
|
+
type: import_hwk_adapter_core2.UI_REQUEST.REQUEST_PASSPHRASE,
|
|
8307
8275
|
payload: {
|
|
8308
8276
|
connectId: device.connectId,
|
|
8309
8277
|
...payload
|
|
@@ -8313,7 +8281,7 @@ var TrezorConnectorBase = class {
|
|
|
8313
8281
|
return res?.passphraseOnDevice ? { on_device: true } : { passphrase: res?.value ?? "" };
|
|
8314
8282
|
},
|
|
8315
8283
|
onPairingCredentialsChanged: async (payload) => {
|
|
8316
|
-
this.
|
|
8284
|
+
this.mergeKnownCredentials(payload.credentials);
|
|
8317
8285
|
await this.thp?.onPairingCredentialsChanged?.(payload);
|
|
8318
8286
|
this.emit("device-trezor-thp-credentials-changed", {
|
|
8319
8287
|
connectId: device.connectId,
|
|
@@ -8334,7 +8302,7 @@ var TrezorConnectorBase = class {
|
|
|
8334
8302
|
emitSupportFeatures(session) {
|
|
8335
8303
|
const features = session.deviceSession.features ?? session.features;
|
|
8336
8304
|
session.features = features;
|
|
8337
|
-
this.emit(
|
|
8305
|
+
this.emit(import_hwk_adapter_core2.DEVICE.FEATURES, {
|
|
8338
8306
|
device: {
|
|
8339
8307
|
...session.device,
|
|
8340
8308
|
deviceId: readString(features, "device_id") ?? session.device.deviceId,
|
|
@@ -8357,9 +8325,9 @@ function connectorSessionToDevice(session) {
|
|
|
8357
8325
|
};
|
|
8358
8326
|
}
|
|
8359
8327
|
function rejectKnownNonTrezorDevice(features) {
|
|
8360
|
-
if (!(0,
|
|
8361
|
-
throw (0,
|
|
8362
|
-
code:
|
|
8328
|
+
if (!(0, import_hwk_adapter_core2.isKnownNonTargetHardwareVendor)(features, "trezor")) return;
|
|
8329
|
+
throw (0, import_hwk_adapter_core2.createHwkError)({
|
|
8330
|
+
code: import_hwk_adapter_core2.HardwareErrorCode.DeviceMismatch,
|
|
8363
8331
|
message: "Selected device is not a supported Trezor device.",
|
|
8364
8332
|
params: {
|
|
8365
8333
|
vendor: features.vendor,
|