@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.d.mts
CHANGED
|
@@ -206,10 +206,7 @@ type TrezorThpSessionOptions = {
|
|
|
206
206
|
* it back via `knownCredentials` on the next connect to skip pairing UX.
|
|
207
207
|
*/
|
|
208
208
|
onPairingCredentialsChanged?: (payload: {
|
|
209
|
-
/** This device's credentials only, never other devices'. */
|
|
210
209
|
credentials: TrezorThpCredentials[];
|
|
211
|
-
/** Credentials the device rejected; a host keeping one list for all devices drops these. */
|
|
212
|
-
removed?: TrezorThpCredentials[];
|
|
213
210
|
}) => Promise<void> | void;
|
|
214
211
|
logger?: TrezorDebugLogger;
|
|
215
212
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -206,10 +206,7 @@ type TrezorThpSessionOptions = {
|
|
|
206
206
|
* it back via `knownCredentials` on the next connect to skip pairing UX.
|
|
207
207
|
*/
|
|
208
208
|
onPairingCredentialsChanged?: (payload: {
|
|
209
|
-
/** This device's credentials only, never other devices'. */
|
|
210
209
|
credentials: TrezorThpCredentials[];
|
|
211
|
-
/** Credentials the device rejected; a host keeping one list for all devices drops these. */
|
|
212
|
-
removed?: TrezorThpCredentials[];
|
|
213
210
|
}) => Promise<void> | void;
|
|
214
211
|
logger?: TrezorDebugLogger;
|
|
215
212
|
};
|
package/dist/index.js
CHANGED
|
@@ -7901,7 +7901,6 @@ __export(messages_solana_pb_exports, {
|
|
|
7901
7901
|
SolanaGetAddressSchema: () => SolanaGetAddressSchema,
|
|
7902
7902
|
SolanaGetPublicKeySchema: () => SolanaGetPublicKeySchema,
|
|
7903
7903
|
SolanaMessageSignatureSchema: () => SolanaMessageSignatureSchema,
|
|
7904
|
-
SolanaOffchainMessageV1Schema: () => SolanaOffchainMessageV1Schema,
|
|
7905
7904
|
SolanaPublicKeySchema: () => SolanaPublicKeySchema,
|
|
7906
7905
|
SolanaSignMessageSchema: () => SolanaSignMessageSchema,
|
|
7907
7906
|
SolanaSignTxSchema: () => SolanaSignTxSchema,
|
|
@@ -7913,7 +7912,7 @@ __export(messages_solana_pb_exports, {
|
|
|
7913
7912
|
});
|
|
7914
7913
|
init_buffer();
|
|
7915
7914
|
var file_messages_solana = fileDesc(
|
|
7916
|
-
"
|
|
7915
|
+
"ChVtZXNzYWdlcy1zb2xhbmEucHJvdG8SGWh3LnRyZXpvci5tZXNzYWdlcy5zb2xhbmEiPQoSU29sYW5hR2V0UHVibGljS2V5EhEKCWFkZHJlc3NfbhgBIAMoDRIUCgxzaG93X2Rpc3BsYXkYAiABKAgiJQoPU29sYW5hUHVibGljS2V5EhIKCnB1YmxpY19rZXkYASACKAwiTQoQU29sYW5hR2V0QWRkcmVzcxIRCglhZGRyZXNzX24YASADKA0SFAoMc2hvd19kaXNwbGF5GAIgASgIEhAKCGNodW5raWZ5GAMgASgIIi0KDVNvbGFuYUFkZHJlc3MSDwoHYWRkcmVzcxgBIAIoCRILCgNtYWMYAiABKAwicgoYU29sYW5hVHhUb2tlbkFjY291bnRJbmZvEhQKDGJhc2VfYWRkcmVzcxgBIAIoCRIVCg10b2tlbl9wcm9ncmFtGAIgAigJEhIKCnRva2VuX21pbnQYAyACKAkSFQoNdG9rZW5fYWNjb3VudBgEIAIoCSKCAQoWU29sYW5hVHhBZGRpdGlvbmFsSW5mbxJRChR0b2tlbl9hY2NvdW50c19pbmZvcxgBIAMoCzIzLmh3LnRyZXpvci5tZXNzYWdlcy5zb2xhbmEuU29sYW5hVHhUb2tlbkFjY291bnRJbmZvEhUKDWVuY29kZWRfdG9rZW4YAiABKAwi1gEKDFNvbGFuYVNpZ25UeBIRCglhZGRyZXNzX24YASADKA0SFQoNc2VyaWFsaXplZF90eBgCIAIoDBJKCg9hZGRpdGlvbmFsX2luZm8YAyABKAsyMS5ody50cmV6b3IubWVzc2FnZXMuc29sYW5hLlNvbGFuYVR4QWRkaXRpb25hbEluZm8SPgoLcGF5bWVudF9yZXEYBCABKAsyKS5ody50cmV6b3IubWVzc2FnZXMuY29tbW9uLlBheW1lbnRSZXF1ZXN0EhAKCGNodW5raWZ5GAUgASgIIiYKEVNvbGFuYVR4U2lnbmF0dXJlEhEKCXNpZ25hdHVyZRgBIAIoDCJJChFTb2xhbmFTaWduTWVzc2FnZRIRCglhZGRyZXNzX24YASADKA0SDwoHbWVzc2FnZRgCIAIoDBIQCghjaHVua2lmeRgDIAEoCCIrChZTb2xhbmFNZXNzYWdlU2lnbmF0dXJlEhEKCXNpZ25hdHVyZRgBIAIoDCI5ChNTb2xhbmFWZXJpZnlNZXNzYWdlEhAKCGVudmVsb3BlGAEgAigMEhAKCGNodW5raWZ5GAIgASgIQjoKI2NvbS5zYXRvc2hpbGFicy50cmV6b3IubGliLnByb3RvYnVmQhNUcmV6b3JNZXNzYWdlU29sYW5h",
|
|
7917
7916
|
[file_messages_common]
|
|
7918
7917
|
);
|
|
7919
7918
|
var SolanaGetPublicKeySchema = messageDesc(file_messages_solana, 0);
|
|
@@ -7924,10 +7923,9 @@ var SolanaTxTokenAccountInfoSchema = messageDesc(file_messages_solana, 4);
|
|
|
7924
7923
|
var SolanaTxAdditionalInfoSchema = messageDesc(file_messages_solana, 5);
|
|
7925
7924
|
var SolanaSignTxSchema = messageDesc(file_messages_solana, 6);
|
|
7926
7925
|
var SolanaTxSignatureSchema = messageDesc(file_messages_solana, 7);
|
|
7927
|
-
var
|
|
7928
|
-
var
|
|
7929
|
-
var
|
|
7930
|
-
var SolanaVerifyMessageSchema = messageDesc(file_messages_solana, 11);
|
|
7926
|
+
var SolanaSignMessageSchema = messageDesc(file_messages_solana, 8);
|
|
7927
|
+
var SolanaMessageSignatureSchema = messageDesc(file_messages_solana, 9);
|
|
7928
|
+
var SolanaVerifyMessageSchema = messageDesc(file_messages_solana, 10);
|
|
7931
7929
|
|
|
7932
7930
|
// ../hwk-trezor-protobuf/src/definitions/messages-stellar_pb.js
|
|
7933
7931
|
var messages_stellar_pb_exports = {};
|
|
@@ -12001,9 +11999,6 @@ var normalizeCreateAppSessionOptions = (options = {}) => {
|
|
|
12001
11999
|
passphraseMode
|
|
12002
12000
|
};
|
|
12003
12001
|
};
|
|
12004
|
-
function thpPairingRefused(message) {
|
|
12005
|
-
return Object.assign(new Error(message), { code: "ThpPairingFailed" });
|
|
12006
|
-
}
|
|
12007
12002
|
var TrezorDeviceSession = class {
|
|
12008
12003
|
transport;
|
|
12009
12004
|
connectionType;
|
|
@@ -12087,11 +12082,6 @@ var TrezorDeviceSession = class {
|
|
|
12087
12082
|
this.log("error", "session.initialize.error", { error: errorToLog(error2) });
|
|
12088
12083
|
throw error2;
|
|
12089
12084
|
}
|
|
12090
|
-
if (this.connectionType === "ble" && this.currentFeatures?.bootloader_mode !== true) {
|
|
12091
|
-
this.core = void 0;
|
|
12092
|
-
this.currentFeatures = void 0;
|
|
12093
|
-
throw thpPairingRefused("Trezor Bluetooth requires the encrypted THP protocol");
|
|
12094
|
-
}
|
|
12095
12085
|
this.log("info", "session.initialize.done", {
|
|
12096
12086
|
protocol: this.protocol,
|
|
12097
12087
|
features: summarizeFeatures(this.currentFeatures)
|
|
@@ -12259,36 +12249,6 @@ var TrezorDeviceSession = class {
|
|
|
12259
12249
|
const response = await this.core.call("Initialize", {});
|
|
12260
12250
|
this.currentFeatures = expectMessage(response, "Features").message;
|
|
12261
12251
|
this.thpAppSessionActive = false;
|
|
12262
|
-
if (passphraseMode === "empty" && this.currentFeatures?.passphrase_protection == null) {
|
|
12263
|
-
expectMessage(
|
|
12264
|
-
await this.call("GetAddress", {
|
|
12265
|
-
address_n: [2147483692, 2147483649, 2147483648, 0, 0],
|
|
12266
|
-
coin_name: "Testnet",
|
|
12267
|
-
script_type: "SPENDADDRESS",
|
|
12268
|
-
show_display: false
|
|
12269
|
-
}),
|
|
12270
|
-
"Address"
|
|
12271
|
-
);
|
|
12272
|
-
expectMessage(await this.call("GetFeatures", {}), "Features");
|
|
12273
|
-
if (this.currentFeatures?.passphrase_protection == null) {
|
|
12274
|
-
throw new TrezorFailureError({
|
|
12275
|
-
type: "Failure",
|
|
12276
|
-
message: {
|
|
12277
|
-
code: "Failure_DataError",
|
|
12278
|
-
message: "Empty passphrase cannot be enforced: device did not report its passphrase setting"
|
|
12279
|
-
}
|
|
12280
|
-
});
|
|
12281
|
-
}
|
|
12282
|
-
}
|
|
12283
|
-
if (passphraseMode === "empty" && this.currentFeatures?.passphrase_protection === true && this.currentFeatures?.passphrase_always_on_device === true) {
|
|
12284
|
-
throw new TrezorFailureError({
|
|
12285
|
-
type: "Failure",
|
|
12286
|
-
message: {
|
|
12287
|
-
code: "Failure_DataError",
|
|
12288
|
-
message: "Empty passphrase cannot be enforced with PASSPHRASE_ALWAYS_ON_DEVICE enabled"
|
|
12289
|
-
}
|
|
12290
|
-
});
|
|
12291
|
-
}
|
|
12292
12252
|
this.log("info", "v1.appSession.create.done", {
|
|
12293
12253
|
features: summarizeFeatures(this.currentFeatures)
|
|
12294
12254
|
});
|
|
@@ -12416,8 +12376,7 @@ var TrezorThpSession = class {
|
|
|
12416
12376
|
}
|
|
12417
12377
|
const pairingMethods = getPairingMethods(
|
|
12418
12378
|
properties.pairing_methods,
|
|
12419
|
-
|
|
12420
|
-
this.options.pairingMethods ?? ["CodeEntry", "QrCode", "NFC"]
|
|
12379
|
+
this.options.pairingMethods ?? ["CodeEntry", "QrCode", "NFC", "SkipPairing"]
|
|
12421
12380
|
);
|
|
12422
12381
|
if (pairingMethods.length === 0) {
|
|
12423
12382
|
throw new Error("No compatible THP pairing method");
|
|
@@ -12484,16 +12443,12 @@ var TrezorThpSession = class {
|
|
|
12484
12443
|
"ThpHandshakeCompletionResponse"
|
|
12485
12444
|
);
|
|
12486
12445
|
const completionState = completion.message.state;
|
|
12487
|
-
if (completionState !== 0 && !handshakeCredentials.credentials) {
|
|
12488
|
-
throw thpPairingRefused("Trezor reported a pairing that no stored credential confirms");
|
|
12489
|
-
}
|
|
12490
12446
|
this.thpState.setIsPaired(completionState !== 0);
|
|
12491
12447
|
this.thpState.setPhase("pairing");
|
|
12492
12448
|
if (!completionState && handshakeCredentials.credentials) {
|
|
12493
12449
|
this.thpState.removePairingCredential(handshakeCredentials.credentials);
|
|
12494
12450
|
await this.options.onPairingCredentialsChanged?.({
|
|
12495
|
-
credentials: this.thpState.pairingCredentials
|
|
12496
|
-
removed: [handshakeCredentials.credentials]
|
|
12451
|
+
credentials: this.thpState.pairingCredentials
|
|
12497
12452
|
});
|
|
12498
12453
|
}
|
|
12499
12454
|
this.log("info", "thp.handshake.done", {
|
|
@@ -12527,9 +12482,6 @@ var TrezorThpSession = class {
|
|
|
12527
12482
|
selected_pairing_method: selectedMethod
|
|
12528
12483
|
});
|
|
12529
12484
|
if (selectMethod.type === "ThpEndResponse") {
|
|
12530
|
-
if (selectedMethod !== protocol_thp_exports.ThpPairingMethod.SkipPairing) {
|
|
12531
|
-
throw thpPairingRefused("Trezor ended pairing without completing the selected method");
|
|
12532
|
-
}
|
|
12533
12485
|
this.thpState.setIsPaired(true);
|
|
12534
12486
|
this.thpState.setPhase("paired");
|
|
12535
12487
|
this.log("info", "thp.pair.done", { responseType: selectMethod.type });
|