@trezor/connect 9.2.2 → 9.2.4-beta.1
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/CHANGELOG.md +102 -0
- package/README.md +1 -1
- package/lib/api/applyFlags.d.ts +8 -1
- package/lib/api/applyFlags.js +3 -8
- package/lib/api/applySettings.d.ts +8 -1
- package/lib/api/applySettings.js +3 -8
- package/lib/api/backupDevice.d.ts +10 -2
- package/lib/api/backupDevice.js +12 -9
- package/lib/api/binance/api/binanceGetAddress.d.ts +4 -3
- package/lib/api/binance/api/binanceGetAddress.js +8 -22
- package/lib/api/binance/api/binanceGetPublicKey.d.ts +4 -2
- package/lib/api/binance/api/binanceGetPublicKey.js +6 -18
- package/lib/api/blockchainDisconnect.d.ts +1 -0
- package/lib/api/blockchainDisconnect.js +3 -4
- package/lib/api/blockchainEstimateFee.d.ts +1 -0
- package/lib/api/blockchainEstimateFee.js +6 -4
- package/lib/api/blockchainGetAccountBalanceHistory.d.ts +1 -0
- package/lib/api/blockchainGetAccountBalanceHistory.js +3 -1
- package/lib/api/blockchainGetCurrentFiatRates.d.ts +1 -0
- package/lib/api/blockchainGetCurrentFiatRates.js +3 -1
- package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +1 -0
- package/lib/api/blockchainGetFiatRatesForTimestamps.js +3 -1
- package/lib/api/blockchainGetTransactions.d.ts +1 -0
- package/lib/api/blockchainGetTransactions.js +3 -1
- package/lib/api/blockchainSetCustomBackend.js +1 -5
- package/lib/api/blockchainSubscribe.d.ts +2 -0
- package/lib/api/blockchainSubscribe.js +13 -2
- package/lib/api/blockchainSubscribeFiatRates.d.ts +1 -0
- package/lib/api/blockchainSubscribeFiatRates.js +3 -1
- package/lib/api/blockchainUnsubscribe.d.ts +1 -0
- package/lib/api/blockchainUnsubscribe.js +5 -2
- package/lib/api/blockchainUnsubscribeFiatRates.d.ts +1 -0
- package/lib/api/blockchainUnsubscribeFiatRates.js +6 -2
- package/lib/api/cardano/api/cardanoGetAddress.d.ts +4 -3
- package/lib/api/cardano/api/cardanoGetAddress.js +8 -22
- package/lib/api/cardano/api/cardanoGetPublicKey.d.ts +4 -3
- package/lib/api/cardano/api/cardanoGetPublicKey.js +9 -31
- package/lib/api/changeLanguage.d.ts +8 -2
- package/lib/api/changeLanguage.js +10 -51
- package/lib/api/composeTransaction.d.ts +2 -0
- package/lib/api/composeTransaction.js +10 -5
- package/lib/api/eos/api/eosGetPublicKey.d.ts +4 -2
- package/lib/api/eos/api/eosGetPublicKey.js +6 -18
- package/lib/api/eos/eosSignTx.d.ts +3 -3
- package/lib/api/ethereum/api/ethereumGetAddress.d.ts +4 -3
- package/lib/api/ethereum/api/ethereumGetAddress.js +4 -20
- package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +4 -2
- package/lib/api/ethereum/api/ethereumGetPublicKey.js +3 -10
- package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +2 -1
- package/lib/api/ethereum/ethereumDefinitions.js +1 -0
- package/lib/api/firmware/index.d.ts +2 -0
- package/lib/api/firmware/index.js +5 -1
- package/lib/api/firmware/parseFirmwareHeaders.d.ts +5 -0
- package/lib/api/firmware/parseFirmwareHeaders.js +35 -0
- package/lib/api/firmware/uploadFirmware.d.ts +1 -1
- package/lib/api/firmware/uploadFirmware.js +9 -1
- package/lib/api/getAccountDescriptor.d.ts +5 -3
- package/lib/api/getAccountDescriptor.js +8 -21
- package/lib/api/getAccountInfo.d.ts +23 -7
- package/lib/api/getAccountInfo.js +16 -28
- package/lib/api/getAddress.d.ts +4 -3
- package/lib/api/getAddress.js +8 -22
- package/lib/api/getCoinInfo.d.ts +3 -0
- package/lib/api/getFeatures.d.ts +1 -0
- package/lib/api/getOwnershipId.d.ts +4 -2
- package/lib/api/getOwnershipId.js +4 -15
- package/lib/api/getOwnershipProof.d.ts +4 -2
- package/lib/api/getOwnershipProof.js +4 -15
- package/lib/api/getPublicKey.d.ts +5 -4
- package/lib/api/getPublicKey.js +12 -35
- package/lib/api/index.d.ts +0 -1
- package/lib/api/index.js +1 -3
- package/lib/api/nem/api/nemGetAddress.d.ts +4 -3
- package/lib/api/nem/api/nemGetAddress.js +4 -20
- package/lib/api/pushTransaction.d.ts +1 -0
- package/lib/api/pushTransaction.js +2 -1
- package/lib/api/rebootToBootloader.d.ts +8 -2
- package/lib/api/rebootToBootloader.js +3 -10
- package/lib/api/recoveryDevice.d.ts +8 -1
- package/lib/api/recoveryDevice.js +3 -7
- package/lib/api/resetDevice.d.ts +5 -3
- package/lib/api/resetDevice.js +5 -12
- package/lib/api/ripple/api/rippleGetAddress.d.ts +4 -3
- package/lib/api/ripple/api/rippleGetAddress.js +4 -20
- package/lib/api/signTransaction.d.ts +1 -0
- package/lib/api/signTransaction.js +5 -3
- package/lib/api/solana/api/solanaGetAddress.d.ts +4 -3
- package/lib/api/solana/api/solanaGetAddress.js +7 -28
- package/lib/api/solana/api/solanaGetPublicKey.d.ts +4 -3
- package/lib/api/solana/api/solanaGetPublicKey.js +7 -27
- package/lib/api/stellar/api/stellarGetAddress.d.ts +4 -3
- package/lib/api/stellar/api/stellarGetAddress.js +4 -20
- package/lib/api/tezos/api/tezosGetAddress.d.ts +4 -3
- package/lib/api/tezos/api/tezosGetAddress.js +4 -20
- package/lib/api/tezos/api/tezosGetPublicKey.d.ts +4 -2
- package/lib/api/tezos/api/tezosGetPublicKey.js +6 -18
- package/lib/api/wipeDevice.d.ts +8 -2
- package/lib/api/wipeDevice.js +3 -10
- package/lib/backend/BackendManager.d.ts +6 -4
- package/lib/backend/BackendManager.js +36 -28
- package/lib/backend/Blockchain.d.ts +15 -4
- package/lib/backend/Blockchain.js +27 -17
- package/lib/backend/BlockchainLink.d.ts +3 -3
- package/lib/backend/BlockchainLink.js +3 -3
- package/lib/constants/errors.d.ts +1 -0
- package/lib/constants/errors.js +1 -0
- package/lib/core/AbstractMethod.d.ts +4 -8
- package/lib/core/AbstractMethod.js +7 -28
- package/lib/core/index.d.ts +2 -1
- package/lib/core/index.js +260 -231
- package/lib/core/onCallFirmwareUpdate.d.ts +31 -0
- package/lib/core/onCallFirmwareUpdate.js +259 -0
- package/lib/data/DataManager.d.ts +22 -0
- package/lib/data/DataManager.js +7 -3
- package/lib/data/analyticsInfo.d.ts +2 -2
- package/lib/data/analyticsInfo.js +6 -7
- package/lib/data/coinInfo.d.ts +14 -0
- package/lib/data/config.d.ts +22 -0
- package/lib/data/config.js +5 -1
- package/lib/data/connectSettings.js +3 -0
- package/lib/data/deviceAuthenticityConfig.d.ts +9 -0
- package/lib/data/deviceAuthenticityConfig.js +27 -3
- package/lib/data/firmwareInfo.js +2 -6
- package/lib/data/getLanguage.d.ts +6 -0
- package/lib/data/getLanguage.js +10 -0
- package/lib/data/models.d.ts +9 -0
- package/lib/data/models.js +9 -0
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +13 -2
- package/lib/device/Device.js +55 -7
- package/lib/device/DeviceCommands.d.ts +3 -15
- package/lib/device/DeviceCommands.js +1 -43
- package/lib/device/DeviceList.d.ts +1 -1
- package/lib/device/DeviceList.js +22 -19
- package/lib/events/blockchain.d.ts +3 -0
- package/lib/events/index.d.ts +1 -0
- package/lib/events/ui-request.d.ts +13 -1
- package/lib/events/ui-request.js +1 -0
- package/lib/index.js +2 -2
- package/lib/types/api/authenticateDevice.d.ts +9 -0
- package/lib/types/api/backupDevice.d.ts +2 -2
- package/lib/types/api/bitcoin/index.d.ts +1 -0
- package/lib/types/api/blockchainSetCustomBackend.d.ts +3 -2
- package/lib/types/api/blockchainSubscribe.d.ts +1 -0
- package/lib/types/api/composeTransaction.d.ts +2 -0
- package/lib/types/api/dispose.d.ts +1 -1
- package/lib/types/api/firmwareUpdate.d.ts +7 -6
- package/lib/types/api/firmwareUpdate.js +1 -3
- package/lib/types/api/getAccountInfo.d.ts +1 -0
- package/lib/types/api/getCoinInfo.d.ts +4 -2
- package/lib/types/api/nemGetAddress.d.ts +11 -4
- package/lib/types/api/nemGetAddress.js +9 -0
- package/lib/types/api/pushTransaction.d.ts +1 -0
- package/lib/types/api/pushTransaction.js +1 -0
- package/lib/types/api/resetDevice.d.ts +1 -15
- package/lib/types/api/resetDevice.js +0 -9
- package/lib/types/api/setBusy.d.ts +2 -2
- package/lib/types/coinInfo.d.ts +15 -7
- package/lib/types/coinInfo.js +8 -6
- package/lib/types/firmware.d.ts +5 -15
- package/lib/types/params.d.ts +1 -0
- package/lib/types/params.js +1 -2
- package/lib/types/settings.d.ts +1 -0
- package/lib/utils/assetUtils.js +18 -8
- package/lib/utils/popupPromiseManager.d.ts +8 -0
- package/lib/utils/popupPromiseManager.js +21 -0
- package/lib/utils/uiPromiseManager.d.ts +38 -0
- package/lib/utils/uiPromiseManager.js +47 -0
- package/lib/workers/workers-browser.d.ts +3 -1
- package/lib/workers/workers-browser.js +2 -2
- package/package.json +10 -10
- package/lib/api/firmwareUpdate.d.ts +0 -19
- package/lib/api/firmwareUpdate.js +0 -78
|
@@ -10,6 +10,15 @@ export declare const DeviceAuthenticityConfig: import("@sinclair/typebox").TInte
|
|
|
10
10
|
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
11
11
|
}>>;
|
|
12
12
|
}>]>;
|
|
13
|
+
T3T1: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
|
14
|
+
rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
15
|
+
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
16
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
17
|
+
debug: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
18
|
+
rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
19
|
+
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
20
|
+
}>>;
|
|
21
|
+
}>]>;
|
|
13
22
|
}>, import("@sinclair/typebox").TObject<{
|
|
14
23
|
T1B1: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUndefined>;
|
|
15
24
|
T2T1: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUndefined>;
|
|
@@ -8,13 +8,13 @@ const CertPubKeys = schema_utils_1.Type.Object({
|
|
|
8
8
|
caPubKeys: schema_utils_1.Type.Array(schema_utils_1.Type.String()),
|
|
9
9
|
});
|
|
10
10
|
const ModelPubKeys = schema_utils_1.Type.Intersect([
|
|
11
|
-
schema_utils_1.Type.Record(schema_utils_1.Type.
|
|
11
|
+
schema_utils_1.Type.Record(schema_utils_1.Type.Exclude(schema_utils_1.Type.KeyOfEnum(constants_1.PROTO.DeviceModelInternal), schema_utils_1.Type.Union([schema_utils_1.Type.Literal('T1B1'), schema_utils_1.Type.Literal('T2T1')])), schema_utils_1.Type.Intersect([
|
|
12
12
|
CertPubKeys,
|
|
13
13
|
schema_utils_1.Type.Object({
|
|
14
14
|
debug: schema_utils_1.Type.Optional(CertPubKeys),
|
|
15
15
|
}),
|
|
16
16
|
])),
|
|
17
|
-
schema_utils_1.Type.Partial(schema_utils_1.Type.Record(schema_utils_1.Type.Exclude(schema_utils_1.Type.KeyOfEnum(constants_1.PROTO.DeviceModelInternal), schema_utils_1.Type.Literal('T2B1')), schema_utils_1.Type.Undefined())),
|
|
17
|
+
schema_utils_1.Type.Partial(schema_utils_1.Type.Record(schema_utils_1.Type.Exclude(schema_utils_1.Type.KeyOfEnum(constants_1.PROTO.DeviceModelInternal), schema_utils_1.Type.Union([schema_utils_1.Type.Literal('T2B1'), schema_utils_1.Type.Literal('T3T1')])), schema_utils_1.Type.Undefined())),
|
|
18
18
|
]);
|
|
19
19
|
exports.DeviceAuthenticityConfig = schema_utils_1.Type.Intersect([
|
|
20
20
|
ModelPubKeys,
|
|
@@ -25,7 +25,7 @@ exports.DeviceAuthenticityConfig = schema_utils_1.Type.Intersect([
|
|
|
25
25
|
]);
|
|
26
26
|
exports.deviceAuthenticityConfig = {
|
|
27
27
|
version: 1,
|
|
28
|
-
timestamp: '
|
|
28
|
+
timestamp: '2024-05-10T12:00:00+00:00',
|
|
29
29
|
T2B1: {
|
|
30
30
|
rootPubKeys: [
|
|
31
31
|
'04ca97480ac0d7b1e6efafe518cd433cec2bf8ab9822d76eafd34363b55d63e60380bff20acc75cde03cffcb50ab6f8ce70c878e37ebc58ff7cca0a83b16b15fa5',
|
|
@@ -46,6 +46,12 @@ exports.deviceAuthenticityConfig = {
|
|
|
46
46
|
'04c99f57eaaca8db0245a46dba5288a4c0b0d6acdd1346feef7770ec6b88d28d6640ee19c3f6d984e8fcfceda11b1e4accefda32b950dcd1785fbd16c2e45493a3',
|
|
47
47
|
'049c288f4de8a239be83955ed260f40c1a4126fb7dc513601dde4cb11f7363d6a259e73cb1bd9283a450ae608d1832c5fd0cbd9526c0285e720fa45494cae981fd',
|
|
48
48
|
'04ac1815177cc1f07700e5f18c05522427413f404bacc987eb1cf9d86f96b9e0cc53ef5941eafd483102eea321205d7dd9271ac2d0fca75a9a43deb824b51f1596',
|
|
49
|
+
'049f91ac8c7dac26fa7eb82ff3fb8c6d24978bbaeed1adb0751342a8c4c88152817d50bd0b4c16d8fb85bf12f46dca0674a398aeecbb3d1a01236cd3eb39d24c55',
|
|
50
|
+
'04c5225b6d8b84401c408ad0a5aa47888e9087451a2ca4440e46efed5765fd2f5bf8f068e1cfea18dddfc5b47b19076ce0a84fbcf7269f9578d9b978679dea4189',
|
|
51
|
+
'04e349de85981f8e7d95ca4b44346924a9df62875971cfc5e21fc042c3a8fb3e1ddfeac139c15fcf3f7968242a418fc80e92c98f5aef39672b13b60d0b2335c84c',
|
|
52
|
+
'04d7ddaf7e17a678bef305950f0f9d74b90553d8502fd02c439f07ac7ea494e9e0519a1c5782bf23be058162e706057d3b241d507f89b9e5518e3696a92128fa6d',
|
|
53
|
+
'0488cf1dbadb18df0a094da837b3eeb0c85489cc21e7c2b94f8f4df207edccfddbb58e428d9a6ce1e42081c38665d134c7ee6f1f524688ce7444bc1d1340a8b1f1',
|
|
54
|
+
'04ff0c6e817d7c00a0912cf1d293e4d3a8c25403dca4e8ced5e7323352e34604725ad67739d1b4bf538a3864e95d8311ebc91d522b1603da94061e82535edced56',
|
|
49
55
|
],
|
|
50
56
|
debug: {
|
|
51
57
|
rootPubKeys: [
|
|
@@ -56,5 +62,23 @@ exports.deviceAuthenticityConfig = {
|
|
|
56
62
|
],
|
|
57
63
|
},
|
|
58
64
|
},
|
|
65
|
+
T3T1: {
|
|
66
|
+
rootPubKeys: [
|
|
67
|
+
'041854b27fb1d9f65abb66828e78c9dc0ca301e66081ab0c6a4d104f9df1cd0ad5a7c75f77a8c092f55cf825d2abaf734f934c9394d5e75f75a5a06a5ee9be93ae',
|
|
68
|
+
],
|
|
69
|
+
caPubKeys: [
|
|
70
|
+
'045b785b703810363deeadc0faa5a7388d8385f5e4f9170a3c27d3d2506bf9090d5b09044fbad6b906446d8cdb754b65869e8992b26a344e01ecff75844fe5a3d6',
|
|
71
|
+
'046442ece98b1cd13389b6eda3235e2848becc655db564897b2dc0862580f69b29be59dc30f92820f41a7a493b90623e66e1ee8529dbfd60d50aed97b46c4b8f64',
|
|
72
|
+
'0416960078e1d2b44df717ff5445ec76f4247333375982c5ae59b3bc223371f3cf81e7c182fd1ca36c95977070e2ff46f998bff3f00ab0de266edfdd430aea56b8',
|
|
73
|
+
],
|
|
74
|
+
debug: {
|
|
75
|
+
rootPubKeys: [
|
|
76
|
+
'04e48b69cd7962068d3cca3bcc6b1747ef496c1e28b5529e34ad7295215ea161dbe8fb08ae0479568f9d2cb07630cb3e52f4af0692102da5873559e45e9fa72959',
|
|
77
|
+
],
|
|
78
|
+
caPubKeys: [
|
|
79
|
+
'04829e8965018feb542e9236c9b2ce08f864a55ed9183d0259564f0e05345b04676a0bef36c59d21d3c24868b5601f0b1193a6bfcf6d814e1cfb79c2256a05e953',
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
59
83
|
};
|
|
60
84
|
//# sourceMappingURL=deviceAuthenticityConfig.js.map
|
package/lib/data/firmwareInfo.js
CHANGED
|
@@ -4,11 +4,7 @@ exports.getReleases = exports.getRelease = exports.getFirmwareStatus = exports.g
|
|
|
4
4
|
const utils_1 = require("@trezor/utils");
|
|
5
5
|
const firmwareUtils_1 = require("../utils/firmwareUtils");
|
|
6
6
|
const types_1 = require("../types");
|
|
7
|
-
const releases = {
|
|
8
|
-
[types_1.DeviceModelInternal.T1B1]: [],
|
|
9
|
-
[types_1.DeviceModelInternal.T2T1]: [],
|
|
10
|
-
[types_1.DeviceModelInternal.T2B1]: [],
|
|
11
|
-
};
|
|
7
|
+
const releases = Object.values(types_1.DeviceModelInternal).reduce((acc, key) => ({ ...acc, [key]: [] }), {});
|
|
12
8
|
const parseFirmware = (json, deviceModel) => {
|
|
13
9
|
Object.keys(json).forEach(key => {
|
|
14
10
|
const release = json[key];
|
|
@@ -121,7 +117,7 @@ const getInfo = ({ features, releases }) => {
|
|
|
121
117
|
isRequired: isRequired(changelog),
|
|
122
118
|
isNewer: isNewerResult,
|
|
123
119
|
intermediaryVersion,
|
|
124
|
-
translations: isNewerResult ? prevRelease.translations : release.translations,
|
|
120
|
+
translations: isNewerResult ? prevRelease === null || prevRelease === void 0 ? void 0 : prevRelease.translations : release === null || release === void 0 ? void 0 : release.translations,
|
|
125
121
|
};
|
|
126
122
|
};
|
|
127
123
|
exports.getInfo = getInfo;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLanguage = void 0;
|
|
4
|
+
const assets_1 = require("../utils/assets");
|
|
5
|
+
const getLanguage = ({ language, version, internal_model, }) => {
|
|
6
|
+
const url = `https://data.trezor.io/firmware/translations/${internal_model.toLowerCase()}/translation-${internal_model.toUpperCase()}-${language}-${version.join('.')}.bin`;
|
|
7
|
+
return (0, assets_1.httpRequest)(url, 'binary');
|
|
8
|
+
};
|
|
9
|
+
exports.getLanguage = getLanguage;
|
|
10
|
+
//# sourceMappingURL=getLanguage.js.map
|
package/lib/data/models.d.ts
CHANGED
package/lib/data/models.js
CHANGED
|
@@ -20,5 +20,14 @@ exports.models = {
|
|
|
20
20
|
'5': 'Bitcoin Orange',
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
|
+
T3T1: {
|
|
24
|
+
name: 'Trezor Safe 5',
|
|
25
|
+
colors: {
|
|
26
|
+
'1': 'Fantastic Ethereum',
|
|
27
|
+
'2': 'Lunatic Dogecoin',
|
|
28
|
+
'3': 'Galactic Litecoin',
|
|
29
|
+
'4': 'Majestic Bitcoin',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
23
32
|
};
|
|
24
33
|
//# sourceMappingURL=models.js.map
|
package/lib/data/version.d.ts
CHANGED
package/lib/data/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEFAULT_DOMAIN = exports.VERSION = void 0;
|
|
4
|
-
exports.VERSION = '9.2.
|
|
4
|
+
exports.VERSION = '9.2.4-beta.1';
|
|
5
5
|
const versionN = exports.VERSION.split('.').map(s => parseInt(s, 10));
|
|
6
6
|
exports.DEFAULT_DOMAIN = `https://connect.trezor.io/${versionN[0]}/`;
|
|
7
7
|
//# sourceMappingURL=version.js.map
|
package/lib/device/Device.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { TransportProtocol } from '@trezor/protocol';
|
|
|
4
4
|
import { DeviceCommands, PassphrasePromptResponse } from './DeviceCommands';
|
|
5
5
|
import { PROTO, NETWORK } from '../constants';
|
|
6
6
|
import { DEVICE, DeviceButtonRequestPayload } from '../events';
|
|
7
|
-
import type
|
|
7
|
+
import { type Transport, type Descriptor } from '@trezor/transport';
|
|
8
8
|
import { Device as DeviceTyped, DeviceFirmwareStatus, Features, ReleaseInfo, UnavailableCapabilities, FirmwareType } from '../types';
|
|
9
9
|
export type RunOptions = {
|
|
10
10
|
skipFinalReload?: boolean;
|
|
@@ -15,6 +15,7 @@ export type RunOptions = {
|
|
|
15
15
|
useEmptyPassphrase?: boolean;
|
|
16
16
|
useCardanoDerivation?: boolean;
|
|
17
17
|
};
|
|
18
|
+
export declare const GET_FEATURES_TIMEOUT = 3000;
|
|
18
19
|
export interface DeviceEvents {
|
|
19
20
|
[DEVICE.PIN]: (device: Device, b: PROTO.PinMatrixRequestType | undefined, callback: (err: any, pin: string) => void) => void;
|
|
20
21
|
[DEVICE.WORD]: (device: Device, b: PROTO.WordRequestType, callback: (err: any, word: string) => void) => void;
|
|
@@ -73,6 +74,16 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
73
74
|
useLegacyPassphrase(): boolean;
|
|
74
75
|
initialize(useEmptyPassphrase: boolean, useCardanoDerivation: boolean): Promise<void>;
|
|
75
76
|
getFeatures(): Promise<void>;
|
|
77
|
+
changeLanguage({ language, binary, }: {
|
|
78
|
+
language?: undefined;
|
|
79
|
+
binary: ArrayBuffer;
|
|
80
|
+
} | {
|
|
81
|
+
language: string;
|
|
82
|
+
binary?: undefined;
|
|
83
|
+
}): Promise<{
|
|
84
|
+
message: string;
|
|
85
|
+
}>;
|
|
86
|
+
private _uploadTranslationData;
|
|
76
87
|
_updateFeatures(feat: Features): void;
|
|
77
88
|
isUnacquired(): boolean;
|
|
78
89
|
disconnect(): void;
|
|
@@ -91,7 +102,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
91
102
|
getDevicePath(): string;
|
|
92
103
|
isT1(): boolean;
|
|
93
104
|
hasUnexpectedMode(allow: string[], require: string[]): "ui-device_bootloader_mode" | "ui-device_not_in_bootloader_mode" | "ui-device_not_initialized" | "ui-device_seedless" | null;
|
|
94
|
-
dispose(): import("@trezor/transport/lib/types").AbortableCall<void, "Network request failed" | "Wrong result type." | "device disconnected during action" | "unexpected error" | "Aborted by timeout" | "Aborted by signal" | "This transport can not be used in this environment" | "device not found" | "Unable to open device" | "wrong previous session" | "session not found"> | undefined
|
|
105
|
+
dispose(): Promise<import("@trezor/transport/lib/types").AbortableCall<void, "Network request failed" | "Wrong result type." | "device disconnected during action" | "unexpected error" | "Aborted by timeout" | "Aborted by signal" | "This transport can not be used in this environment" | "device not found" | "Unable to open device" | "wrong previous session" | "session not found"> | undefined>;
|
|
95
106
|
getMode(): "normal" | "bootloader" | "initialize" | "seedless";
|
|
96
107
|
toMessageObject(): DeviceTyped;
|
|
97
108
|
legacyForceRelease(): Promise<void>;
|
package/lib/device/Device.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Device = void 0;
|
|
3
|
+
exports.Device = exports.GET_FEATURES_TIMEOUT = void 0;
|
|
4
4
|
const utils_1 = require("@trezor/utils");
|
|
5
5
|
const utils_2 = require("@trezor/utils");
|
|
6
6
|
const utils_3 = require("@trezor/utils");
|
|
@@ -12,9 +12,12 @@ const coinInfo_1 = require("../data/coinInfo");
|
|
|
12
12
|
const firmwareInfo_1 = require("../data/firmwareInfo");
|
|
13
13
|
const deviceFeaturesUtils_1 = require("../utils/deviceFeaturesUtils");
|
|
14
14
|
const debug_1 = require("../utils/debug");
|
|
15
|
+
const transport_1 = require("@trezor/transport");
|
|
15
16
|
const types_1 = require("../types");
|
|
16
17
|
const models_1 = require("../data/models");
|
|
18
|
+
const getLanguage_1 = require("../data/getLanguage");
|
|
17
19
|
const _log = (0, debug_1.initLog)('Device');
|
|
20
|
+
exports.GET_FEATURES_TIMEOUT = 3000;
|
|
18
21
|
const parseRunOptions = (options) => {
|
|
19
22
|
if (!options)
|
|
20
23
|
options = {};
|
|
@@ -98,9 +101,6 @@ class Device extends utils_1.TypedEmitter {
|
|
|
98
101
|
await this.commands.callPromise.promise;
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
|
-
if (this.releasePromise) {
|
|
102
|
-
await this.releasePromise;
|
|
103
|
-
}
|
|
104
104
|
this.releasePromise = this.transport.release({
|
|
105
105
|
session: this.activitySessionID,
|
|
106
106
|
path: this.originalDescriptor.path,
|
|
@@ -177,7 +177,7 @@ class Device extends utils_1.TypedEmitter {
|
|
|
177
177
|
else {
|
|
178
178
|
await Promise.race([
|
|
179
179
|
this.getFeatures(),
|
|
180
|
-
new Promise((_resolve, reject) => setTimeout(() => reject(new Error('GetFeatures timeout')),
|
|
180
|
+
new Promise((_resolve, reject) => setTimeout(() => reject(new Error('GetFeatures timeout')), exports.GET_FEATURES_TIMEOUT)),
|
|
181
181
|
]);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
@@ -186,6 +186,9 @@ class Device extends utils_1.TypedEmitter {
|
|
|
186
186
|
this.inconsistent = true;
|
|
187
187
|
return this._runInner(() => Promise.resolve({}), options);
|
|
188
188
|
}
|
|
189
|
+
if (transport_1.TRANSPORT_ERROR.ABORTED_BY_TIMEOUT === error.message) {
|
|
190
|
+
this.unreadableError = 'Connection timeout';
|
|
191
|
+
}
|
|
189
192
|
this.inconsistent = true;
|
|
190
193
|
delete this.runPromise;
|
|
191
194
|
return Promise.reject(constants_1.ERRORS.TypedError('Device_InitializeFailed', `Initialize failed: ${error.message} ${error.code ? `, code: ${error.code}` : ''}`));
|
|
@@ -310,6 +313,51 @@ class Device extends utils_1.TypedEmitter {
|
|
|
310
313
|
async getFeatures() {
|
|
311
314
|
const { message } = await this.getCommands().typedCall('GetFeatures', 'Features', {});
|
|
312
315
|
this._updateFeatures(message);
|
|
316
|
+
if (!this.features.language_version_matches &&
|
|
317
|
+
this.features.language &&
|
|
318
|
+
this.atLeast('2.7.0')) {
|
|
319
|
+
_log.info('language version mismatch. silently updating...');
|
|
320
|
+
try {
|
|
321
|
+
await this.changeLanguage({ language: this.features.language });
|
|
322
|
+
}
|
|
323
|
+
catch (err) {
|
|
324
|
+
_log.error('change language failed silently', err);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
async changeLanguage({ language, binary, }) {
|
|
329
|
+
if (language === 'en-US') {
|
|
330
|
+
return this._uploadTranslationData(null);
|
|
331
|
+
}
|
|
332
|
+
if (binary) {
|
|
333
|
+
return this._uploadTranslationData(binary);
|
|
334
|
+
}
|
|
335
|
+
const downloadedBinary = await (0, getLanguage_1.getLanguage)({
|
|
336
|
+
language,
|
|
337
|
+
version: this.getVersion(),
|
|
338
|
+
internal_model: this.features.internal_model,
|
|
339
|
+
});
|
|
340
|
+
return this._uploadTranslationData(downloadedBinary);
|
|
341
|
+
}
|
|
342
|
+
async _uploadTranslationData(payload) {
|
|
343
|
+
if (!this.commands) {
|
|
344
|
+
throw constants_1.ERRORS.TypedError('Runtime', 'uploadTranslationData: device.commands is not set');
|
|
345
|
+
}
|
|
346
|
+
if (payload === null) {
|
|
347
|
+
const response = await this.commands.typedCall('ChangeLanguage', ['Success'], { data_length: 0 });
|
|
348
|
+
return response.message;
|
|
349
|
+
}
|
|
350
|
+
const length = payload.byteLength;
|
|
351
|
+
let response = await this.commands.typedCall('ChangeLanguage', ['TranslationDataRequest', 'Success'], { data_length: length });
|
|
352
|
+
while (response.type !== 'Success') {
|
|
353
|
+
const start = response.message.data_offset;
|
|
354
|
+
const end = response.message.data_offset + response.message.data_length;
|
|
355
|
+
const chunk = payload.slice(start, end);
|
|
356
|
+
response = await this.commands.typedCall('TranslationDataAck', ['TranslationDataRequest', 'Success'], {
|
|
357
|
+
data_chunk: Buffer.from(chunk).toString('hex'),
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
return response.message;
|
|
313
361
|
}
|
|
314
362
|
_updateFeatures(feat) {
|
|
315
363
|
var _a, _b, _c, _d;
|
|
@@ -443,12 +491,12 @@ class Device extends utils_1.TypedEmitter {
|
|
|
443
491
|
}
|
|
444
492
|
return null;
|
|
445
493
|
}
|
|
446
|
-
dispose() {
|
|
494
|
+
async dispose() {
|
|
447
495
|
this.removeAllListeners();
|
|
448
496
|
if (this.isUsedHere() && this.activitySessionID) {
|
|
449
497
|
try {
|
|
450
498
|
if (this.commands) {
|
|
451
|
-
this.commands.cancel();
|
|
499
|
+
await this.commands.cancel();
|
|
452
500
|
}
|
|
453
501
|
return this.transport.release({
|
|
454
502
|
session: this.activitySessionID,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transport } from '@trezor/transport';
|
|
2
2
|
import { MessagesSchema as Messages } from '@trezor/protobuf';
|
|
3
|
-
import
|
|
3
|
+
import { Device } from './Device';
|
|
4
4
|
import type { CoinInfo, BitcoinNetworkInfo } from '../types';
|
|
5
5
|
import type { HDNodeResponse } from '../types/api/getPublicKey';
|
|
6
6
|
type MessageType = Messages.MessageType;
|
|
@@ -43,8 +43,8 @@ export declare class DeviceCommands {
|
|
|
43
43
|
};
|
|
44
44
|
xpub: string;
|
|
45
45
|
}>;
|
|
46
|
-
getHDNode(params: Messages.GetPublicKey, options
|
|
47
|
-
coinInfo
|
|
46
|
+
getHDNode(params: Messages.GetPublicKey, options: {
|
|
47
|
+
coinInfo: BitcoinNetworkInfo;
|
|
48
48
|
validation?: boolean;
|
|
49
49
|
unlockPath?: Messages.UnlockPath;
|
|
50
50
|
}): Promise<{
|
|
@@ -59,18 +59,6 @@ export declare class DeviceCommands {
|
|
|
59
59
|
childNum: number;
|
|
60
60
|
xpub: string;
|
|
61
61
|
}>;
|
|
62
|
-
getBitcoinHDNode(path: number[], coinInfo?: BitcoinNetworkInfo, validation?: boolean): Promise<{
|
|
63
|
-
xpubSegwit?: string | undefined;
|
|
64
|
-
descriptorChecksum?: string | undefined;
|
|
65
|
-
path: number[];
|
|
66
|
-
publicKey: string;
|
|
67
|
-
serializedPath: string;
|
|
68
|
-
depth: number;
|
|
69
|
-
fingerprint: number;
|
|
70
|
-
chainCode: string;
|
|
71
|
-
childNum: number;
|
|
72
|
-
xpub: string;
|
|
73
|
-
}>;
|
|
74
62
|
getAddress({ address_n, show_display, multisig, script_type, chunkify }: Messages.GetAddress, coinInfo: BitcoinNetworkInfo): Promise<{
|
|
75
63
|
path: number[];
|
|
76
64
|
serializedPath: string;
|
|
@@ -67,13 +67,10 @@ class DeviceCommands {
|
|
|
67
67
|
});
|
|
68
68
|
return response.message;
|
|
69
69
|
}
|
|
70
|
-
async getHDNode(params, options
|
|
70
|
+
async getHDNode(params, options) {
|
|
71
71
|
const path = params.address_n;
|
|
72
72
|
const { coinInfo, unlockPath } = options;
|
|
73
73
|
const validation = typeof options.validation === 'boolean' ? options.validation : true;
|
|
74
|
-
if (!this.device.atLeast(['1.7.2', '2.0.10']) || !coinInfo) {
|
|
75
|
-
return this.getBitcoinHDNode(path, coinInfo);
|
|
76
|
-
}
|
|
77
74
|
let network = null;
|
|
78
75
|
if (!params.script_type) {
|
|
79
76
|
params.script_type = (0, pathUtils_1.getScriptType)(path);
|
|
@@ -125,42 +122,6 @@ class DeviceCommands {
|
|
|
125
122
|
}
|
|
126
123
|
return response;
|
|
127
124
|
}
|
|
128
|
-
async getBitcoinHDNode(path, coinInfo, validation = true) {
|
|
129
|
-
let publicKey;
|
|
130
|
-
if (!validation) {
|
|
131
|
-
publicKey = await this.getPublicKey({ address_n: path });
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
const suffix = 0;
|
|
135
|
-
const childPath = path.concat([suffix]);
|
|
136
|
-
const resKey = await this.getPublicKey({ address_n: path });
|
|
137
|
-
const childKey = await this.getPublicKey({ address_n: childPath });
|
|
138
|
-
publicKey = hdnodeUtils.xpubDerive(resKey, childKey, suffix);
|
|
139
|
-
}
|
|
140
|
-
const response = {
|
|
141
|
-
path,
|
|
142
|
-
serializedPath: (0, pathUtils_1.getSerializedPath)(path),
|
|
143
|
-
childNum: publicKey.node.child_num,
|
|
144
|
-
xpub: coinInfo
|
|
145
|
-
? hdnodeUtils.convertBitcoinXpub(publicKey.xpub, coinInfo.network)
|
|
146
|
-
: publicKey.xpub,
|
|
147
|
-
chainCode: publicKey.node.chain_code,
|
|
148
|
-
publicKey: publicKey.node.public_key,
|
|
149
|
-
fingerprint: publicKey.node.fingerprint,
|
|
150
|
-
depth: publicKey.node.depth,
|
|
151
|
-
};
|
|
152
|
-
if (coinInfo) {
|
|
153
|
-
const bech32Network = (0, coinInfo_1.getBech32Network)(coinInfo);
|
|
154
|
-
const segwitNetwork = (0, coinInfo_1.getSegwitNetwork)(coinInfo);
|
|
155
|
-
if (bech32Network && (0, pathUtils_1.isBech32Path)(path)) {
|
|
156
|
-
response.xpubSegwit = hdnodeUtils.convertBitcoinXpub(publicKey.xpub, bech32Network);
|
|
157
|
-
}
|
|
158
|
-
else if (segwitNetwork && (0, pathUtils_1.isSegwitPath)(path)) {
|
|
159
|
-
response.xpubSegwit = hdnodeUtils.convertBitcoinXpub(publicKey.xpub, segwitNetwork);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return response;
|
|
163
|
-
}
|
|
164
125
|
async getAddress({ address_n, show_display, multisig, script_type, chunkify }, coinInfo) {
|
|
165
126
|
if (!script_type) {
|
|
166
127
|
script_type = (0, pathUtils_1.getScriptType)(address_n);
|
|
@@ -203,9 +164,6 @@ class DeviceCommands {
|
|
|
203
164
|
};
|
|
204
165
|
}
|
|
205
166
|
async ethereumGetPublicKey({ address_n, show_display, }) {
|
|
206
|
-
if (!this.device.atLeast(['1.8.1', '2.1.0'])) {
|
|
207
|
-
return this.getHDNode({ address_n });
|
|
208
|
-
}
|
|
209
167
|
const suffix = 0;
|
|
210
168
|
const childPath = address_n.concat([suffix]);
|
|
211
169
|
const resKey = await this.typedCall('EthereumGetPublicKey', 'EthereumPublicKey', {
|
|
@@ -42,7 +42,7 @@ export declare class DeviceList extends TypedEmitter<DeviceListEvents> {
|
|
|
42
42
|
length(): number;
|
|
43
43
|
transportType(): "BridgeTransport" | "NodeUsbTransport" | "WebUsbTransport" | "UdpTransport";
|
|
44
44
|
getTransportInfo(): TransportInfo;
|
|
45
|
-
dispose():
|
|
45
|
+
dispose(): void;
|
|
46
46
|
disconnectDevices(): void;
|
|
47
47
|
enumerate(): Promise<void>;
|
|
48
48
|
addAuthPenalty(device: Device): void;
|
package/lib/device/DeviceList.js
CHANGED
|
@@ -90,14 +90,24 @@ class DeviceList extends utils_1.TypedEmitter {
|
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
92
|
this.transport.on(transport_1.TRANSPORT.UPDATE, diff => {
|
|
93
|
+
diff.disconnected.forEach(descriptor => {
|
|
94
|
+
const path = descriptor.path.toString();
|
|
95
|
+
const device = this.devices[path];
|
|
96
|
+
if (device) {
|
|
97
|
+
device.disconnect();
|
|
98
|
+
delete this.devices[path];
|
|
99
|
+
this.emit(events_1.DEVICE.DISCONNECT, device.toMessageObject());
|
|
100
|
+
}
|
|
101
|
+
});
|
|
93
102
|
diff.connected.forEach(async (descriptor) => {
|
|
94
103
|
const path = descriptor.path.toString();
|
|
104
|
+
this.creatingDevicesDescriptors[path] = descriptor;
|
|
95
105
|
const priority = DataManager_1.DataManager.getSettings('priority');
|
|
96
106
|
const penalty = this.getAuthPenalty();
|
|
97
107
|
if (priority || penalty) {
|
|
98
108
|
await (0, promiseUtils_1.resolveAfter)(501 + penalty + 100 * priority, null).promise;
|
|
99
109
|
}
|
|
100
|
-
if (
|
|
110
|
+
if (this.creatingDevicesDescriptors[path].session == null) {
|
|
101
111
|
await this._createAndSaveDevice(descriptor);
|
|
102
112
|
}
|
|
103
113
|
else {
|
|
@@ -158,20 +168,13 @@ class DeviceList extends utils_1.TypedEmitter {
|
|
|
158
168
|
}
|
|
159
169
|
});
|
|
160
170
|
});
|
|
161
|
-
diff.disconnected.forEach(descriptor => {
|
|
162
|
-
const path = descriptor.path.toString();
|
|
163
|
-
const device = this.devices[path];
|
|
164
|
-
if (device) {
|
|
165
|
-
device.disconnect();
|
|
166
|
-
delete this.devices[path];
|
|
167
|
-
this.emit(events_1.DEVICE.DISCONNECT, device.toMessageObject());
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
171
|
diff.descriptors.forEach(d => {
|
|
172
|
+
this.creatingDevicesDescriptors[d.path] = d;
|
|
171
173
|
if (this.devices[d.path]) {
|
|
172
174
|
this.devices[d.path].originalDescriptor = {
|
|
173
175
|
session: d.session,
|
|
174
176
|
path: d.path,
|
|
177
|
+
product: d.product,
|
|
175
178
|
};
|
|
176
179
|
}
|
|
177
180
|
});
|
|
@@ -265,13 +268,14 @@ class DeviceList extends utils_1.TypedEmitter {
|
|
|
265
268
|
outdated: this.transport.isOutdated,
|
|
266
269
|
};
|
|
267
270
|
}
|
|
268
|
-
|
|
271
|
+
dispose() {
|
|
269
272
|
this.removeAllListeners();
|
|
270
273
|
if (autoResolveTransportEventTimeout) {
|
|
271
274
|
clearTimeout(autoResolveTransportEventTimeout);
|
|
272
275
|
}
|
|
273
|
-
|
|
274
|
-
|
|
276
|
+
Promise.all(this.allDevices().map(device => device.dispose())).then(() => {
|
|
277
|
+
this.transport.stop();
|
|
278
|
+
});
|
|
275
279
|
}
|
|
276
280
|
disconnectDevices() {
|
|
277
281
|
this.allDevices().forEach(device => {
|
|
@@ -288,6 +292,7 @@ class DeviceList extends utils_1.TypedEmitter {
|
|
|
288
292
|
this.devices[d.path].originalDescriptor = {
|
|
289
293
|
session: d.session,
|
|
290
294
|
path: d.path,
|
|
295
|
+
product: d.product,
|
|
291
296
|
};
|
|
292
297
|
this.devices[d.path].activitySessionID = d.session;
|
|
293
298
|
}
|
|
@@ -315,7 +320,6 @@ class DeviceList extends utils_1.TypedEmitter {
|
|
|
315
320
|
async handle(descriptor) {
|
|
316
321
|
var _a;
|
|
317
322
|
const path = descriptor.path.toString();
|
|
318
|
-
this.creatingDevicesDescriptors[path] = descriptor;
|
|
319
323
|
try {
|
|
320
324
|
await this._takeAndCreateDevice(descriptor);
|
|
321
325
|
}
|
|
@@ -325,21 +329,20 @@ class DeviceList extends utils_1.TypedEmitter {
|
|
|
325
329
|
error.message === transport_1.TRANSPORT_ERROR.DEVICE_NOT_FOUND ||
|
|
326
330
|
error.message === transport_1.TRANSPORT_ERROR.DEVICE_DISCONNECTED_DURING_ACTION ||
|
|
327
331
|
error.message === transport_1.TRANSPORT_ERROR.UNEXPECTED_ERROR ||
|
|
328
|
-
error.message === transport_1.TRANSPORT_ERROR.
|
|
332
|
+
error.message === transport_1.TRANSPORT_ERROR.HTTP_ERROR) {
|
|
329
333
|
delete this.devices[path];
|
|
330
334
|
}
|
|
331
335
|
else if (error.message === transport_1.TRANSPORT_ERROR.SESSION_WRONG_PREVIOUS) {
|
|
332
336
|
this.enumerate();
|
|
333
337
|
this._handleUsedElsewhere(descriptor);
|
|
334
338
|
}
|
|
335
|
-
else if (
|
|
339
|
+
else if (error.message === transport_1.TRANSPORT_ERROR.INTERFACE_UNABLE_TO_OPEN_DEVICE ||
|
|
340
|
+
((_a = error.message) === null || _a === void 0 ? void 0 : _a.indexOf(constants_1.ERRORS.LIBUSB_ERROR_MESSAGE)) >= 0 ||
|
|
341
|
+
error.code === 'Device_InitializeFailed') {
|
|
336
342
|
const device = this._createUnreadableDevice(this.creatingDevicesDescriptors[path], error.message);
|
|
337
343
|
this.devices[path] = device;
|
|
338
344
|
this.emit(events_1.DEVICE.CONNECT_UNACQUIRED, device.toMessageObject());
|
|
339
345
|
}
|
|
340
|
-
else if (error.code === 'Device_InitializeFailed') {
|
|
341
|
-
this._handleUsedElsewhere(descriptor);
|
|
342
|
-
}
|
|
343
346
|
else if (error.code === 'Device_UsedElsewhere') {
|
|
344
347
|
this._handleUsedElsewhere(descriptor);
|
|
345
348
|
}
|
|
@@ -12,16 +12,19 @@ export declare const BLOCKCHAIN: {
|
|
|
12
12
|
};
|
|
13
13
|
export interface BlockchainInfo extends ServerInfo {
|
|
14
14
|
coin: CoinInfo;
|
|
15
|
+
identity?: string;
|
|
15
16
|
misc?: {
|
|
16
17
|
reserve?: string;
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
20
|
export interface BlockchainReconnecting {
|
|
20
21
|
coin: CoinInfo;
|
|
22
|
+
identity?: string;
|
|
21
23
|
time: number;
|
|
22
24
|
}
|
|
23
25
|
export interface BlockchainError {
|
|
24
26
|
coin: CoinInfo;
|
|
27
|
+
identity?: string;
|
|
25
28
|
error: string;
|
|
26
29
|
code?: string;
|
|
27
30
|
}
|
package/lib/events/index.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare const UI: {
|
|
|
33
33
|
readonly FIRMWARE_NOT_COMPATIBLE: "ui-device_firmware_not_compatible";
|
|
34
34
|
readonly FIRMWARE_NOT_INSTALLED: "ui-device_firmware_not_installed";
|
|
35
35
|
readonly FIRMWARE_PROGRESS: "ui-firmware-progress";
|
|
36
|
+
readonly FIRMWARE_RECONNECT: "ui-firmware_reconnect";
|
|
36
37
|
readonly DEVICE_NEEDS_BACKUP: "ui-device_needs_backup";
|
|
37
38
|
readonly REQUEST_UI_WINDOW: "ui-request_window";
|
|
38
39
|
readonly CLOSE_UI_WINDOW: "ui-close_window";
|
|
@@ -18,6 +18,7 @@ export declare const UI_REQUEST: {
|
|
|
18
18
|
readonly FIRMWARE_NOT_COMPATIBLE: "ui-device_firmware_not_compatible";
|
|
19
19
|
readonly FIRMWARE_NOT_INSTALLED: "ui-device_firmware_not_installed";
|
|
20
20
|
readonly FIRMWARE_PROGRESS: "ui-firmware-progress";
|
|
21
|
+
readonly FIRMWARE_RECONNECT: "ui-firmware_reconnect";
|
|
21
22
|
readonly DEVICE_NEEDS_BACKUP: "ui-device_needs_backup";
|
|
22
23
|
readonly REQUEST_UI_WINDOW: "ui-request_window";
|
|
23
24
|
readonly CLOSE_UI_WINDOW: "ui-close_window";
|
|
@@ -196,10 +197,21 @@ export interface FirmwareProgress {
|
|
|
196
197
|
type: typeof UI_REQUEST.FIRMWARE_PROGRESS;
|
|
197
198
|
payload: {
|
|
198
199
|
device: Device;
|
|
200
|
+
operation: 'downloading' | 'flashing' | 'validating';
|
|
199
201
|
progress: number;
|
|
200
202
|
};
|
|
201
203
|
}
|
|
202
|
-
export
|
|
204
|
+
export interface FirmwareReconnect {
|
|
205
|
+
type: typeof UI_REQUEST.FIRMWARE_RECONNECT;
|
|
206
|
+
payload: {
|
|
207
|
+
device: Device;
|
|
208
|
+
disconnected: boolean;
|
|
209
|
+
method: 'manual' | 'auto' | 'wait';
|
|
210
|
+
target: 'normal' | 'bootloader';
|
|
211
|
+
i: number;
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
export type UiEvent = UiRequestWithoutPayload | UiRequestDeviceAction | UiRequestButton | UiRequestPermission | UiRequestConfirmation | UiRequestSelectDevice | UiRequestUnexpectedDeviceMode | UiRequestSelectAccount | UiRequestSelectFee | UpdateCustomFee | BundleProgress<any> | FirmwareProgress | FirmwareException | FirmwareReconnect | UiRequestAddressValidation | UiRequestSetOperation;
|
|
203
215
|
export type UiEventMessage = UiEvent & {
|
|
204
216
|
event: typeof UI_EVENT;
|
|
205
217
|
};
|
package/lib/events/ui-request.js
CHANGED
|
@@ -15,6 +15,7 @@ exports.UI_REQUEST = {
|
|
|
15
15
|
FIRMWARE_NOT_COMPATIBLE: 'ui-device_firmware_not_compatible',
|
|
16
16
|
FIRMWARE_NOT_INSTALLED: 'ui-device_firmware_not_installed',
|
|
17
17
|
FIRMWARE_PROGRESS: 'ui-firmware-progress',
|
|
18
|
+
FIRMWARE_RECONNECT: 'ui-firmware_reconnect',
|
|
18
19
|
DEVICE_NEEDS_BACKUP: 'ui-device_needs_backup',
|
|
19
20
|
REQUEST_UI_WINDOW: 'ui-request_window',
|
|
20
21
|
CLOSE_UI_WINDOW: 'ui-close_window',
|
package/lib/index.js
CHANGED
|
@@ -21,11 +21,11 @@ const manifest = (data) => {
|
|
|
21
21
|
manifest: data,
|
|
22
22
|
});
|
|
23
23
|
};
|
|
24
|
-
const dispose =
|
|
24
|
+
const dispose = () => {
|
|
25
25
|
exports.eventEmitter.removeAllListeners();
|
|
26
26
|
_settings = (0, connectSettings_1.parseConnectSettings)();
|
|
27
27
|
if (_core) {
|
|
28
|
-
|
|
28
|
+
_core.dispose();
|
|
29
29
|
_core = null;
|
|
30
30
|
}
|
|
31
31
|
};
|
|
@@ -12,6 +12,15 @@ export declare const AuthenticateDeviceParams: import("@sinclair/typebox").TObje
|
|
|
12
12
|
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
13
13
|
}>>;
|
|
14
14
|
}>]>;
|
|
15
|
+
T3T1: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
|
16
|
+
rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
17
|
+
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
18
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
19
|
+
debug: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
20
|
+
rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
21
|
+
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
22
|
+
}>>;
|
|
23
|
+
}>]>;
|
|
15
24
|
}>, import("@sinclair/typebox").TObject<{
|
|
16
25
|
T1B1: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUndefined>;
|
|
17
26
|
T2T1: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUndefined>;
|