@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
|
@@ -37,21 +37,14 @@ const derToAsn1 = (byteArray) => {
|
|
|
37
37
|
const cls = (byteArray[0] & 0xc0) / 64;
|
|
38
38
|
const structured = (byteArray[0] & 0x20) === 0x20;
|
|
39
39
|
const tag = getTag();
|
|
40
|
+
if (byteArray[position] === 0x80) {
|
|
41
|
+
throw new Error('Unsupported length encoding');
|
|
42
|
+
}
|
|
40
43
|
let length = getLength();
|
|
41
44
|
let byteLength;
|
|
42
45
|
let contents;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
while (byteArray[position + length] !== 0 || byteArray[position + length + 1] !== 0) {
|
|
46
|
-
length += 1;
|
|
47
|
-
}
|
|
48
|
-
byteLength = position + length + 2;
|
|
49
|
-
contents = byteArray.subarray(position, position + length);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
byteLength = position + length;
|
|
53
|
-
contents = byteArray.subarray(position, byteLength);
|
|
54
|
-
}
|
|
46
|
+
byteLength = position + length;
|
|
47
|
+
contents = byteArray.subarray(position, byteLength);
|
|
55
48
|
const raw = byteArray.subarray(0, byteLength);
|
|
56
49
|
return {
|
|
57
50
|
cls,
|
|
@@ -195,6 +188,82 @@ const parseValidity = (asn1) => {
|
|
|
195
188
|
to: parseUtcTime(to),
|
|
196
189
|
};
|
|
197
190
|
};
|
|
191
|
+
const parseExtensions = (data) => {
|
|
192
|
+
const asn1 = derToAsn1(data.contents);
|
|
193
|
+
if (asn1.cls !== 0 || asn1.tag !== 16 || !asn1.structured) {
|
|
194
|
+
throw new Error("This can't be a Extension. Wrong data type.");
|
|
195
|
+
}
|
|
196
|
+
const readBoolean = (value) => {
|
|
197
|
+
if (!value)
|
|
198
|
+
return false;
|
|
199
|
+
if (value.cls !== 0 || value.tag !== 1 || value.contents.length !== 1 || value.structured) {
|
|
200
|
+
throw new Error("This can't be a boolean. Wrong data type.");
|
|
201
|
+
}
|
|
202
|
+
if (![0x00, 0xff].includes(value.contents[0])) {
|
|
203
|
+
throw new Error('Invalid boolean value.');
|
|
204
|
+
}
|
|
205
|
+
return value.contents[0] === 0xff;
|
|
206
|
+
};
|
|
207
|
+
const readBitString = (uint8Array) => {
|
|
208
|
+
const buffer = Buffer.from(uint8Array);
|
|
209
|
+
const tag = buffer.readUInt8(0);
|
|
210
|
+
if (tag !== 3) {
|
|
211
|
+
throw new Error("This can't be a bit string. Wrong data type.");
|
|
212
|
+
}
|
|
213
|
+
const length = buffer.readUInt8(1);
|
|
214
|
+
const unusedBits = buffer.readUInt8(2);
|
|
215
|
+
const bitStringBytes = buffer.subarray(3, 3 + length - 1);
|
|
216
|
+
const bitString = bitStringBytes.reduce((str, byte) => str + byte.toString(2).padStart(8, '0'), '');
|
|
217
|
+
return bitString.slice(0, bitString.length - unusedBits);
|
|
218
|
+
};
|
|
219
|
+
const readInteger = (value) => {
|
|
220
|
+
if (!value)
|
|
221
|
+
return undefined;
|
|
222
|
+
if (value.cls !== 0 || value.tag !== 2 || value.contents.length !== 1 || value.structured) {
|
|
223
|
+
throw new Error("This can't be a integer. Wrong data type.");
|
|
224
|
+
}
|
|
225
|
+
return Buffer.from(value.contents).readInt8();
|
|
226
|
+
};
|
|
227
|
+
const extensions = [];
|
|
228
|
+
derToAsn1List(asn1.contents).forEach(item => {
|
|
229
|
+
const [id, ...pieces] = derToAsn1List(item.contents);
|
|
230
|
+
if (id.cls !== 0 || id.tag !== 6 || id.structured) {
|
|
231
|
+
throw new Error('Bad extension. Does not begin with an OBJECT IDENTIFIER.');
|
|
232
|
+
}
|
|
233
|
+
const algorithm = derObjectIdentifierValue(id.contents);
|
|
234
|
+
const critical = pieces.length > 1 ? readBoolean(pieces[0]) : false;
|
|
235
|
+
const extnValue = pieces.length > 1 ? pieces[1] : pieces[0];
|
|
236
|
+
if (extnValue.cls !== 0 || extnValue.tag !== 4 || extnValue.structured) {
|
|
237
|
+
throw new Error("This can't be a octet string. Wrong data type.");
|
|
238
|
+
}
|
|
239
|
+
if (algorithm === '2.5.29.15') {
|
|
240
|
+
extensions.push({
|
|
241
|
+
key: 'keyUsage',
|
|
242
|
+
critical,
|
|
243
|
+
keyCertSign: readBitString(extnValue.contents)[5],
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
else if (algorithm === '2.5.29.19') {
|
|
247
|
+
const fields = derToAsn1List(derToAsn1(extnValue.contents).contents);
|
|
248
|
+
const ca = fields.length > 0 && fields[0].tag === 1 ? fields[0] : undefined;
|
|
249
|
+
const len = fields.length > 0 && fields[0].tag === 2 ? fields[0] : fields[1];
|
|
250
|
+
extensions.push({
|
|
251
|
+
key: 'basicConstraints',
|
|
252
|
+
critical,
|
|
253
|
+
cA: readBoolean(ca),
|
|
254
|
+
pathLenConstraint: readInteger(len),
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
extensions.push({
|
|
259
|
+
key: algorithm,
|
|
260
|
+
critical,
|
|
261
|
+
...item,
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
return extensions;
|
|
266
|
+
};
|
|
198
267
|
const parseTBSCertificate = (asn1) => {
|
|
199
268
|
if (asn1.cls !== 0 || asn1.tag !== 16 || !asn1.structured) {
|
|
200
269
|
throw new Error("This can't be a TBSCertificate. Wrong data type.");
|
|
@@ -212,7 +281,7 @@ const parseTBSCertificate = (asn1) => {
|
|
|
212
281
|
validity: parseValidity(pieces[4]),
|
|
213
282
|
subject: (0, exports.parseName)(pieces[5]),
|
|
214
283
|
subjectPublicKeyInfo: parseSubjectPublicKeyInfo(pieces[6]),
|
|
215
|
-
extensions: pieces[7],
|
|
284
|
+
extensions: parseExtensions(pieces[7]),
|
|
216
285
|
};
|
|
217
286
|
};
|
|
218
287
|
const parseCertificate = (byteArray) => {
|
package/lib/api/getCoinInfo.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export default class GetCoinInfo extends AbstractMethod<'getCoinInfo', Params> {
|
|
|
21
21
|
T1B1: string | false;
|
|
22
22
|
T2T1: string | false;
|
|
23
23
|
T2B1: string | false;
|
|
24
|
+
T3B1: string | false;
|
|
24
25
|
T3T1: string | false;
|
|
25
26
|
connect: boolean;
|
|
26
27
|
};
|
|
@@ -77,6 +78,7 @@ export default class GetCoinInfo extends AbstractMethod<'getCoinInfo', Params> {
|
|
|
77
78
|
T1B1: string | false;
|
|
78
79
|
T2T1: string | false;
|
|
79
80
|
T2B1: string | false;
|
|
81
|
+
T3B1: string | false;
|
|
80
82
|
T3T1: string | false;
|
|
81
83
|
connect: boolean;
|
|
82
84
|
};
|
|
@@ -108,6 +110,7 @@ export default class GetCoinInfo extends AbstractMethod<'getCoinInfo', Params> {
|
|
|
108
110
|
T1B1: string | false;
|
|
109
111
|
T2T1: string | false;
|
|
110
112
|
T2B1: string | false;
|
|
113
|
+
T3B1: string | false;
|
|
111
114
|
T3T1: string | false;
|
|
112
115
|
connect: boolean;
|
|
113
116
|
};
|
package/lib/api/getFeatures.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export default class GetFeatures extends AbstractMethod<'getFeatures'> {
|
|
|
15
15
|
language_version_matches?: boolean | undefined;
|
|
16
16
|
unit_packaging?: number | undefined;
|
|
17
17
|
recovery_type?: "NormalRecovery" | "DryRun" | "UnlockRepeatedBackup" | undefined;
|
|
18
|
+
optiga_sec?: number | undefined;
|
|
18
19
|
flags: number | null;
|
|
19
20
|
language: string | null;
|
|
20
21
|
label: string | null;
|
|
@@ -22,6 +22,15 @@ const getWorker = (type) => {
|
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
+
const getNormalizedShortcut = (shortcut) => {
|
|
26
|
+
if (shortcut === 'tXRP') {
|
|
27
|
+
return 'XRP';
|
|
28
|
+
}
|
|
29
|
+
if (shortcut.toLowerCase() === 'bsc') {
|
|
30
|
+
return 'bnb';
|
|
31
|
+
}
|
|
32
|
+
return shortcut;
|
|
33
|
+
};
|
|
25
34
|
class Blockchain {
|
|
26
35
|
constructor(options) {
|
|
27
36
|
this.feeForBlock = [];
|
|
@@ -72,7 +81,7 @@ class Blockchain {
|
|
|
72
81
|
throw constants_1.ERRORS.TypedError('Backend_Error', error.message);
|
|
73
82
|
}
|
|
74
83
|
this.serverInfo = info;
|
|
75
|
-
const shortcut = this.coinInfo.shortcut
|
|
84
|
+
const shortcut = getNormalizedShortcut(this.coinInfo.shortcut);
|
|
76
85
|
if (info.shortcut.toLowerCase() !== shortcut.toLowerCase()) {
|
|
77
86
|
throw constants_1.ERRORS.TypedError('Backend_Invalid');
|
|
78
87
|
}
|
package/lib/core/index.d.ts
CHANGED
|
@@ -14,9 +14,9 @@ export declare class Core extends EventEmitter {
|
|
|
14
14
|
init(settings: ConnectSettings, onCoreEvent: (message: CoreEventMessage) => void, logWriterFactory?: () => LogWriter | undefined): Promise<void>;
|
|
15
15
|
}
|
|
16
16
|
export declare const initCoreState: () => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
get: () => Core | undefined;
|
|
18
|
+
getPending: () => Promise<Core> | undefined;
|
|
19
|
+
getOrInit: (settings: ConnectSettings, onCoreEvent: (message: CoreEventMessage) => void, logWriterFactory?: (() => LogWriter) | undefined) => Promise<Core>;
|
|
20
20
|
dispose: () => void;
|
|
21
21
|
};
|
|
22
22
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/core/index.js
CHANGED
|
@@ -20,7 +20,6 @@ const debug_1 = require("../utils/debug");
|
|
|
20
20
|
const BlockchainLink_1 = require("../backend/BlockchainLink");
|
|
21
21
|
const interactionTimeout_1 = require("../utils/interactionTimeout");
|
|
22
22
|
const onCallFirmwareUpdate_1 = require("./onCallFirmwareUpdate");
|
|
23
|
-
const coreManager_1 = require("./coreManager");
|
|
24
23
|
let _core;
|
|
25
24
|
let _deviceList;
|
|
26
25
|
const _callMethods = [];
|
|
@@ -246,7 +245,7 @@ const inner = async (method, device) => {
|
|
|
246
245
|
const uiResp = await uiPromise.promise;
|
|
247
246
|
if (uiResp.payload) {
|
|
248
247
|
device.setInternalState(undefined);
|
|
249
|
-
await device.initialize(method.
|
|
248
|
+
await device.initialize(method.useCardanoDerivation);
|
|
250
249
|
invalidDeviceState = await getInvalidDeviceState(device, method.preauthorized);
|
|
251
250
|
}
|
|
252
251
|
else {
|
|
@@ -429,7 +428,6 @@ const onCall = async (message) => {
|
|
|
429
428
|
});
|
|
430
429
|
await device.run(innerAction, {
|
|
431
430
|
keepSession: method.keepSession,
|
|
432
|
-
useEmptyPassphrase: method.useEmptyPassphrase,
|
|
433
431
|
skipFinalReload: method.skipFinalReload,
|
|
434
432
|
useCardanoDerivation: method.useCardanoDerivation,
|
|
435
433
|
});
|
|
@@ -672,6 +670,9 @@ class Core extends events_1.default {
|
|
|
672
670
|
case transport_1.TRANSPORT.REQUEST_DEVICE:
|
|
673
671
|
_deviceList === null || _deviceList === void 0 ? void 0 : _deviceList.enumerate();
|
|
674
672
|
break;
|
|
673
|
+
case transport_1.TRANSPORT.GET_INFO:
|
|
674
|
+
postMessage((0, events_2.createResponseMessage)(message.id, true, this.getTransportInfo()));
|
|
675
|
+
break;
|
|
675
676
|
case events_2.UI.RECEIVE_DEVICE:
|
|
676
677
|
case events_2.UI.RECEIVE_CONFIRMATION:
|
|
677
678
|
case events_2.UI.RECEIVE_PERMISSION:
|
|
@@ -754,7 +755,8 @@ class Core extends events_1.default {
|
|
|
754
755
|
throw error;
|
|
755
756
|
}
|
|
756
757
|
try {
|
|
757
|
-
if (!DataManager_1.DataManager.getSettings('transportReconnect')
|
|
758
|
+
if (!DataManager_1.DataManager.getSettings('transportReconnect') ||
|
|
759
|
+
DataManager_1.DataManager.getSettings('coreMode') === 'auto') {
|
|
758
760
|
await initDeviceList(false);
|
|
759
761
|
}
|
|
760
762
|
else {
|
|
@@ -791,8 +793,23 @@ const disableWebUSBTransport = async () => {
|
|
|
791
793
|
catch (error) {
|
|
792
794
|
}
|
|
793
795
|
};
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
+
const initCore = async (settings, onCoreEvent, logWriterFactory) => {
|
|
797
|
+
const core = new Core();
|
|
798
|
+
let promise;
|
|
799
|
+
const eventThrottle = (...args) => promise
|
|
800
|
+
.then(() => {
|
|
801
|
+
setTimeout(() => onCoreEvent(...args), 0);
|
|
802
|
+
})
|
|
803
|
+
.catch(() => { });
|
|
804
|
+
promise = core.init(settings, eventThrottle, logWriterFactory);
|
|
805
|
+
await promise;
|
|
806
|
+
core.on(events_2.CORE_EVENT, onCoreEvent);
|
|
807
|
+
core.off(events_2.CORE_EVENT, eventThrottle);
|
|
808
|
+
return core;
|
|
809
|
+
};
|
|
810
|
+
const disposeCore = (core) => {
|
|
811
|
+
core.dispose();
|
|
796
812
|
};
|
|
813
|
+
const initCoreState = () => (0, utils_1.createLazy)(initCore, disposeCore);
|
|
797
814
|
exports.initCoreState = initCoreState;
|
|
798
815
|
//# sourceMappingURL=index.js.map
|
|
@@ -71,24 +71,29 @@ const waitForReconnectedDevice = async ({ bootloader, method, intermediary }, {
|
|
|
71
71
|
await reconnectedDevice.acquire();
|
|
72
72
|
return reconnectedDevice;
|
|
73
73
|
};
|
|
74
|
-
const getInstallationParams = (device,
|
|
75
|
-
var _a;
|
|
74
|
+
const getInstallationParams = (device, params) => {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
const btcOnly = (_a = params.btcOnly) !== null && _a !== void 0 ? _a : device.firmwareType === 'bitcoin-only';
|
|
76
77
|
if (!device.features.bootloader_mode) {
|
|
77
|
-
const version =
|
|
78
|
+
const version = params.binary
|
|
79
|
+
? (0, firmware_1.parseFirmwareHeaders)(Buffer.from(params.binary)).version
|
|
80
|
+
: undefined;
|
|
78
81
|
const isUpdatingToNewerVersion = !version
|
|
79
|
-
? (
|
|
82
|
+
? (_b = device.firmwareRelease) === null || _b === void 0 ? void 0 : _b.isNewer
|
|
80
83
|
: (0, versionUtils_1.isNewer)(version, [
|
|
81
84
|
device.features.major_version,
|
|
82
85
|
device.features.minor_version,
|
|
83
86
|
device.features.patch_version,
|
|
84
87
|
]);
|
|
85
|
-
const
|
|
88
|
+
const isUpdatingToEqualFirmwareType = (device.firmwareType === 'bitcoin-only') === btcOnly;
|
|
89
|
+
const upgrade = device.atLeast('2.6.3') && isUpdatingToNewerVersion && isUpdatingToEqualFirmwareType;
|
|
86
90
|
const manual = !device.atLeast(['1.10.0', '2.6.0']) && !upgrade;
|
|
87
91
|
const language = device.atLeast('2.7.0');
|
|
88
92
|
return {
|
|
89
93
|
manual,
|
|
90
94
|
upgrade,
|
|
91
95
|
language,
|
|
96
|
+
btcOnly,
|
|
92
97
|
};
|
|
93
98
|
}
|
|
94
99
|
else {
|
|
@@ -96,23 +101,23 @@ const getInstallationParams = (device, binary) => {
|
|
|
96
101
|
manual: false,
|
|
97
102
|
upgrade: false,
|
|
98
103
|
language: false,
|
|
104
|
+
btcOnly,
|
|
99
105
|
};
|
|
100
106
|
}
|
|
101
107
|
};
|
|
102
108
|
const getFwHeader = (binary) => Buffer.from(binary.slice(0, 6000)).toString('hex');
|
|
103
|
-
const getBinaryHelper = (device, params, log, postMessage, intermediaryVersion) => {
|
|
109
|
+
const getBinaryHelper = (device, params, log, postMessage, btcOnly, intermediaryVersion) => {
|
|
104
110
|
var _a;
|
|
105
111
|
if (!device.firmwareRelease) {
|
|
106
112
|
throw constants_1.ERRORS.TypedError('Runtime', 'device.firmwareRelease is not set');
|
|
107
113
|
}
|
|
108
|
-
const btcOnly = params.btcOnly || (params.btcOnly === undefined && device.firmwareType === 'bitcoin-only');
|
|
109
114
|
log.debug('onCallFirmwareUpdate loading binary', 'intermediaryVersion', intermediaryVersion, 'version', device.firmwareRelease.release.version, 'btcOnly', btcOnly);
|
|
110
115
|
postMessage((0, events_1.createUiMessage)(events_1.UI.FIRMWARE_PROGRESS, {
|
|
111
116
|
device: device.toMessageObject(),
|
|
112
117
|
operation: 'downloading',
|
|
113
118
|
progress: 0,
|
|
114
119
|
}));
|
|
115
|
-
return (0, firmware_1.
|
|
120
|
+
return (0, firmware_1.getBinaryForFirmwareUpgrade)({
|
|
116
121
|
features: device.features,
|
|
117
122
|
releases: (0, firmwareInfo_1.getReleases)((_a = device.features) === null || _a === void 0 ? void 0 : _a.internal_model),
|
|
118
123
|
baseUrl: params.baseUrl || 'https://data.trezor.io',
|
|
@@ -166,10 +171,15 @@ const onCallFirmwareUpdate = async ({ params, context: { deviceList, postMessage
|
|
|
166
171
|
}
|
|
167
172
|
log.debug('onCallFirmwareUpdate', 'device', device);
|
|
168
173
|
registerEvents(device, postMessage);
|
|
169
|
-
const { manual, upgrade, language } = getInstallationParams(device, params
|
|
170
|
-
log.debug('onCallFirmwareUpdate', 'installation params', {
|
|
174
|
+
const { manual, upgrade, language, btcOnly } = getInstallationParams(device, params);
|
|
175
|
+
log.debug('onCallFirmwareUpdate', 'installation params', {
|
|
176
|
+
manual,
|
|
177
|
+
upgrade,
|
|
178
|
+
language,
|
|
179
|
+
btcOnly,
|
|
180
|
+
});
|
|
171
181
|
const binary = params.binary ||
|
|
172
|
-
(await getBinaryHelper(device, params, log, postMessage, device.firmwareRelease.intermediaryVersion));
|
|
182
|
+
(await getBinaryHelper(device, params, log, postMessage, btcOnly, device.firmwareRelease.intermediaryVersion));
|
|
173
183
|
const deviceInitiallyConnectedInBootloader = device.features.bootloader_mode;
|
|
174
184
|
const deviceInitiallyConnectedWithoutFirmware = device.features.firmware_present === false;
|
|
175
185
|
let reconnectedDevice = device;
|
|
@@ -194,6 +204,7 @@ const onCallFirmwareUpdate = async ({ params, context: { deviceList, postMessage
|
|
|
194
204
|
language: targetLanguage,
|
|
195
205
|
version: device.firmwareRelease.release.version,
|
|
196
206
|
internal_model: device.features.internal_model,
|
|
207
|
+
}).catch(() => {
|
|
197
208
|
})
|
|
198
209
|
: null;
|
|
199
210
|
if (!languageBlob) {
|
|
@@ -216,14 +227,14 @@ const onCallFirmwareUpdate = async ({ params, context: { deviceList, postMessage
|
|
|
216
227
|
reconnectedDevice = await waitForReconnectedDevice({ bootloader: true, method: 'auto' }, { deviceList, device, log, postMessage, abortSignal });
|
|
217
228
|
}
|
|
218
229
|
const intermediary = !params.binary && device.firmwareRelease.intermediaryVersion;
|
|
219
|
-
await reconnectedDevice.initialize(false
|
|
230
|
+
await reconnectedDevice.initialize(false);
|
|
220
231
|
let stripped = (0, firmware_1.stripFwHeaders)(binary);
|
|
221
232
|
await (0, firmware_1.uploadFirmware)(reconnectedDevice.getCommands().typedCall.bind(reconnectedDevice.getCommands()), postMessage, reconnectedDevice, { payload: !intermediary && (0, firmware_1.shouldStripFwHeaders)(device.features) ? stripped : binary });
|
|
222
233
|
await reconnectedDevice.release();
|
|
223
234
|
if (intermediary) {
|
|
224
235
|
reconnectedDevice = await waitForReconnectedDevice({ bootloader: true, method: 'manual', intermediary: true }, { deviceList, device: reconnectedDevice, log, postMessage, abortSignal });
|
|
225
|
-
stripped = (0, firmware_1.stripFwHeaders)(await getBinaryHelper(reconnectedDevice, params, log, postMessage));
|
|
226
|
-
await reconnectedDevice.initialize(false
|
|
236
|
+
stripped = (0, firmware_1.stripFwHeaders)(await getBinaryHelper(reconnectedDevice, params, log, postMessage, btcOnly));
|
|
237
|
+
await reconnectedDevice.initialize(false);
|
|
227
238
|
await (0, firmware_1.uploadFirmware)(reconnectedDevice.getCommands().typedCall.bind(reconnectedDevice.getCommands()), postMessage, reconnectedDevice, { payload: stripped });
|
|
228
239
|
await reconnectedDevice.release();
|
|
229
240
|
}
|
|
@@ -74,6 +74,7 @@ export declare class DataManager {
|
|
|
74
74
|
T1B1: string;
|
|
75
75
|
T2T1: string;
|
|
76
76
|
T2B1?: undefined;
|
|
77
|
+
T3B1?: undefined;
|
|
77
78
|
T3T1?: undefined;
|
|
78
79
|
};
|
|
79
80
|
max: undefined;
|
|
@@ -85,6 +86,7 @@ export declare class DataManager {
|
|
|
85
86
|
T1B1: string;
|
|
86
87
|
T2T1: string;
|
|
87
88
|
T2B1?: undefined;
|
|
89
|
+
T3B1?: undefined;
|
|
88
90
|
T3T1?: undefined;
|
|
89
91
|
};
|
|
90
92
|
comment: string[];
|
|
@@ -97,6 +99,7 @@ export declare class DataManager {
|
|
|
97
99
|
T1B1: string;
|
|
98
100
|
T2T1: string;
|
|
99
101
|
T2B1?: undefined;
|
|
102
|
+
T3B1?: undefined;
|
|
100
103
|
T3T1?: undefined;
|
|
101
104
|
};
|
|
102
105
|
comment: string[];
|
|
@@ -109,6 +112,7 @@ export declare class DataManager {
|
|
|
109
112
|
T1B1: string;
|
|
110
113
|
T2T1: string;
|
|
111
114
|
T2B1?: undefined;
|
|
115
|
+
T3B1?: undefined;
|
|
112
116
|
T3T1?: undefined;
|
|
113
117
|
};
|
|
114
118
|
comment: string[];
|
|
@@ -122,6 +126,7 @@ export declare class DataManager {
|
|
|
122
126
|
T1B1: string;
|
|
123
127
|
T2T1: string;
|
|
124
128
|
T2B1?: undefined;
|
|
129
|
+
T3B1?: undefined;
|
|
125
130
|
T3T1?: undefined;
|
|
126
131
|
};
|
|
127
132
|
comment: string[];
|
|
@@ -134,6 +139,7 @@ export declare class DataManager {
|
|
|
134
139
|
T1B1: string;
|
|
135
140
|
T2T1: string;
|
|
136
141
|
T2B1?: undefined;
|
|
142
|
+
T3B1?: undefined;
|
|
137
143
|
T3T1?: undefined;
|
|
138
144
|
};
|
|
139
145
|
coin?: undefined;
|
|
@@ -145,6 +151,7 @@ export declare class DataManager {
|
|
|
145
151
|
T1B1: string;
|
|
146
152
|
T2T1: string;
|
|
147
153
|
T2B1: string;
|
|
154
|
+
T3B1?: undefined;
|
|
148
155
|
T3T1?: undefined;
|
|
149
156
|
};
|
|
150
157
|
comment: string[];
|
|
@@ -157,6 +164,7 @@ export declare class DataManager {
|
|
|
157
164
|
T1B1: string;
|
|
158
165
|
T2T1: string;
|
|
159
166
|
T2B1?: undefined;
|
|
167
|
+
T3B1?: undefined;
|
|
160
168
|
T3T1?: undefined;
|
|
161
169
|
};
|
|
162
170
|
coin?: undefined;
|
|
@@ -169,6 +177,7 @@ export declare class DataManager {
|
|
|
169
177
|
T1B1: string;
|
|
170
178
|
T2T1: string;
|
|
171
179
|
T2B1: string;
|
|
180
|
+
T3B1?: undefined;
|
|
172
181
|
T3T1?: undefined;
|
|
173
182
|
};
|
|
174
183
|
coin?: undefined;
|
|
@@ -181,6 +190,7 @@ export declare class DataManager {
|
|
|
181
190
|
T1B1: string;
|
|
182
191
|
T2T1: string;
|
|
183
192
|
T2B1: string;
|
|
193
|
+
T3B1?: undefined;
|
|
184
194
|
T3T1?: undefined;
|
|
185
195
|
};
|
|
186
196
|
comment: string[];
|
|
@@ -193,6 +203,7 @@ export declare class DataManager {
|
|
|
193
203
|
T1B1: string;
|
|
194
204
|
T2T1: string;
|
|
195
205
|
T2B1: string;
|
|
206
|
+
T3B1: string;
|
|
196
207
|
T3T1: string;
|
|
197
208
|
};
|
|
198
209
|
coin?: undefined;
|
package/lib/data/DataManager.js
CHANGED
|
@@ -22,7 +22,7 @@ class DataManager {
|
|
|
22
22
|
(0, transportInfo_1.parseBridgeJSON)(this.assets.bridge);
|
|
23
23
|
(0, coinInfo_1.parseCoinsJson)({
|
|
24
24
|
...this.assets.coins,
|
|
25
|
-
|
|
25
|
+
...this.assets.coinsEth,
|
|
26
26
|
});
|
|
27
27
|
for (const model in types_1.DeviceModelInternal) {
|
|
28
28
|
const firmwareKey = `firmware-${model.toLowerCase()}`;
|
package/lib/data/coinInfo.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare const getBitcoinNetwork: (pathOrName: DerivationPath) => ({
|
|
|
15
15
|
T1B1: string | false;
|
|
16
16
|
T2T1: string | false;
|
|
17
17
|
T2B1: string | false;
|
|
18
|
+
T3B1: string | false;
|
|
18
19
|
T3T1: string | false;
|
|
19
20
|
connect: boolean;
|
|
20
21
|
};
|
|
@@ -72,6 +73,7 @@ export declare const getEthereumNetwork: (pathOrName: DerivationPath) => ({
|
|
|
72
73
|
T1B1: string | false;
|
|
73
74
|
T2T1: string | false;
|
|
74
75
|
T2B1: string | false;
|
|
76
|
+
T3B1: string | false;
|
|
75
77
|
T3T1: string | false;
|
|
76
78
|
connect: boolean;
|
|
77
79
|
};
|
|
@@ -104,6 +106,7 @@ export declare const getMiscNetwork: (pathOrName: DerivationPath) => ({
|
|
|
104
106
|
T1B1: string | false;
|
|
105
107
|
T2T1: string | false;
|
|
106
108
|
T2B1: string | false;
|
|
109
|
+
T3B1: string | false;
|
|
107
110
|
T3T1: string | false;
|
|
108
111
|
connect: boolean;
|
|
109
112
|
};
|
|
@@ -160,6 +163,7 @@ export declare const fixCoinInfoNetwork: (ci: BitcoinNetworkInfo, path: number[]
|
|
|
160
163
|
T1B1: string | false;
|
|
161
164
|
T2T1: string | false;
|
|
162
165
|
T2B1: string | false;
|
|
166
|
+
T3B1: string | false;
|
|
163
167
|
T3T1: string | false;
|
|
164
168
|
connect: boolean;
|
|
165
169
|
};
|
|
@@ -217,6 +221,7 @@ export declare const getCoinInfoByHash: (hash: string, networkInfo: any) => {
|
|
|
217
221
|
T1B1: string | false;
|
|
218
222
|
T2T1: string | false;
|
|
219
223
|
T2B1: string | false;
|
|
224
|
+
T3B1: string | false;
|
|
220
225
|
T3T1: string | false;
|
|
221
226
|
connect: boolean;
|
|
222
227
|
};
|
|
@@ -274,6 +279,7 @@ export declare const getCoinInfo: (currency: string) => ({
|
|
|
274
279
|
T1B1: string | false;
|
|
275
280
|
T2T1: string | false;
|
|
276
281
|
T2B1: string | false;
|
|
282
|
+
T3B1: string | false;
|
|
277
283
|
T3T1: string | false;
|
|
278
284
|
connect: boolean;
|
|
279
285
|
};
|
|
@@ -330,6 +336,7 @@ export declare const getCoinInfo: (currency: string) => ({
|
|
|
330
336
|
T1B1: string | false;
|
|
331
337
|
T2T1: string | false;
|
|
332
338
|
T2B1: string | false;
|
|
339
|
+
T3B1: string | false;
|
|
333
340
|
T3T1: string | false;
|
|
334
341
|
connect: boolean;
|
|
335
342
|
};
|
|
@@ -361,6 +368,7 @@ export declare const getCoinInfo: (currency: string) => ({
|
|
|
361
368
|
T1B1: string | false;
|
|
362
369
|
T2T1: string | false;
|
|
363
370
|
T2B1: string | false;
|
|
371
|
+
T3B1: string | false;
|
|
364
372
|
T3T1: string | false;
|
|
365
373
|
connect: boolean;
|
|
366
374
|
};
|
|
@@ -410,6 +418,7 @@ export declare const getUniqueNetworks: (networks: (CoinInfo | undefined)[]) =>
|
|
|
410
418
|
T1B1: string | false;
|
|
411
419
|
T2T1: string | false;
|
|
412
420
|
T2B1: string | false;
|
|
421
|
+
T3B1: string | false;
|
|
413
422
|
T3T1: string | false;
|
|
414
423
|
connect: boolean;
|
|
415
424
|
};
|
|
@@ -466,6 +475,7 @@ export declare const getUniqueNetworks: (networks: (CoinInfo | undefined)[]) =>
|
|
|
466
475
|
T1B1: string | false;
|
|
467
476
|
T2T1: string | false;
|
|
468
477
|
T2B1: string | false;
|
|
478
|
+
T3B1: string | false;
|
|
469
479
|
T3T1: string | false;
|
|
470
480
|
connect: boolean;
|
|
471
481
|
};
|
|
@@ -497,6 +507,7 @@ export declare const getUniqueNetworks: (networks: (CoinInfo | undefined)[]) =>
|
|
|
497
507
|
T1B1: string | false;
|
|
498
508
|
T2T1: string | false;
|
|
499
509
|
T2B1: string | false;
|
|
510
|
+
T3B1: string | false;
|
|
500
511
|
T3T1: string | false;
|
|
501
512
|
connect: boolean;
|
|
502
513
|
};
|
|
@@ -529,6 +540,7 @@ export declare const getAllNetworks: () => (({
|
|
|
529
540
|
T1B1: string | false;
|
|
530
541
|
T2T1: string | false;
|
|
531
542
|
T2B1: string | false;
|
|
543
|
+
T3B1: string | false;
|
|
532
544
|
T3T1: string | false;
|
|
533
545
|
connect: boolean;
|
|
534
546
|
};
|
|
@@ -585,6 +597,7 @@ export declare const getAllNetworks: () => (({
|
|
|
585
597
|
T1B1: string | false;
|
|
586
598
|
T2T1: string | false;
|
|
587
599
|
T2B1: string | false;
|
|
600
|
+
T3B1: string | false;
|
|
588
601
|
T3T1: string | false;
|
|
589
602
|
connect: boolean;
|
|
590
603
|
};
|
|
@@ -616,6 +629,7 @@ export declare const getAllNetworks: () => (({
|
|
|
616
629
|
T1B1: string | false;
|
|
617
630
|
T2T1: string | false;
|
|
618
631
|
T2B1: string | false;
|
|
632
|
+
T3B1: string | false;
|
|
619
633
|
T3T1: string | false;
|
|
620
634
|
connect: boolean;
|
|
621
635
|
};
|
package/lib/data/config.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ export declare const config: {
|
|
|
62
62
|
T1B1: string;
|
|
63
63
|
T2T1: string;
|
|
64
64
|
T2B1?: undefined;
|
|
65
|
+
T3B1?: undefined;
|
|
65
66
|
T3T1?: undefined;
|
|
66
67
|
};
|
|
67
68
|
max: undefined;
|
|
@@ -73,6 +74,7 @@ export declare const config: {
|
|
|
73
74
|
T1B1: string;
|
|
74
75
|
T2T1: string;
|
|
75
76
|
T2B1?: undefined;
|
|
77
|
+
T3B1?: undefined;
|
|
76
78
|
T3T1?: undefined;
|
|
77
79
|
};
|
|
78
80
|
comment: string[];
|
|
@@ -85,6 +87,7 @@ export declare const config: {
|
|
|
85
87
|
T1B1: string;
|
|
86
88
|
T2T1: string;
|
|
87
89
|
T2B1?: undefined;
|
|
90
|
+
T3B1?: undefined;
|
|
88
91
|
T3T1?: undefined;
|
|
89
92
|
};
|
|
90
93
|
comment: string[];
|
|
@@ -97,6 +100,7 @@ export declare const config: {
|
|
|
97
100
|
T1B1: string;
|
|
98
101
|
T2T1: string;
|
|
99
102
|
T2B1?: undefined;
|
|
103
|
+
T3B1?: undefined;
|
|
100
104
|
T3T1?: undefined;
|
|
101
105
|
};
|
|
102
106
|
comment: string[];
|
|
@@ -110,6 +114,7 @@ export declare const config: {
|
|
|
110
114
|
T1B1: string;
|
|
111
115
|
T2T1: string;
|
|
112
116
|
T2B1?: undefined;
|
|
117
|
+
T3B1?: undefined;
|
|
113
118
|
T3T1?: undefined;
|
|
114
119
|
};
|
|
115
120
|
comment: string[];
|
|
@@ -122,6 +127,7 @@ export declare const config: {
|
|
|
122
127
|
T1B1: string;
|
|
123
128
|
T2T1: string;
|
|
124
129
|
T2B1?: undefined;
|
|
130
|
+
T3B1?: undefined;
|
|
125
131
|
T3T1?: undefined;
|
|
126
132
|
};
|
|
127
133
|
coin?: undefined;
|
|
@@ -133,6 +139,7 @@ export declare const config: {
|
|
|
133
139
|
T1B1: string;
|
|
134
140
|
T2T1: string;
|
|
135
141
|
T2B1: string;
|
|
142
|
+
T3B1?: undefined;
|
|
136
143
|
T3T1?: undefined;
|
|
137
144
|
};
|
|
138
145
|
comment: string[];
|
|
@@ -145,6 +152,7 @@ export declare const config: {
|
|
|
145
152
|
T1B1: string;
|
|
146
153
|
T2T1: string;
|
|
147
154
|
T2B1?: undefined;
|
|
155
|
+
T3B1?: undefined;
|
|
148
156
|
T3T1?: undefined;
|
|
149
157
|
};
|
|
150
158
|
coin?: undefined;
|
|
@@ -157,6 +165,7 @@ export declare const config: {
|
|
|
157
165
|
T1B1: string;
|
|
158
166
|
T2T1: string;
|
|
159
167
|
T2B1: string;
|
|
168
|
+
T3B1?: undefined;
|
|
160
169
|
T3T1?: undefined;
|
|
161
170
|
};
|
|
162
171
|
coin?: undefined;
|
|
@@ -169,6 +178,7 @@ export declare const config: {
|
|
|
169
178
|
T1B1: string;
|
|
170
179
|
T2T1: string;
|
|
171
180
|
T2B1: string;
|
|
181
|
+
T3B1?: undefined;
|
|
172
182
|
T3T1?: undefined;
|
|
173
183
|
};
|
|
174
184
|
comment: string[];
|
|
@@ -181,6 +191,7 @@ export declare const config: {
|
|
|
181
191
|
T1B1: string;
|
|
182
192
|
T2T1: string;
|
|
183
193
|
T2B1: string;
|
|
194
|
+
T3B1: string;
|
|
184
195
|
T3T1: string;
|
|
185
196
|
};
|
|
186
197
|
coin?: undefined;
|