@onekeyfe/hwk-trezor-core 1.2.8-alpha.13 → 1.2.8-alpha.14
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 +6 -54
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -54
- 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 = {};
|
|
@@ -11986,9 +11984,6 @@ var normalizeCreateAppSessionOptions = (options = {}) => {
|
|
|
11986
11984
|
passphraseMode
|
|
11987
11985
|
};
|
|
11988
11986
|
};
|
|
11989
|
-
function thpPairingRefused(message) {
|
|
11990
|
-
return Object.assign(new Error(message), { code: "ThpPairingFailed" });
|
|
11991
|
-
}
|
|
11992
11987
|
var TrezorDeviceSession = class {
|
|
11993
11988
|
transport;
|
|
11994
11989
|
connectionType;
|
|
@@ -12072,11 +12067,6 @@ var TrezorDeviceSession = class {
|
|
|
12072
12067
|
this.log("error", "session.initialize.error", { error: errorToLog(error2) });
|
|
12073
12068
|
throw error2;
|
|
12074
12069
|
}
|
|
12075
|
-
if (this.connectionType === "ble" && this.currentFeatures?.bootloader_mode !== true) {
|
|
12076
|
-
this.core = void 0;
|
|
12077
|
-
this.currentFeatures = void 0;
|
|
12078
|
-
throw thpPairingRefused("Trezor Bluetooth requires the encrypted THP protocol");
|
|
12079
|
-
}
|
|
12080
12070
|
this.log("info", "session.initialize.done", {
|
|
12081
12071
|
protocol: this.protocol,
|
|
12082
12072
|
features: summarizeFeatures(this.currentFeatures)
|
|
@@ -12244,36 +12234,6 @@ var TrezorDeviceSession = class {
|
|
|
12244
12234
|
const response = await this.core.call("Initialize", {});
|
|
12245
12235
|
this.currentFeatures = expectMessage(response, "Features").message;
|
|
12246
12236
|
this.thpAppSessionActive = false;
|
|
12247
|
-
if (passphraseMode === "empty" && this.currentFeatures?.passphrase_protection == null) {
|
|
12248
|
-
expectMessage(
|
|
12249
|
-
await this.call("GetAddress", {
|
|
12250
|
-
address_n: [2147483692, 2147483649, 2147483648, 0, 0],
|
|
12251
|
-
coin_name: "Testnet",
|
|
12252
|
-
script_type: "SPENDADDRESS",
|
|
12253
|
-
show_display: false
|
|
12254
|
-
}),
|
|
12255
|
-
"Address"
|
|
12256
|
-
);
|
|
12257
|
-
expectMessage(await this.call("GetFeatures", {}), "Features");
|
|
12258
|
-
if (this.currentFeatures?.passphrase_protection == null) {
|
|
12259
|
-
throw new TrezorFailureError({
|
|
12260
|
-
type: "Failure",
|
|
12261
|
-
message: {
|
|
12262
|
-
code: "Failure_DataError",
|
|
12263
|
-
message: "Empty passphrase cannot be enforced: device did not report its passphrase setting"
|
|
12264
|
-
}
|
|
12265
|
-
});
|
|
12266
|
-
}
|
|
12267
|
-
}
|
|
12268
|
-
if (passphraseMode === "empty" && this.currentFeatures?.passphrase_protection === true && this.currentFeatures?.passphrase_always_on_device === true) {
|
|
12269
|
-
throw new TrezorFailureError({
|
|
12270
|
-
type: "Failure",
|
|
12271
|
-
message: {
|
|
12272
|
-
code: "Failure_DataError",
|
|
12273
|
-
message: "Empty passphrase cannot be enforced with PASSPHRASE_ALWAYS_ON_DEVICE enabled"
|
|
12274
|
-
}
|
|
12275
|
-
});
|
|
12276
|
-
}
|
|
12277
12237
|
this.log("info", "v1.appSession.create.done", {
|
|
12278
12238
|
features: summarizeFeatures(this.currentFeatures)
|
|
12279
12239
|
});
|
|
@@ -12401,8 +12361,7 @@ var TrezorThpSession = class {
|
|
|
12401
12361
|
}
|
|
12402
12362
|
const pairingMethods = getPairingMethods(
|
|
12403
12363
|
properties.pairing_methods,
|
|
12404
|
-
|
|
12405
|
-
this.options.pairingMethods ?? ["CodeEntry", "QrCode", "NFC"]
|
|
12364
|
+
this.options.pairingMethods ?? ["CodeEntry", "QrCode", "NFC", "SkipPairing"]
|
|
12406
12365
|
);
|
|
12407
12366
|
if (pairingMethods.length === 0) {
|
|
12408
12367
|
throw new Error("No compatible THP pairing method");
|
|
@@ -12469,16 +12428,12 @@ var TrezorThpSession = class {
|
|
|
12469
12428
|
"ThpHandshakeCompletionResponse"
|
|
12470
12429
|
);
|
|
12471
12430
|
const completionState = completion.message.state;
|
|
12472
|
-
if (completionState !== 0 && !handshakeCredentials.credentials) {
|
|
12473
|
-
throw thpPairingRefused("Trezor reported a pairing that no stored credential confirms");
|
|
12474
|
-
}
|
|
12475
12431
|
this.thpState.setIsPaired(completionState !== 0);
|
|
12476
12432
|
this.thpState.setPhase("pairing");
|
|
12477
12433
|
if (!completionState && handshakeCredentials.credentials) {
|
|
12478
12434
|
this.thpState.removePairingCredential(handshakeCredentials.credentials);
|
|
12479
12435
|
await this.options.onPairingCredentialsChanged?.({
|
|
12480
|
-
credentials: this.thpState.pairingCredentials
|
|
12481
|
-
removed: [handshakeCredentials.credentials]
|
|
12436
|
+
credentials: this.thpState.pairingCredentials
|
|
12482
12437
|
});
|
|
12483
12438
|
}
|
|
12484
12439
|
this.log("info", "thp.handshake.done", {
|
|
@@ -12512,9 +12467,6 @@ var TrezorThpSession = class {
|
|
|
12512
12467
|
selected_pairing_method: selectedMethod
|
|
12513
12468
|
});
|
|
12514
12469
|
if (selectMethod.type === "ThpEndResponse") {
|
|
12515
|
-
if (selectedMethod !== protocol_thp_exports.ThpPairingMethod.SkipPairing) {
|
|
12516
|
-
throw thpPairingRefused("Trezor ended pairing without completing the selected method");
|
|
12517
|
-
}
|
|
12518
12470
|
this.thpState.setIsPaired(true);
|
|
12519
12471
|
this.thpState.setPhase("paired");
|
|
12520
12472
|
this.log("info", "thp.pair.done", { responseType: selectMethod.type });
|