@onekeyfe/hwk-trezor-core 1.2.8-alpha.50 → 1.2.8-alpha.51
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 +0 -3
- package/dist/index.d.ts +0 -3
- package/dist/index.js +7 -56
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -56
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -7886,7 +7886,6 @@ __export(messages_solana_pb_exports, {
|
|
|
7886
7886
|
SolanaGetAddressSchema: () => SolanaGetAddressSchema,
|
|
7887
7887
|
SolanaGetPublicKeySchema: () => SolanaGetPublicKeySchema,
|
|
7888
7888
|
SolanaMessageSignatureSchema: () => SolanaMessageSignatureSchema,
|
|
7889
|
-
SolanaOffchainMessageV1Schema: () => SolanaOffchainMessageV1Schema,
|
|
7890
7889
|
SolanaPublicKeySchema: () => SolanaPublicKeySchema,
|
|
7891
7890
|
SolanaSignMessageSchema: () => SolanaSignMessageSchema,
|
|
7892
7891
|
SolanaSignTxSchema: () => SolanaSignTxSchema,
|
|
@@ -7898,7 +7897,7 @@ __export(messages_solana_pb_exports, {
|
|
|
7898
7897
|
});
|
|
7899
7898
|
init_buffer();
|
|
7900
7899
|
var file_messages_solana = fileDesc(
|
|
7901
|
-
"
|
|
7900
|
+
"ChVtZXNzYWdlcy1zb2xhbmEucHJvdG8SGWh3LnRyZXpvci5tZXNzYWdlcy5zb2xhbmEiPQoSU29sYW5hR2V0UHVibGljS2V5EhEKCWFkZHJlc3NfbhgBIAMoDRIUCgxzaG93X2Rpc3BsYXkYAiABKAgiJQoPU29sYW5hUHVibGljS2V5EhIKCnB1YmxpY19rZXkYASACKAwiTQoQU29sYW5hR2V0QWRkcmVzcxIRCglhZGRyZXNzX24YASADKA0SFAoMc2hvd19kaXNwbGF5GAIgASgIEhAKCGNodW5raWZ5GAMgASgIIi0KDVNvbGFuYUFkZHJlc3MSD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PublicKeySchema = messageDesc(file_messages_solana, 0);
|
|
@@ -7909,10 +7908,9 @@ var SolanaTxTokenAccountInfoSchema = messageDesc(file_messages_solana, 4);
|
|
|
7909
7908
|
var SolanaTxAdditionalInfoSchema = messageDesc(file_messages_solana, 5);
|
|
7910
7909
|
var SolanaSignTxSchema = messageDesc(file_messages_solana, 6);
|
|
7911
7910
|
var SolanaTxSignatureSchema = messageDesc(file_messages_solana, 7);
|
|
7912
|
-
var
|
|
7913
|
-
var
|
|
7914
|
-
var
|
|
7915
|
-
var SolanaVerifyMessageSchema = messageDesc(file_messages_solana, 11);
|
|
7911
|
+
var SolanaSignMessageSchema = messageDesc(file_messages_solana, 8);
|
|
7912
|
+
var SolanaMessageSignatureSchema = messageDesc(file_messages_solana, 9);
|
|
7913
|
+
var SolanaVerifyMessageSchema = messageDesc(file_messages_solana, 10);
|
|
7916
7914
|
|
|
7917
7915
|
// ../hwk-trezor-protobuf/src/definitions/messages-stellar_pb.js
|
|
7918
7916
|
var messages_stellar_pb_exports = {};
|
|
@@ -11261,8 +11259,7 @@ async function receive(receiver, protocol) {
|
|
|
11261
11259
|
} catch (e) {
|
|
11262
11260
|
console.warn("Protocol decode failed", {
|
|
11263
11261
|
error: e.message,
|
|
11264
|
-
|
|
11265
|
-
payloadHead: readResult.payload.subarray(0, 2).toString("hex")
|
|
11262
|
+
payload: readResult.payload.toString("hex")
|
|
11266
11263
|
});
|
|
11267
11264
|
return error({ code: PROTOCOL_MALFORMED, message: e.message });
|
|
11268
11265
|
}
|
|
@@ -11987,9 +11984,6 @@ var normalizeCreateAppSessionOptions = (options = {}) => {
|
|
|
11987
11984
|
passphraseMode
|
|
11988
11985
|
};
|
|
11989
11986
|
};
|
|
11990
|
-
function thpPairingRefused(message) {
|
|
11991
|
-
return Object.assign(new Error(message), { code: "ThpPairingFailed" });
|
|
11992
|
-
}
|
|
11993
11987
|
var TrezorDeviceSession = class {
|
|
11994
11988
|
transport;
|
|
11995
11989
|
connectionType;
|
|
@@ -12073,11 +12067,6 @@ var TrezorDeviceSession = class {
|
|
|
12073
12067
|
this.log("error", "session.initialize.error", { error: errorToLog(error2) });
|
|
12074
12068
|
throw error2;
|
|
12075
12069
|
}
|
|
12076
|
-
if (this.connectionType === "ble" && this.currentFeatures?.bootloader_mode !== true) {
|
|
12077
|
-
this.core = void 0;
|
|
12078
|
-
this.currentFeatures = void 0;
|
|
12079
|
-
throw thpPairingRefused("Trezor Bluetooth requires the encrypted THP protocol");
|
|
12080
|
-
}
|
|
12081
12070
|
this.log("info", "session.initialize.done", {
|
|
12082
12071
|
protocol: this.protocol,
|
|
12083
12072
|
features: summarizeFeatures(this.currentFeatures)
|
|
@@ -12245,36 +12234,6 @@ var TrezorDeviceSession = class {
|
|
|
12245
12234
|
const response = await this.core.call("Initialize", {});
|
|
12246
12235
|
this.currentFeatures = expectMessage(response, "Features").message;
|
|
12247
12236
|
this.thpAppSessionActive = false;
|
|
12248
|
-
if (passphraseMode === "empty" && this.currentFeatures?.passphrase_protection == null) {
|
|
12249
|
-
expectMessage(
|
|
12250
|
-
await this.call("GetAddress", {
|
|
12251
|
-
address_n: [2147483692, 2147483649, 2147483648, 0, 0],
|
|
12252
|
-
coin_name: "Testnet",
|
|
12253
|
-
script_type: "SPENDADDRESS",
|
|
12254
|
-
show_display: false
|
|
12255
|
-
}),
|
|
12256
|
-
"Address"
|
|
12257
|
-
);
|
|
12258
|
-
expectMessage(await this.call("GetFeatures", {}), "Features");
|
|
12259
|
-
if (this.currentFeatures?.passphrase_protection == null) {
|
|
12260
|
-
throw new TrezorFailureError({
|
|
12261
|
-
type: "Failure",
|
|
12262
|
-
message: {
|
|
12263
|
-
code: "Failure_DataError",
|
|
12264
|
-
message: "Empty passphrase cannot be enforced: device did not report its passphrase setting"
|
|
12265
|
-
}
|
|
12266
|
-
});
|
|
12267
|
-
}
|
|
12268
|
-
}
|
|
12269
|
-
if (passphraseMode === "empty" && this.currentFeatures?.passphrase_protection === true && this.currentFeatures?.passphrase_always_on_device === true) {
|
|
12270
|
-
throw new TrezorFailureError({
|
|
12271
|
-
type: "Failure",
|
|
12272
|
-
message: {
|
|
12273
|
-
code: "Failure_DataError",
|
|
12274
|
-
message: "Empty passphrase cannot be enforced with PASSPHRASE_ALWAYS_ON_DEVICE enabled"
|
|
12275
|
-
}
|
|
12276
|
-
});
|
|
12277
|
-
}
|
|
12278
12237
|
this.log("info", "v1.appSession.create.done", {
|
|
12279
12238
|
features: summarizeFeatures(this.currentFeatures)
|
|
12280
12239
|
});
|
|
@@ -12402,8 +12361,7 @@ var TrezorThpSession = class {
|
|
|
12402
12361
|
}
|
|
12403
12362
|
const pairingMethods = getPairingMethods(
|
|
12404
12363
|
properties.pairing_methods,
|
|
12405
|
-
|
|
12406
|
-
this.options.pairingMethods ?? ["CodeEntry", "QrCode", "NFC"]
|
|
12364
|
+
this.options.pairingMethods ?? ["CodeEntry", "QrCode", "NFC", "SkipPairing"]
|
|
12407
12365
|
);
|
|
12408
12366
|
if (pairingMethods.length === 0) {
|
|
12409
12367
|
throw new Error("No compatible THP pairing method");
|
|
@@ -12470,16 +12428,12 @@ var TrezorThpSession = class {
|
|
|
12470
12428
|
"ThpHandshakeCompletionResponse"
|
|
12471
12429
|
);
|
|
12472
12430
|
const completionState = completion.message.state;
|
|
12473
|
-
if (completionState !== 0 && !handshakeCredentials.credentials) {
|
|
12474
|
-
throw thpPairingRefused("Trezor reported a pairing that no stored credential confirms");
|
|
12475
|
-
}
|
|
12476
12431
|
this.thpState.setIsPaired(completionState !== 0);
|
|
12477
12432
|
this.thpState.setPhase("pairing");
|
|
12478
12433
|
if (!completionState && handshakeCredentials.credentials) {
|
|
12479
12434
|
this.thpState.removePairingCredential(handshakeCredentials.credentials);
|
|
12480
12435
|
await this.options.onPairingCredentialsChanged?.({
|
|
12481
|
-
credentials: this.thpState.pairingCredentials
|
|
12482
|
-
removed: [handshakeCredentials.credentials]
|
|
12436
|
+
credentials: this.thpState.pairingCredentials
|
|
12483
12437
|
});
|
|
12484
12438
|
}
|
|
12485
12439
|
this.log("info", "thp.handshake.done", {
|
|
@@ -12513,9 +12467,6 @@ var TrezorThpSession = class {
|
|
|
12513
12467
|
selected_pairing_method: selectedMethod
|
|
12514
12468
|
});
|
|
12515
12469
|
if (selectMethod.type === "ThpEndResponse") {
|
|
12516
|
-
if (selectedMethod !== protocol_thp_exports.ThpPairingMethod.SkipPairing) {
|
|
12517
|
-
throw thpPairingRefused("Trezor ended pairing without completing the selected method");
|
|
12518
|
-
}
|
|
12519
12470
|
this.thpState.setIsPaired(true);
|
|
12520
12471
|
this.thpState.setPhase("paired");
|
|
12521
12472
|
this.log("info", "thp.pair.done", { responseType: selectMethod.type });
|