@trezor/connect 9.2.5-beta.2 → 9.3.1-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 -66
- package/README.md +1 -1
- package/lib/api/checkFirmwareAuthenticity.d.ts +2 -1
- package/lib/api/checkFirmwareAuthenticity.js +34 -26
- package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +1 -0
- package/lib/api/ethereum/ethereumDefinitions.js +1 -0
- package/lib/api/firmware/getBinary.d.ts +4 -4
- package/lib/api/firmware/getBinary.js +4 -15
- package/lib/api/firmware/getBinaryForFirmwareUpgrade.d.ts +11 -0
- package/lib/api/firmware/getBinaryForFirmwareUpgrade.js +32 -0
- package/lib/api/firmware/index.d.ts +1 -0
- package/lib/api/firmware/index.js +3 -1
- package/lib/api/firmware/verifyAuthenticityProof.d.ts +1 -1
- package/lib/api/firmware/verifyAuthenticityProof.js +37 -2
- package/lib/api/firmware/x509certificate.d.ts +20 -6
- package/lib/api/firmware/x509certificate.js +82 -13
- package/lib/api/getCoinInfo.d.ts +3 -0
- package/lib/api/getFeatures.d.ts +1 -0
- package/lib/backend/Blockchain.js +10 -1
- package/lib/core/AbstractMethod.js +1 -0
- package/lib/core/index.d.ts +3 -3
- package/lib/core/index.js +23 -6
- package/lib/core/onCallFirmwareUpdate.js +25 -14
- package/lib/data/DataManager.d.ts +11 -0
- package/lib/data/DataManager.js +1 -1
- package/lib/data/coinInfo.d.ts +14 -0
- package/lib/data/config.d.ts +11 -0
- package/lib/data/config.js +17 -1
- package/lib/data/connectSettings.js +3 -2
- package/lib/data/deviceAuthenticityConfig.d.ts +1 -28
- package/lib/data/deviceAuthenticityConfig.js +25 -24
- package/lib/data/deviceAuthenticityConfigTypes.d.ts +38 -0
- package/lib/data/deviceAuthenticityConfigTypes.js +28 -0
- package/lib/data/models.d.ts +10 -0
- package/lib/data/models.js +12 -10
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +1 -3
- package/lib/device/Device.js +7 -21
- package/lib/device/DeviceCommands.js +1 -26
- package/lib/events/core.d.ts +2 -2
- package/lib/events/transport.d.ts +5 -0
- package/lib/index.js +20 -20
- package/lib/types/api/authenticateDevice.d.ts +9 -0
- package/lib/types/api/authenticateDevice.js +2 -2
- package/lib/types/api/checkFirmwareAuthenticity.d.ts +4 -1
- package/lib/types/api/init.d.ts +2 -2
- package/lib/types/coinInfo.d.ts +7 -0
- package/lib/types/firmware.d.ts +2 -2
- package/lib/types/settings.d.ts +7 -3
- package/lib/utils/assetUtils.js +1 -0
- package/package.json +13 -14
- package/lib/core/coreManager.d.ts +0 -16
- package/lib/core/coreManager.js +0 -55
package/lib/data/config.js
CHANGED
|
@@ -51,6 +51,16 @@ exports.config = {
|
|
|
51
51
|
label: 'Rabby',
|
|
52
52
|
icon: '',
|
|
53
53
|
},
|
|
54
|
+
{
|
|
55
|
+
origin: 'ehnpnhnhcickeknioaiodjmielfaoajd',
|
|
56
|
+
label: 'Ambire DEV',
|
|
57
|
+
icon: '',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
origin: 'ehgjhhccekdedpbkifaojjaefeohnoea',
|
|
61
|
+
label: 'Ambire',
|
|
62
|
+
icon: '',
|
|
63
|
+
},
|
|
54
64
|
{ origin: 'file://', label: ' ', icon: '' },
|
|
55
65
|
],
|
|
56
66
|
onionDomains: {
|
|
@@ -259,7 +269,13 @@ exports.config = {
|
|
|
259
269
|
},
|
|
260
270
|
{
|
|
261
271
|
methods: ['changeLanguage'],
|
|
262
|
-
min: {
|
|
272
|
+
min: {
|
|
273
|
+
T1B1: '0',
|
|
274
|
+
T2T1: '2.7.0',
|
|
275
|
+
T2B1: '2.7.0',
|
|
276
|
+
T3B1: '2.8.1',
|
|
277
|
+
T3T1: '2.7.1',
|
|
278
|
+
},
|
|
263
279
|
},
|
|
264
280
|
],
|
|
265
281
|
};
|
|
@@ -107,8 +107,9 @@ const parseConnectSettings = (input = {}) => {
|
|
|
107
107
|
if (typeof input.sharedLogger === 'boolean') {
|
|
108
108
|
settings.sharedLogger = input.sharedLogger;
|
|
109
109
|
}
|
|
110
|
-
if (typeof input.
|
|
111
|
-
|
|
110
|
+
if (typeof input.coreMode === 'string' &&
|
|
111
|
+
['auto', 'popup', 'iframe'].includes(input.coreMode)) {
|
|
112
|
+
settings.coreMode = input.coreMode;
|
|
112
113
|
}
|
|
113
114
|
if (typeof input._extendWebextensionLifetime === 'boolean') {
|
|
114
115
|
settings._extendWebextensionLifetime = input._extendWebextensionLifetime;
|
|
@@ -1,30 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type DeviceAuthenticityConfig = Static<typeof DeviceAuthenticityConfig>;
|
|
3
|
-
export declare const DeviceAuthenticityConfig: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
|
4
|
-
T2B1: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
|
5
|
-
rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
6
|
-
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
7
|
-
}>, import("@sinclair/typebox").TObject<{
|
|
8
|
-
debug: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
9
|
-
rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
10
|
-
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
11
|
-
}>>;
|
|
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
|
-
}>]>;
|
|
22
|
-
}>, import("@sinclair/typebox").TObject<{
|
|
23
|
-
T1B1: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUndefined>;
|
|
24
|
-
T2T1: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUndefined>;
|
|
25
|
-
}>]>, import("@sinclair/typebox").TObject<{
|
|
26
|
-
version: import("@sinclair/typebox").TNumber;
|
|
27
|
-
timestamp: import("@sinclair/typebox").TString;
|
|
28
|
-
}>]>;
|
|
1
|
+
import { DeviceAuthenticityConfig } from './deviceAuthenticityConfigTypes';
|
|
29
2
|
export declare const deviceAuthenticityConfig: DeviceAuthenticityConfig;
|
|
30
3
|
//# sourceMappingURL=deviceAuthenticityConfig.d.ts.map
|
|
@@ -1,31 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deviceAuthenticityConfig =
|
|
4
|
-
const schema_utils_1 = require("@trezor/schema-utils");
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
|
-
const CertPubKeys = schema_utils_1.Type.Object({
|
|
7
|
-
rootPubKeys: schema_utils_1.Type.Array(schema_utils_1.Type.String()),
|
|
8
|
-
caPubKeys: schema_utils_1.Type.Array(schema_utils_1.Type.String()),
|
|
9
|
-
});
|
|
10
|
-
const ModelPubKeys = schema_utils_1.Type.Intersect([
|
|
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
|
-
CertPubKeys,
|
|
13
|
-
schema_utils_1.Type.Object({
|
|
14
|
-
debug: schema_utils_1.Type.Optional(CertPubKeys),
|
|
15
|
-
}),
|
|
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.Union([schema_utils_1.Type.Literal('T2B1'), schema_utils_1.Type.Literal('T3T1')])), schema_utils_1.Type.Undefined())),
|
|
18
|
-
]);
|
|
19
|
-
exports.DeviceAuthenticityConfig = schema_utils_1.Type.Intersect([
|
|
20
|
-
ModelPubKeys,
|
|
21
|
-
schema_utils_1.Type.Object({
|
|
22
|
-
version: schema_utils_1.Type.Number(),
|
|
23
|
-
timestamp: schema_utils_1.Type.String(),
|
|
24
|
-
}),
|
|
25
|
-
]);
|
|
3
|
+
exports.deviceAuthenticityConfig = void 0;
|
|
26
4
|
exports.deviceAuthenticityConfig = {
|
|
27
5
|
version: 1,
|
|
28
|
-
timestamp: '2024-
|
|
6
|
+
timestamp: '2024-07-09T12:00:00+00:00',
|
|
29
7
|
T2B1: {
|
|
30
8
|
rootPubKeys: [
|
|
31
9
|
'04ca97480ac0d7b1e6efafe518cd433cec2bf8ab9822d76eafd34363b55d63e60380bff20acc75cde03cffcb50ab6f8ce70c878e37ebc58ff7cca0a83b16b15fa5',
|
|
@@ -55,6 +33,12 @@ exports.deviceAuthenticityConfig = {
|
|
|
55
33
|
'0445f15e55a044b1516a7b2cc13dd4e9ea415336f622b9185e4ffc19e2b51627637491195c85f87ac2582ac4a8d89a33983f0700d042fd7e57d55d346f4fbc832c',
|
|
56
34
|
'042b9cede77aa38f1d824ebd5e13129c8c1c163f3ea74b5251e420831ec17329be741b2af96cc6df0c253e4bffdac23f4bb373e53ae1821587ce0ecae476d2b95c',
|
|
57
35
|
'040cea26562b3763dddd741f4428f37cdc931dbd2db9665888505c2be42868ee2d739aed1d0a54c116b889f5d1ff57dae8dcc1e595cf6d69e71853a8053449ab9f',
|
|
36
|
+
'040e656b714a6d5dd579dbb15948335fbe2d4acbbf2943209cf4dcd662fc0fec577c746fad12a0c5b0eae0c1de2f723c9ac3fa3bdfda93f8f6fd167a14c1805fbe',
|
|
37
|
+
'040c87f12d2006b44e9b86f66eb9d51edb18bc3c1884ea678b41a2e0b908ba882b648a1ffd70e31436a30aeab7fe569b6dbbb4d042973d7d06a6ee764f92a72843',
|
|
38
|
+
'044130f0531edb1db0d399206ed4359d9070f4e8ba38193098ddb3d2af00924847d843ee0961346af65647ae81949cc144b0f32c54be2e3a86effa98dd86ebadd0',
|
|
39
|
+
'046d3161213d66b5464ff6546d48f87a807849da6d58f3e58fbc4b21db89cd837955c37afae9a719a8f0899893398188d986b14971c390bc0a69bee8dfabdaa9ad',
|
|
40
|
+
'043e0d5b87f4db112911e1e83f3e5907c310caab70b5bc05980226ee20900d6c87c7b2d0004bf5bfe7af3a161174fe8b762bbc71886c7af1c4ad89166a8221b465',
|
|
41
|
+
'0435817aec4f46df42a3d3cbbe5def767c7eeee56be38b0e0977aa62c225fedd08b99c9496fb9cccbed3507044b4dd4db8191faa750f217cad9a581224106c2be7',
|
|
58
42
|
],
|
|
59
43
|
debug: {
|
|
60
44
|
rootPubKeys: [
|
|
@@ -73,6 +57,9 @@ exports.deviceAuthenticityConfig = {
|
|
|
73
57
|
'045b785b703810363deeadc0faa5a7388d8385f5e4f9170a3c27d3d2506bf9090d5b09044fbad6b906446d8cdb754b65869e8992b26a344e01ecff75844fe5a3d6',
|
|
74
58
|
'046442ece98b1cd13389b6eda3235e2848becc655db564897b2dc0862580f69b29be59dc30f92820f41a7a493b90623e66e1ee8529dbfd60d50aed97b46c4b8f64',
|
|
75
59
|
'0416960078e1d2b44df717ff5445ec76f4247333375982c5ae59b3bc223371f3cf81e7c182fd1ca36c95977070e2ff46f998bff3f00ab0de266edfdd430aea56b8',
|
|
60
|
+
'041aec4007b431c7b5978c126f7e9015e7601f47e835fe13e2028883a45fc8c5d039641474b8cad1e53c4c169fe7d1905402307850ada15b788353ca7c7000939b',
|
|
61
|
+
'04debf2a916d0c5209220ca6d202aefa174913b345d1cfd21a85ddc160626c70a559ac0ec1172041f679d99e3e1d6a30b84b04ed25ba47f707e9c2450dd4d8d1da',
|
|
62
|
+
'045d6d5119d95f29eba79d230df9c5531e0b7c030ba9e7de0cf48a2eb82c57f0a927977f0e1f23bda144d1e90f63b62dc86c14d46bee7bf676619b3db23dc17935',
|
|
76
63
|
],
|
|
77
64
|
debug: {
|
|
78
65
|
rootPubKeys: [
|
|
@@ -83,5 +70,19 @@ exports.deviceAuthenticityConfig = {
|
|
|
83
70
|
],
|
|
84
71
|
},
|
|
85
72
|
},
|
|
73
|
+
T3B1: {
|
|
74
|
+
rootPubKeys: [
|
|
75
|
+
'045b5c3fdd01f3602092834209b86df0ca86a9faf25cac35c73bf6237d66eb21eafcec3706f1ccd5eb4cc7f2fa1751213eccb1c78389afba89a5788ff31ee46a5d',
|
|
76
|
+
],
|
|
77
|
+
caPubKeys: [
|
|
78
|
+
'04860857f8ceb107cf03cc6ef56523b5e440e2ed51933cc49ac8a498063f06ab891bdafd0a1655aa287b9ded8a898d9532ec9d6550db3bb524e7af3e474b013d87',
|
|
79
|
+
'047962b89421e26daa51e0c368d6bbd7d49dcf972b0a6f148c115aedbba533e1574740dfa51c11992c276872ac2f11b3e0f54499c3347e83410142818ac4579b8e',
|
|
80
|
+
'04bc9f1e23ceed59b3e7b6b760a41f1f37ccc252adb1186e4035ec3f46266656400c7cd4c7153c9dec581b655c9ba1f74878c84128e60a66eed46e251e2eaf065f',
|
|
81
|
+
],
|
|
82
|
+
debug: {
|
|
83
|
+
rootPubKeys: [],
|
|
84
|
+
caPubKeys: [],
|
|
85
|
+
},
|
|
86
|
+
},
|
|
86
87
|
};
|
|
87
88
|
//# sourceMappingURL=deviceAuthenticityConfig.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Static } from '@trezor/schema-utils';
|
|
2
|
+
export type DeviceAuthenticityConfig = Static<typeof DeviceAuthenticityConfig>;
|
|
3
|
+
export declare const DeviceAuthenticityConfig: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
|
4
|
+
T2B1: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
|
5
|
+
rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
6
|
+
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
7
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
8
|
+
debug: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
9
|
+
rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
10
|
+
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
11
|
+
}>>;
|
|
12
|
+
}>]>;
|
|
13
|
+
T3B1: 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
|
+
}>]>;
|
|
22
|
+
T3T1: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
|
23
|
+
rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
24
|
+
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
25
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
26
|
+
debug: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
27
|
+
rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
28
|
+
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
29
|
+
}>>;
|
|
30
|
+
}>]>;
|
|
31
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
32
|
+
T1B1: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUndefined>;
|
|
33
|
+
T2T1: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUndefined>;
|
|
34
|
+
}>]>, import("@sinclair/typebox").TObject<{
|
|
35
|
+
version: import("@sinclair/typebox").TNumber;
|
|
36
|
+
timestamp: import("@sinclair/typebox").TString;
|
|
37
|
+
}>]>;
|
|
38
|
+
//# sourceMappingURL=deviceAuthenticityConfigTypes.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeviceAuthenticityConfig = void 0;
|
|
4
|
+
const schema_utils_1 = require("@trezor/schema-utils");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const CertPubKeys = schema_utils_1.Type.Object({
|
|
7
|
+
rootPubKeys: schema_utils_1.Type.Array(schema_utils_1.Type.String()),
|
|
8
|
+
caPubKeys: schema_utils_1.Type.Array(schema_utils_1.Type.String()),
|
|
9
|
+
});
|
|
10
|
+
const ModelsWithKeys = 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')]));
|
|
11
|
+
const ModelsWithoutKeys = schema_utils_1.Type.Extract(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')]));
|
|
12
|
+
const ModelPubKeys = schema_utils_1.Type.Intersect([
|
|
13
|
+
schema_utils_1.Type.Record(ModelsWithKeys, schema_utils_1.Type.Intersect([
|
|
14
|
+
CertPubKeys,
|
|
15
|
+
schema_utils_1.Type.Object({
|
|
16
|
+
debug: schema_utils_1.Type.Optional(CertPubKeys),
|
|
17
|
+
}),
|
|
18
|
+
])),
|
|
19
|
+
schema_utils_1.Type.Partial(schema_utils_1.Type.Record(ModelsWithoutKeys, schema_utils_1.Type.Undefined())),
|
|
20
|
+
]);
|
|
21
|
+
exports.DeviceAuthenticityConfig = schema_utils_1.Type.Intersect([
|
|
22
|
+
ModelPubKeys,
|
|
23
|
+
schema_utils_1.Type.Object({
|
|
24
|
+
version: schema_utils_1.Type.Number(),
|
|
25
|
+
timestamp: schema_utils_1.Type.String(),
|
|
26
|
+
}),
|
|
27
|
+
]);
|
|
28
|
+
//# sourceMappingURL=deviceAuthenticityConfigTypes.js.map
|
package/lib/data/models.d.ts
CHANGED
package/lib/data/models.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.models = void 0;
|
|
4
|
+
const t2b1 = {
|
|
5
|
+
name: 'Trezor Safe 3',
|
|
6
|
+
colors: {
|
|
7
|
+
'1': 'Cosmic Black',
|
|
8
|
+
'2': 'Stellar Silver',
|
|
9
|
+
'3': 'Solar Gold',
|
|
10
|
+
'4': 'Galactic Rose',
|
|
11
|
+
'5': 'Bitcoin Orange',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
4
14
|
exports.models = {
|
|
5
15
|
T1B1: {
|
|
6
16
|
name: 'Trezor Model One',
|
|
@@ -10,16 +20,8 @@ exports.models = {
|
|
|
10
20
|
name: 'Trezor Model T',
|
|
11
21
|
colors: {},
|
|
12
22
|
},
|
|
13
|
-
T2B1:
|
|
14
|
-
|
|
15
|
-
colors: {
|
|
16
|
-
'1': 'Cosmic Black',
|
|
17
|
-
'2': 'Stellar Silver',
|
|
18
|
-
'3': 'Solar Gold',
|
|
19
|
-
'4': 'Galactic Rose',
|
|
20
|
-
'5': 'Bitcoin Orange',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
+
T2B1: t2b1,
|
|
24
|
+
T3B1: t2b1,
|
|
23
25
|
T3T1: {
|
|
24
26
|
name: 'Trezor Safe 5',
|
|
25
27
|
colors: {
|
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.
|
|
4
|
+
exports.VERSION = '9.3.1-beta.1';
|
|
5
5
|
const versionN = exports.VERSION.split('.').map(s => parseInt(s, 10));
|
|
6
6
|
const isBeta = exports.VERSION.includes('beta');
|
|
7
7
|
exports.DEFAULT_DOMAIN = isBeta
|
package/lib/device/Device.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ export type RunOptions = {
|
|
|
12
12
|
onlyOneActivity?: boolean;
|
|
13
13
|
cancelPopupRequest?: () => any;
|
|
14
14
|
keepSession?: boolean;
|
|
15
|
-
useEmptyPassphrase?: boolean;
|
|
16
15
|
useCardanoDerivation?: boolean;
|
|
17
16
|
};
|
|
18
17
|
export declare const GET_FEATURES_TIMEOUT = 3000;
|
|
@@ -71,8 +70,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
71
70
|
setExternalState(state?: string): void;
|
|
72
71
|
getExternalState(): string;
|
|
73
72
|
validateState(preauthorized?: boolean): Promise<string | undefined>;
|
|
74
|
-
|
|
75
|
-
initialize(useEmptyPassphrase: boolean, useCardanoDerivation: boolean): Promise<void>;
|
|
73
|
+
initialize(useCardanoDerivation: boolean): Promise<void>;
|
|
76
74
|
getFeatures(): Promise<void>;
|
|
77
75
|
changeLanguage({ language, binary, }: {
|
|
78
76
|
language?: undefined;
|
package/lib/device/Device.js
CHANGED
|
@@ -172,7 +172,7 @@ class Device extends utils_1.TypedEmitter {
|
|
|
172
172
|
await this.acquire();
|
|
173
173
|
try {
|
|
174
174
|
if (fn) {
|
|
175
|
-
await this.initialize(!!options.
|
|
175
|
+
await this.initialize(!!options.useCardanoDerivation);
|
|
176
176
|
}
|
|
177
177
|
else {
|
|
178
178
|
await Promise.race([
|
|
@@ -232,9 +232,6 @@ class Device extends utils_1.TypedEmitter {
|
|
|
232
232
|
this.activitySessionID = null;
|
|
233
233
|
this.keepSession = false;
|
|
234
234
|
}
|
|
235
|
-
if (this.isT1() && this.useLegacyPassphrase()) {
|
|
236
|
-
this.setInternalState(undefined);
|
|
237
|
-
}
|
|
238
235
|
}
|
|
239
236
|
this.instance = instance;
|
|
240
237
|
}
|
|
@@ -247,9 +244,6 @@ class Device extends utils_1.TypedEmitter {
|
|
|
247
244
|
}
|
|
248
245
|
else if (state !== this.internalState[this.instance]) {
|
|
249
246
|
this.internalState[this.instance] = state;
|
|
250
|
-
if (this.useLegacyPassphrase() && this.isT1()) {
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
247
|
this.emit(events_1.DEVICE.SAVE_STATE, state);
|
|
254
248
|
}
|
|
255
249
|
}
|
|
@@ -279,7 +273,7 @@ class Device extends utils_1.TypedEmitter {
|
|
|
279
273
|
const expectedState = this.getExternalState();
|
|
280
274
|
const state = await this.getCommands().getDeviceState();
|
|
281
275
|
const uniqueState = `${state}@${this.features.device_id || 'device_id'}:${this.instance}`;
|
|
282
|
-
if (
|
|
276
|
+
if (this.features.session_id) {
|
|
283
277
|
this.setInternalState(this.features.session_id);
|
|
284
278
|
}
|
|
285
279
|
if (expectedState && expectedState !== uniqueState) {
|
|
@@ -289,26 +283,15 @@ class Device extends utils_1.TypedEmitter {
|
|
|
289
283
|
this.setExternalState(uniqueState);
|
|
290
284
|
}
|
|
291
285
|
}
|
|
292
|
-
|
|
293
|
-
return !this.atLeast(['1.9.0', '2.3.0']);
|
|
294
|
-
}
|
|
295
|
-
async initialize(useEmptyPassphrase, useCardanoDerivation) {
|
|
286
|
+
async initialize(useCardanoDerivation) {
|
|
296
287
|
let payload;
|
|
297
288
|
if (this.features) {
|
|
298
|
-
const legacy = this.useLegacyPassphrase();
|
|
299
289
|
const internalState = this.getInternalState();
|
|
300
290
|
payload = {};
|
|
301
291
|
payload.derive_cardano = useCardanoDerivation;
|
|
302
|
-
if (
|
|
292
|
+
if (internalState) {
|
|
303
293
|
payload.session_id = internalState;
|
|
304
294
|
}
|
|
305
|
-
if (legacy && !this.isT1()) {
|
|
306
|
-
payload.session_id = internalState;
|
|
307
|
-
if (useEmptyPassphrase) {
|
|
308
|
-
payload._skip_passphrase = useEmptyPassphrase;
|
|
309
|
-
payload.session_id = undefined;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
295
|
}
|
|
313
296
|
const { message } = await this.getCommands().typedCall('Initialize', 'Features', payload);
|
|
314
297
|
this._updateFeatures(message);
|
|
@@ -340,6 +323,9 @@ class Device extends utils_1.TypedEmitter {
|
|
|
340
323
|
version: this.getVersion(),
|
|
341
324
|
internal_model: this.features.internal_model,
|
|
342
325
|
});
|
|
326
|
+
if (!downloadedBinary) {
|
|
327
|
+
throw constants_1.ERRORS.TypedError('Runtime', 'changeLanguage: translation not found');
|
|
328
|
+
}
|
|
343
329
|
return this._uploadTranslationData(downloadedBinary);
|
|
344
330
|
}
|
|
345
331
|
async _uploadTranslationData(payload) {
|
|
@@ -260,9 +260,6 @@ class DeviceCommands {
|
|
|
260
260
|
}
|
|
261
261
|
if (res.type === 'ButtonRequest') {
|
|
262
262
|
this._cancelableRequestBySend = true;
|
|
263
|
-
if (res.message.code === '_Deprecated_ButtonRequest_PassphraseType') {
|
|
264
|
-
res.message.code = 'ButtonRequest_PassphraseType';
|
|
265
|
-
}
|
|
266
263
|
if (res.message.code === 'ButtonRequest_PassphraseEntry') {
|
|
267
264
|
this.device.emit(events_1.DEVICE.PASSPHRASE_ON_DEVICE);
|
|
268
265
|
}
|
|
@@ -285,25 +282,8 @@ class DeviceCommands {
|
|
|
285
282
|
}), () => this._commonCall('Cancel', {}));
|
|
286
283
|
}
|
|
287
284
|
if (res.type === 'PassphraseRequest') {
|
|
288
|
-
const state = this.device.getInternalState();
|
|
289
|
-
const legacy = this.device.useLegacyPassphrase();
|
|
290
|
-
const legacyT1 = legacy && this.device.isT1();
|
|
291
|
-
if (legacyT1 && typeof state === 'string') {
|
|
292
|
-
return this._commonCall('PassphraseAck', { passphrase: state });
|
|
293
|
-
}
|
|
294
|
-
if (legacy && res.message._on_device) {
|
|
295
|
-
this.device.emit(events_1.DEVICE.PASSPHRASE_ON_DEVICE);
|
|
296
|
-
return this._commonCall('PassphraseAck', { _state: state });
|
|
297
|
-
}
|
|
298
285
|
return this._promptPassphrase().then(response => {
|
|
299
|
-
const { passphrase, passphraseOnDevice
|
|
300
|
-
if (legacyT1) {
|
|
301
|
-
this.device.setInternalState(cache ? passphrase : undefined);
|
|
302
|
-
return this._commonCall('PassphraseAck', { passphrase });
|
|
303
|
-
}
|
|
304
|
-
if (legacy) {
|
|
305
|
-
return this._commonCall('PassphraseAck', { passphrase, _state: state });
|
|
306
|
-
}
|
|
286
|
+
const { passphrase, passphraseOnDevice } = response;
|
|
307
287
|
return !passphraseOnDevice
|
|
308
288
|
? this._commonCall('PassphraseAck', { passphrase })
|
|
309
289
|
: this._commonCall('PassphraseAck', { on_device: true });
|
|
@@ -311,11 +291,6 @@ class DeviceCommands {
|
|
|
311
291
|
throw err || e;
|
|
312
292
|
}));
|
|
313
293
|
}
|
|
314
|
-
if (res.type === 'Deprecated_PassphraseStateRequest') {
|
|
315
|
-
const { state } = res.message;
|
|
316
|
-
this.device.setInternalState(state);
|
|
317
|
-
return this._commonCall('Deprecated_PassphraseStateAck', {});
|
|
318
|
-
}
|
|
319
294
|
if (res.type === 'WordRequest') {
|
|
320
295
|
return this._promptWord(res.message.type).then(word => this._commonCall('WordAck', { word }), () => this._commonCall('Cancel', {}));
|
|
321
296
|
}
|
package/lib/events/core.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ import type { IFrameCallMessage, MethodResponseMessage } from './call';
|
|
|
3
3
|
import type { DeviceEventMessage } from './device';
|
|
4
4
|
import type { IFrameEventMessage, IFrameInit, IFrameLogRequest } from './iframe';
|
|
5
5
|
import type { PopupAnalyticsResponse, PopupClosedMessage, PopupEventMessage } from './popup';
|
|
6
|
-
import type { TransportEventMessage, TransportDisableWebUSB, TransportRequestWebUSBDevice } from './transport';
|
|
6
|
+
import type { TransportEventMessage, TransportDisableWebUSB, TransportRequestWebUSBDevice, TransportGetInfo } from './transport';
|
|
7
7
|
import type { UiEventMessage } from './ui-request';
|
|
8
8
|
import type { UiResponseEvent } from './ui-response';
|
|
9
9
|
import type { Unsuccessful } from '../types/params';
|
|
10
10
|
export declare const CORE_EVENT = "CORE_EVENT";
|
|
11
|
-
export type CoreRequestMessage = PopupClosedMessage | PopupAnalyticsResponse | TransportDisableWebUSB | TransportRequestWebUSBDevice | UiResponseEvent | IFrameInit | IFrameCallMessage | IFrameLogRequest;
|
|
11
|
+
export type CoreRequestMessage = PopupClosedMessage | PopupAnalyticsResponse | TransportDisableWebUSB | TransportRequestWebUSBDevice | TransportGetInfo | UiResponseEvent | IFrameInit | IFrameCallMessage | IFrameLogRequest;
|
|
12
12
|
export type CoreEventMessage = {
|
|
13
13
|
success?: boolean;
|
|
14
14
|
channel?: {
|
|
@@ -52,6 +52,11 @@ export interface TransportRequestWebUSBDevice {
|
|
|
52
52
|
type: typeof TRANSPORT.REQUEST_DEVICE;
|
|
53
53
|
payload?: undefined;
|
|
54
54
|
}
|
|
55
|
+
export interface TransportGetInfo {
|
|
56
|
+
id: number;
|
|
57
|
+
type: typeof TRANSPORT.GET_INFO;
|
|
58
|
+
payload?: undefined;
|
|
59
|
+
}
|
|
55
60
|
export type TransportEventMessage = TransportEvent & {
|
|
56
61
|
event: typeof TRANSPORT_EVENT;
|
|
57
62
|
};
|
package/lib/index.js
CHANGED
|
@@ -30,7 +30,7 @@ const onCoreEvent = (message) => {
|
|
|
30
30
|
var _a;
|
|
31
31
|
const { event, type, payload } = message;
|
|
32
32
|
if (type === events_2.UI.REQUEST_UI_WINDOW) {
|
|
33
|
-
(_a = coreManager.
|
|
33
|
+
(_a = coreManager.get()) === null || _a === void 0 ? void 0 : _a.handleMessage({ type: events_2.POPUP.HANDSHAKE });
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
if (type === events_2.POPUP.CANCEL_POPUP_REQUEST)
|
|
@@ -64,11 +64,8 @@ const onCoreEvent = (message) => {
|
|
|
64
64
|
_log.warn('Undefined message', event, message);
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
const
|
|
67
|
+
const initSettings = (settings = {}) => {
|
|
68
68
|
var _a;
|
|
69
|
-
if (coreManager.getCore() || coreManager.getInitPromise()) {
|
|
70
|
-
throw constants_1.ERRORS.TypedError('Init_AlreadyInitialized');
|
|
71
|
-
}
|
|
72
69
|
_settings = (0, connectSettings_1.parseConnectSettings)({ ..._settings, ...settings, popup: false });
|
|
73
70
|
if (!_settings.manifest) {
|
|
74
71
|
throw constants_1.ERRORS.TypedError('Init_ManifestMissing');
|
|
@@ -76,19 +73,25 @@ const init = async (settings = {}) => {
|
|
|
76
73
|
if (!((_a = _settings.transports) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
77
74
|
_settings.transports = ['BridgeTransport'];
|
|
78
75
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
};
|
|
77
|
+
const init = async (settings = {}) => {
|
|
78
|
+
if (coreManager.get() || coreManager.getPending()) {
|
|
79
|
+
throw constants_1.ERRORS.TypedError('Init_AlreadyInitialized');
|
|
80
|
+
}
|
|
81
|
+
initSettings(settings);
|
|
82
|
+
if (!_settings.lazyLoad) {
|
|
83
|
+
await coreManager.getOrInit(_settings, onCoreEvent);
|
|
82
84
|
}
|
|
83
|
-
|
|
85
|
+
};
|
|
86
|
+
const initCore = () => {
|
|
87
|
+
initSettings({ lazyLoad: false });
|
|
88
|
+
return coreManager.getOrInit(_settings, onCoreEvent);
|
|
84
89
|
};
|
|
85
90
|
const call = async (params) => {
|
|
91
|
+
var _a, _b;
|
|
86
92
|
let core;
|
|
87
93
|
try {
|
|
88
|
-
|
|
89
|
-
await init();
|
|
90
|
-
}
|
|
91
|
-
core = await coreManager.getOrInitCore(_settings, onCoreEvent);
|
|
94
|
+
core = (_b = (_a = coreManager.get()) !== null && _a !== void 0 ? _a : (await coreManager.getPending())) !== null && _b !== void 0 ? _b : (await initCore());
|
|
92
95
|
}
|
|
93
96
|
catch (error) {
|
|
94
97
|
return (0, events_2.createErrorMessage)(error);
|
|
@@ -101,10 +104,7 @@ const call = async (params) => {
|
|
|
101
104
|
id: promiseId,
|
|
102
105
|
});
|
|
103
106
|
const response = await promise;
|
|
104
|
-
|
|
105
|
-
return response;
|
|
106
|
-
}
|
|
107
|
-
return (0, events_2.createErrorMessage)(constants_1.ERRORS.TypedError('Method_NoResponse'));
|
|
107
|
+
return response !== null && response !== void 0 ? response : (0, events_2.createErrorMessage)(constants_1.ERRORS.TypedError('Method_NoResponse'));
|
|
108
108
|
}
|
|
109
109
|
catch (error) {
|
|
110
110
|
_log.error('call', error);
|
|
@@ -112,7 +112,7 @@ const call = async (params) => {
|
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
const uiResponse = (response) => {
|
|
115
|
-
const core = coreManager.
|
|
115
|
+
const core = coreManager.get();
|
|
116
116
|
if (!core) {
|
|
117
117
|
throw constants_1.ERRORS.TypedError('Init_NotInitialized');
|
|
118
118
|
}
|
|
@@ -121,7 +121,7 @@ const uiResponse = (response) => {
|
|
|
121
121
|
const requestLogin = async (params) => {
|
|
122
122
|
if (typeof params.callback === 'function') {
|
|
123
123
|
const { callback } = params;
|
|
124
|
-
const core = coreManager.
|
|
124
|
+
const core = coreManager.get();
|
|
125
125
|
const loginChallengeListener = async (event) => {
|
|
126
126
|
const { data } = event;
|
|
127
127
|
if (data && data.type === events_2.UI.LOGIN_CHALLENGE_REQUEST) {
|
|
@@ -153,7 +153,7 @@ const requestLogin = async (params) => {
|
|
|
153
153
|
return call({ method: 'requestLogin', ...params });
|
|
154
154
|
};
|
|
155
155
|
const cancel = (error) => {
|
|
156
|
-
const core = coreManager.
|
|
156
|
+
const core = coreManager.get();
|
|
157
157
|
if (!core) {
|
|
158
158
|
throw constants_1.ERRORS.TypedError('Runtime', 'postMessage: _core not found');
|
|
159
159
|
}
|
|
@@ -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
|
+
T3B1: 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
|
T3T1: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
|
16
25
|
rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
17
26
|
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AuthenticateDeviceParams = void 0;
|
|
4
4
|
const schema_utils_1 = require("@trezor/schema-utils");
|
|
5
|
-
const
|
|
5
|
+
const deviceAuthenticityConfigTypes_1 = require("../../data/deviceAuthenticityConfigTypes");
|
|
6
6
|
exports.AuthenticateDeviceParams = schema_utils_1.Type.Object({
|
|
7
|
-
config: schema_utils_1.Type.Optional(
|
|
7
|
+
config: schema_utils_1.Type.Optional(deviceAuthenticityConfigTypes_1.DeviceAuthenticityConfig),
|
|
8
8
|
allowDebugKeys: schema_utils_1.Type.Optional(schema_utils_1.Type.Boolean()),
|
|
9
9
|
});
|
|
10
10
|
//# sourceMappingURL=authenticateDevice.js.map
|
|
@@ -4,5 +4,8 @@ export interface CheckFirmwareAuthenticityResponse {
|
|
|
4
4
|
actualFirmwareHash: string;
|
|
5
5
|
valid: boolean;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export type CheckFirmwareAuthenticityParams = CommonParams & {
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function checkFirmwareAuthenticity(params: CheckFirmwareAuthenticityParams): Response<CheckFirmwareAuthenticityResponse>;
|
|
8
11
|
//# sourceMappingURL=checkFirmwareAuthenticity.d.ts.map
|
package/lib/types/api/init.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ConnectSettingsPublic, Manifest } from '../settings';
|
|
2
2
|
export declare function init(settings: {
|
|
3
3
|
manifest: Manifest;
|
|
4
|
-
} & Partial<
|
|
4
|
+
} & Partial<ConnectSettingsPublic>): Promise<void>;
|
|
5
5
|
//# sourceMappingURL=init.d.ts.map
|