@trezor/connect 9.1.4 → 9.1.5

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +1 -1
  3. package/lib/api/authenticateDevice.d.ts +7 -0
  4. package/lib/api/authenticateDevice.js +51 -0
  5. package/lib/api/checkFirmwareAuthenticity.js +7 -5
  6. package/lib/api/common/paramsValidator.js +45 -51
  7. package/lib/api/ethereum/ethereumDefinitions.js +3 -2
  8. package/lib/api/firmware/getBinary.js +1 -1
  9. package/lib/api/firmware/verifyAuthenticityProof.d.ts +14 -0
  10. package/lib/api/firmware/verifyAuthenticityProof.js +103 -0
  11. package/lib/api/firmware/x509certificate.d.ts +73 -0
  12. package/lib/api/firmware/x509certificate.js +203 -0
  13. package/lib/api/firmwareUpdate.js +2 -1
  14. package/lib/api/getAccountInfo.js +1 -5
  15. package/lib/api/getFirmwareHash.js +1 -4
  16. package/lib/api/index.d.ts +1 -0
  17. package/lib/api/index.js +4 -2
  18. package/lib/api/rebootToBootloader.js +1 -4
  19. package/lib/core/AbstractMethod.d.ts +1 -0
  20. package/lib/core/AbstractMethod.js +11 -10
  21. package/lib/core/index.d.ts +3 -2
  22. package/lib/core/index.js +11 -3
  23. package/lib/core/method.d.ts +1 -1
  24. package/lib/data/DataManager.d.ts +53 -7
  25. package/lib/data/DataManager.js +4 -2
  26. package/lib/data/config.d.ts +52 -6
  27. package/lib/data/config.js +35 -23
  28. package/lib/data/connectSettings.js +3 -0
  29. package/lib/data/deviceAuthenticityConfig.d.ts +15 -0
  30. package/lib/data/deviceAuthenticityConfig.js +26 -0
  31. package/lib/data/firmwareInfo.d.ts +3 -2
  32. package/lib/data/firmwareInfo.js +17 -8
  33. package/lib/data/models.d.ts +4 -1
  34. package/lib/data/models.js +6 -3
  35. package/lib/data/version.d.ts +1 -1
  36. package/lib/data/version.js +1 -1
  37. package/lib/device/Device.d.ts +1 -1
  38. package/lib/device/Device.js +11 -11
  39. package/lib/device/DeviceList.d.ts +1 -0
  40. package/lib/device/DeviceList.js +4 -3
  41. package/lib/events/iframe.d.ts +7 -1
  42. package/lib/events/iframe.js +1 -0
  43. package/lib/factory.js +1 -0
  44. package/lib/types/api/authenticateDevice.d.ts +21 -0
  45. package/lib/types/api/authenticateDevice.js +3 -0
  46. package/lib/types/api/index.d.ts +2 -0
  47. package/lib/types/coinInfo.d.ts +3 -2
  48. package/lib/types/firmware.d.ts +6 -2
  49. package/lib/types/index.d.ts +1 -0
  50. package/lib/utils/assetUtils.js +6 -4
  51. package/lib/utils/debug.d.ts +9 -3
  52. package/lib/utils/debug.js +50 -17
  53. package/lib/utils/deviceFeaturesUtils.js +3 -3
  54. package/package.json +13 -10
@@ -136,13 +136,9 @@ class GetAccountInfo extends AbstractMethod_1.AbstractMethod {
136
136
  if (isUsingPopup || this.params.length === 1) {
137
137
  return super.checkFirmwareRange(isUsingPopup);
138
138
  }
139
- const defaultRange = {
140
- 1: { min: '1.0.0', max: '0' },
141
- 2: { min: '2.0.0', max: '0' },
142
- };
143
139
  const invalid = [];
144
140
  for (let i = 0; i < this.params.length; i++) {
145
- this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, this.params[i].coinInfo, defaultRange);
141
+ this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, this.params[i].coinInfo, AbstractMethod_1.DEFAULT_FIRMWARE_RANGE);
146
142
  const exception = await super.checkFirmwareRange(false);
147
143
  if (exception) {
148
144
  invalid.push({
@@ -11,10 +11,7 @@ class GetFirmwareHash extends AbstractMethod_1.AbstractMethod {
11
11
  this.allowDeviceMode = [events_1.UI.INITIALIZE];
12
12
  const { payload } = this;
13
13
  (0, paramsValidator_1.validateParams)(payload, [{ name: 'challenge', type: 'string' }]);
14
- this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, {
15
- 1: { min: '1.11.1', max: '0' },
16
- 2: { min: '2.5.1', max: '0' },
17
- });
14
+ this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, this.firmwareRange);
18
15
  this.params = {
19
16
  challenge: payload.challenge,
20
17
  };
@@ -1,5 +1,6 @@
1
1
  export { default as applyFlags } from './applyFlags';
2
2
  export { default as applySettings } from './applySettings';
3
+ export { default as authenticateDevice } from './authenticateDevice';
3
4
  export { default as authorizeCoinjoin } from './authorizeCoinjoin';
4
5
  export { default as cancelCoinjoinAuthorization } from './cancelCoinjoinAuthorization';
5
6
  export { default as showDeviceTutorial } from './showDeviceTutorial';
package/lib/api/index.js CHANGED
@@ -3,12 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.rebootToBootloader = exports.pushTransaction = exports.nemSignTransaction = exports.nemGetAddress = exports.getSettings = exports.getPublicKey = exports.getOwnershipProof = exports.getOwnershipId = exports.getFirmwareHash = exports.getFeatures = exports.getDeviceState = exports.getCoinInfo = exports.getAddress = exports.getAccountInfo = exports.firmwareUpdate = exports.ethereumVerifyMessage = exports.ethereumSignTypedData = exports.ethereumSignTransaction = exports.ethereumSignMessage = exports.ethereumGetPublicKey = exports.ethereumGetAddress = exports.eosSignTransaction = exports.eosGetPublicKey = exports.composeTransaction = exports.cipherKeyValue = exports.changePin = exports.cardanoSignTransaction = exports.cardanoGetPublicKey = exports.cardanoGetNativeScriptHash = exports.cardanoGetAddress = exports.blockchainUnsubscribeFiatRates = exports.blockchainUnsubscribe = exports.blockchainSubscribeFiatRates = exports.blockchainSubscribe = exports.blockchainSetCustomBackend = exports.blockchainGetTransactions = exports.blockchainGetFiatRatesForTimestamps = exports.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.binanceSignTransaction = exports.binanceGetPublicKey = exports.binanceGetAddress = exports.backupDevice = exports.showDeviceTutorial = exports.cancelCoinjoinAuthorization = exports.authorizeCoinjoin = exports.applySettings = exports.applyFlags = void 0;
7
- exports.checkFirmwareAuthenticity = exports.wipeDevice = exports.verifyMessage = exports.unlockPath = exports.tezosSignTransaction = exports.tezosGetPublicKey = exports.tezosGetAddress = exports.stellarSignTransaction = exports.stellarGetAddress = exports.signTransaction = exports.signMessage = exports.setProxy = exports.setBusy = exports.rippleSignTransaction = exports.rippleGetAddress = exports.resetDevice = exports.requestLogin = exports.recoveryDevice = void 0;
6
+ exports.pushTransaction = exports.nemSignTransaction = exports.nemGetAddress = exports.getSettings = exports.getPublicKey = exports.getOwnershipProof = exports.getOwnershipId = exports.getFirmwareHash = exports.getFeatures = exports.getDeviceState = exports.getCoinInfo = exports.getAddress = exports.getAccountInfo = exports.firmwareUpdate = exports.ethereumVerifyMessage = exports.ethereumSignTypedData = exports.ethereumSignTransaction = exports.ethereumSignMessage = exports.ethereumGetPublicKey = exports.ethereumGetAddress = exports.eosSignTransaction = exports.eosGetPublicKey = exports.composeTransaction = exports.cipherKeyValue = exports.changePin = exports.cardanoSignTransaction = exports.cardanoGetPublicKey = exports.cardanoGetNativeScriptHash = exports.cardanoGetAddress = exports.blockchainUnsubscribeFiatRates = exports.blockchainUnsubscribe = exports.blockchainSubscribeFiatRates = exports.blockchainSubscribe = exports.blockchainSetCustomBackend = exports.blockchainGetTransactions = exports.blockchainGetFiatRatesForTimestamps = exports.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.binanceSignTransaction = exports.binanceGetPublicKey = exports.binanceGetAddress = exports.backupDevice = exports.showDeviceTutorial = exports.cancelCoinjoinAuthorization = exports.authorizeCoinjoin = exports.authenticateDevice = exports.applySettings = exports.applyFlags = void 0;
7
+ exports.checkFirmwareAuthenticity = exports.wipeDevice = exports.verifyMessage = exports.unlockPath = exports.tezosSignTransaction = exports.tezosGetPublicKey = exports.tezosGetAddress = exports.stellarSignTransaction = exports.stellarGetAddress = exports.signTransaction = exports.signMessage = exports.setProxy = exports.setBusy = exports.rippleSignTransaction = exports.rippleGetAddress = exports.resetDevice = exports.requestLogin = exports.recoveryDevice = exports.rebootToBootloader = void 0;
8
8
  var applyFlags_1 = require("./applyFlags");
9
9
  Object.defineProperty(exports, "applyFlags", { enumerable: true, get: function () { return __importDefault(applyFlags_1).default; } });
10
10
  var applySettings_1 = require("./applySettings");
11
11
  Object.defineProperty(exports, "applySettings", { enumerable: true, get: function () { return __importDefault(applySettings_1).default; } });
12
+ var authenticateDevice_1 = require("./authenticateDevice");
13
+ Object.defineProperty(exports, "authenticateDevice", { enumerable: true, get: function () { return __importDefault(authenticateDevice_1).default; } });
12
14
  var authorizeCoinjoin_1 = require("./authorizeCoinjoin");
13
15
  Object.defineProperty(exports, "authorizeCoinjoin", { enumerable: true, get: function () { return __importDefault(authorizeCoinjoin_1).default; } });
14
16
  var cancelCoinjoinAuthorization_1 = require("./cancelCoinjoinAuthorization");
@@ -10,10 +10,7 @@ class RebootToBootloader extends AbstractMethod_1.AbstractMethod {
10
10
  this.keepSession = false;
11
11
  this.requiredPermissions = ['management'];
12
12
  this.useDeviceState = false;
13
- this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, {
14
- 1: { min: '1.10.0', max: '0' },
15
- 2: { min: '2.6.0', max: '0' },
16
- });
13
+ this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, this.firmwareRange);
17
14
  }
18
15
  get info() {
19
16
  return 'Reboot to bootloader';
@@ -9,6 +9,7 @@ export type Payload<M> = Extract<CallMethodPayload, {
9
9
  override?: boolean;
10
10
  };
11
11
  export type MethodReturnType<M extends CallMethodPayload['method']> = CallMethodResponse<M>;
12
+ export declare const DEFAULT_FIRMWARE_RANGE: FirmwareRange;
12
13
  export declare abstract class AbstractMethod<Name extends CallMethodPayload['method'], Params = undefined> {
13
14
  responseID: number;
14
15
  device: Device;
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AbstractMethod = void 0;
3
+ exports.AbstractMethod = exports.DEFAULT_FIRMWARE_RANGE = void 0;
4
4
  const connect_common_1 = require("@trezor/connect-common");
5
5
  const utils_1 = require("@trezor/utils");
6
6
  const DataManager_1 = require("../data/DataManager");
7
7
  const constants_1 = require("../constants");
8
8
  const events_1 = require("../events");
9
9
  const urlUtils_1 = require("../utils/urlUtils");
10
+ exports.DEFAULT_FIRMWARE_RANGE = {
11
+ T1B1: { min: '1.0.0', max: '0' },
12
+ T2T1: { min: '2.0.0', max: '0' },
13
+ T2B1: { min: '2.6.1', max: '0' },
14
+ };
10
15
  class AbstractMethod {
11
16
  get info() {
12
17
  return '';
@@ -44,10 +49,7 @@ class AbstractMethod {
44
49
  this.network = key;
45
50
  }
46
51
  });
47
- this.firmwareRange = {
48
- '1': { min: '1.0.0', max: '0' },
49
- '2': { min: '2.0.0', max: '0' },
50
- };
52
+ this.firmwareRange = exports.DEFAULT_FIRMWARE_RANGE;
51
53
  this.requiredPermissions = [];
52
54
  this.useDevice = true;
53
55
  this.useDeviceState = true;
@@ -130,20 +132,19 @@ class AbstractMethod {
130
132
  const { device } = this;
131
133
  if (!device.features)
132
134
  return;
133
- const version = device.getVersion();
134
- const model = version[0];
135
- const range = this.firmwareRange[model];
135
+ const range = this.firmwareRange[device.features.internal_model];
136
136
  if (device.firmwareStatus === 'none') {
137
137
  return events_1.UI.FIRMWARE_NOT_INSTALLED;
138
138
  }
139
139
  if (range.min === '0') {
140
140
  return events_1.UI.FIRMWARE_NOT_SUPPORTED;
141
141
  }
142
+ const version = device.getVersion().join('.');
142
143
  if (device.firmwareStatus === 'required' ||
143
- !utils_1.versionUtils.isNewerOrEqual(version.join('.'), range.min)) {
144
+ !utils_1.versionUtils.isNewerOrEqual(version, range.min)) {
144
145
  return events_1.UI.FIRMWARE_OLD;
145
146
  }
146
- if (range.max !== '0' && utils_1.versionUtils.isNewer(version.join('.'), range.max)) {
147
+ if (range.max !== '0' && utils_1.versionUtils.isNewer(version, range.max)) {
147
148
  if (isUsingPopup) {
148
149
  await this.getPopupPromise().promise;
149
150
  const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
@@ -1,15 +1,16 @@
1
1
  /// <reference types="node" />
2
2
  import EventEmitter from 'events';
3
3
  import { TransportInfo, CoreMessage } from '../events';
4
+ import { LogWriter } from '../utils/debug';
4
5
  import type { ConnectSettings } from '../types';
5
6
  export declare const handleMessage: (message: CoreMessage) => void;
6
7
  export declare const onCall: (message: CoreMessage) => Promise<void>;
7
8
  export declare class Core extends EventEmitter {
8
9
  handleMessage(message: any): void;
9
10
  dispose(): Promise<void>;
10
- getCurrentMethod(): (import("../api").applyFlags | import("../api").applySettings | import("../api").authorizeCoinjoin | import("../api").cancelCoinjoinAuthorization | import("../api").showDeviceTutorial | import("../api").backupDevice | import("../api").binanceGetAddress | import("../api").binanceGetPublicKey | import("../api").binanceSignTransaction | import("../api").blockchainDisconnect | import("../api").blockchainEstimateFee | import("../api").blockchainGetAccountBalanceHistory | import("../api").blockchainGetCurrentFiatRates | import("../api").blockchainGetFiatRatesForTimestamps | import("../api").blockchainGetTransactions | import("../api").blockchainSetCustomBackend | import("../api").blockchainSubscribe | import("../api").blockchainSubscribeFiatRates | import("../api").blockchainUnsubscribe | import("../api").blockchainUnsubscribeFiatRates | import("../api").cardanoGetAddress | import("../api").cardanoGetNativeScriptHash | import("../api").cardanoGetPublicKey | import("../api").cardanoSignTransaction | import("../api").changePin | import("../api").cipherKeyValue | import("../api").composeTransaction | import("../api").eosGetPublicKey | import("../api").eosSignTransaction | import("../api").ethereumGetAddress | import("../api").ethereumGetPublicKey | import("../api").ethereumSignMessage | import("../api").ethereumSignTransaction | import("../api").ethereumSignTypedData | import("../api").ethereumVerifyMessage | import("../api").firmwareUpdate | import("../api").getAccountInfo | import("../api").getAddress | import("../api").getCoinInfo | import("../api").getDeviceState | import("../api").getFeatures | import("../api").getFirmwareHash | import("../api").getOwnershipId | import("../api").getOwnershipProof | import("../api").getPublicKey | import("../api").getSettings | import("../api").nemGetAddress | import("../api").nemSignTransaction | import("../api").pushTransaction | import("../api").rebootToBootloader | import("../api").recoveryDevice | import("../api").requestLogin | import("../api").resetDevice | import("../api").rippleGetAddress | import("../api").rippleSignTransaction | import("../api").setBusy | import("../api").setProxy | import("../api").signMessage | import("../api").signTransaction | import("../api").stellarGetAddress | import("../api").stellarSignTransaction | import("../api").tezosGetAddress | import("../api").tezosGetPublicKey | import("../api").tezosSignTransaction | import("../api").unlockPath | import("../api").verifyMessage | import("../api").wipeDevice | import("../api").checkFirmwareAuthenticity)[];
11
+ getCurrentMethod(): (import("../api").applyFlags | import("../api").applySettings | import("../api").authenticateDevice | import("../api").authorizeCoinjoin | import("../api").cancelCoinjoinAuthorization | import("../api").showDeviceTutorial | import("../api").backupDevice | import("../api").binanceGetAddress | import("../api").binanceGetPublicKey | import("../api").binanceSignTransaction | import("../api").blockchainDisconnect | import("../api").blockchainEstimateFee | import("../api").blockchainGetAccountBalanceHistory | import("../api").blockchainGetCurrentFiatRates | import("../api").blockchainGetFiatRatesForTimestamps | import("../api").blockchainGetTransactions | import("../api").blockchainSetCustomBackend | import("../api").blockchainSubscribe | import("../api").blockchainSubscribeFiatRates | import("../api").blockchainUnsubscribe | import("../api").blockchainUnsubscribeFiatRates | import("../api").cardanoGetAddress | import("../api").cardanoGetNativeScriptHash | import("../api").cardanoGetPublicKey | import("../api").cardanoSignTransaction | import("../api").changePin | import("../api").cipherKeyValue | import("../api").composeTransaction | import("../api").eosGetPublicKey | import("../api").eosSignTransaction | import("../api").ethereumGetAddress | import("../api").ethereumGetPublicKey | import("../api").ethereumSignMessage | import("../api").ethereumSignTransaction | import("../api").ethereumSignTypedData | import("../api").ethereumVerifyMessage | import("../api").firmwareUpdate | import("../api").getAccountInfo | import("../api").getAddress | import("../api").getCoinInfo | import("../api").getDeviceState | import("../api").getFeatures | import("../api").getFirmwareHash | import("../api").getOwnershipId | import("../api").getOwnershipProof | import("../api").getPublicKey | import("../api").getSettings | import("../api").nemGetAddress | import("../api").nemSignTransaction | import("../api").pushTransaction | import("../api").rebootToBootloader | import("../api").recoveryDevice | import("../api").requestLogin | import("../api").resetDevice | import("../api").rippleGetAddress | import("../api").rippleSignTransaction | import("../api").setBusy | import("../api").setProxy | import("../api").signMessage | import("../api").signTransaction | import("../api").stellarGetAddress | import("../api").stellarSignTransaction | import("../api").tezosGetAddress | import("../api").tezosGetPublicKey | import("../api").tezosSignTransaction | import("../api").unlockPath | import("../api").verifyMessage | import("../api").wipeDevice | import("../api").checkFirmwareAuthenticity)[];
11
12
  getTransportInfo(): TransportInfo | undefined;
12
13
  }
13
- export declare const initCore: (settings: ConnectSettings) => Promise<Core>;
14
+ export declare const initCore: (settings: ConnectSettings, logWriterFactory?: () => LogWriter | undefined) => Promise<Core>;
14
15
  export declare const initTransport: (settings: ConnectSettings) => Promise<void>;
15
16
  //# sourceMappingURL=index.d.ts.map
package/lib/core/index.js CHANGED
@@ -103,6 +103,7 @@ const initDevice = async (method) => {
103
103
  if (!_deviceList) {
104
104
  throw constants_1.ERRORS.TypedError('Transport_Missing');
105
105
  }
106
+ await _deviceList.transportFirstEventPromise;
106
107
  const isWebUsb = _deviceList.transportType() === 'WebUsbTransport';
107
108
  let device;
108
109
  let showDeviceSelection = isWebUsb;
@@ -339,7 +340,7 @@ const onCall = async (message) => {
339
340
  }
340
341
  }
341
342
  catch (error) {
342
- if (error.message === 'PIN invalid' && PIN_TRIES < MAX_PIN_TRIES) {
343
+ if (error.message.includes('PIN invalid') && PIN_TRIES < MAX_PIN_TRIES) {
343
344
  PIN_TRIES++;
344
345
  postMessage((0, events_2.createUiMessage)(events_2.UI.INVALID_PIN, { device: device.toMessageObject() }));
345
346
  return inner();
@@ -393,7 +394,11 @@ const onCall = async (message) => {
393
394
  if (response) {
394
395
  if (method.name === 'rebootToBootloader' && response.success) {
395
396
  await (0, promiseUtils_1.resolveAfter)(1000).promise;
396
- await device.run(() => Promise.resolve(), { skipFinalReload: true });
397
+ try {
398
+ await device.run(() => Promise.resolve(), { skipFinalReload: true });
399
+ }
400
+ catch (err) {
401
+ }
397
402
  }
398
403
  await device.cleanup();
399
404
  closePopup();
@@ -628,7 +633,10 @@ class Core extends events_1.default {
628
633
  }
629
634
  }
630
635
  exports.Core = Core;
631
- const initCore = async (settings) => {
636
+ const initCore = async (settings, logWriterFactory) => {
637
+ if (logWriterFactory) {
638
+ (0, debug_1.setLogWriter)(logWriterFactory);
639
+ }
632
640
  try {
633
641
  await DataManager_1.DataManager.load(settings);
634
642
  (0, debug_1.enableLog)(DataManager_1.DataManager.getSettings('debug'));
@@ -2,5 +2,5 @@ import * as Methods from '../api';
2
2
  import type { IFrameCallMessage } from '../events';
3
3
  export declare const getMethod: (message: IFrameCallMessage & {
4
4
  id?: number;
5
- }) => Methods.applyFlags | Methods.applySettings | Methods.authorizeCoinjoin | Methods.cancelCoinjoinAuthorization | Methods.showDeviceTutorial | Methods.backupDevice | Methods.binanceGetAddress | Methods.binanceGetPublicKey | Methods.binanceSignTransaction | Methods.blockchainDisconnect | Methods.blockchainEstimateFee | Methods.blockchainGetAccountBalanceHistory | Methods.blockchainGetCurrentFiatRates | Methods.blockchainGetFiatRatesForTimestamps | Methods.blockchainGetTransactions | Methods.blockchainSetCustomBackend | Methods.blockchainSubscribe | Methods.blockchainSubscribeFiatRates | Methods.blockchainUnsubscribe | Methods.blockchainUnsubscribeFiatRates | Methods.cardanoGetAddress | Methods.cardanoGetNativeScriptHash | Methods.cardanoGetPublicKey | Methods.cardanoSignTransaction | Methods.changePin | Methods.cipherKeyValue | Methods.composeTransaction | Methods.eosGetPublicKey | Methods.eosSignTransaction | Methods.ethereumGetAddress | Methods.ethereumGetPublicKey | Methods.ethereumSignMessage | Methods.ethereumSignTransaction | Methods.ethereumSignTypedData | Methods.ethereumVerifyMessage | Methods.firmwareUpdate | Methods.getAccountInfo | Methods.getAddress | Methods.getCoinInfo | Methods.getDeviceState | Methods.getFeatures | Methods.getFirmwareHash | Methods.getOwnershipId | Methods.getOwnershipProof | Methods.getPublicKey | Methods.getSettings | Methods.nemGetAddress | Methods.nemSignTransaction | Methods.pushTransaction | Methods.rebootToBootloader | Methods.recoveryDevice | Methods.requestLogin | Methods.resetDevice | Methods.rippleGetAddress | Methods.rippleSignTransaction | Methods.setBusy | Methods.setProxy | Methods.signMessage | Methods.signTransaction | Methods.stellarGetAddress | Methods.stellarSignTransaction | Methods.tezosGetAddress | Methods.tezosGetPublicKey | Methods.tezosSignTransaction | Methods.unlockPath | Methods.verifyMessage | Methods.wipeDevice | Methods.checkFirmwareAuthenticity;
5
+ }) => Methods.applyFlags | Methods.applySettings | Methods.authenticateDevice | Methods.authorizeCoinjoin | Methods.cancelCoinjoinAuthorization | Methods.showDeviceTutorial | Methods.backupDevice | Methods.binanceGetAddress | Methods.binanceGetPublicKey | Methods.binanceSignTransaction | Methods.blockchainDisconnect | Methods.blockchainEstimateFee | Methods.blockchainGetAccountBalanceHistory | Methods.blockchainGetCurrentFiatRates | Methods.blockchainGetFiatRatesForTimestamps | Methods.blockchainGetTransactions | Methods.blockchainSetCustomBackend | Methods.blockchainSubscribe | Methods.blockchainSubscribeFiatRates | Methods.blockchainUnsubscribe | Methods.blockchainUnsubscribeFiatRates | Methods.cardanoGetAddress | Methods.cardanoGetNativeScriptHash | Methods.cardanoGetPublicKey | Methods.cardanoSignTransaction | Methods.changePin | Methods.cipherKeyValue | Methods.composeTransaction | Methods.eosGetPublicKey | Methods.eosSignTransaction | Methods.ethereumGetAddress | Methods.ethereumGetPublicKey | Methods.ethereumSignMessage | Methods.ethereumSignTransaction | Methods.ethereumSignTypedData | Methods.ethereumVerifyMessage | Methods.firmwareUpdate | Methods.getAccountInfo | Methods.getAddress | Methods.getCoinInfo | Methods.getDeviceState | Methods.getFeatures | Methods.getFirmwareHash | Methods.getOwnershipId | Methods.getOwnershipProof | Methods.getPublicKey | Methods.getSettings | Methods.nemGetAddress | Methods.nemSignTransaction | Methods.pushTransaction | Methods.rebootToBootloader | Methods.recoveryDevice | Methods.requestLogin | Methods.resetDevice | Methods.rippleGetAddress | Methods.rippleSignTransaction | Methods.setBusy | Methods.setProxy | Methods.signMessage | Methods.signTransaction | Methods.stellarGetAddress | Methods.stellarSignTransaction | Methods.tezosGetAddress | Methods.tezosGetPublicKey | Methods.tezosSignTransaction | Methods.unlockPath | Methods.verifyMessage | Methods.wipeDevice | Methods.checkFirmwareAuthenticity;
6
6
  //# sourceMappingURL=method.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { ConnectSettings } from '../types';
1
+ import { ConnectSettings } from '../types';
2
2
  type AssetCollection = {
3
3
  [key: string]: JSON;
4
4
  };
@@ -60,27 +60,43 @@ export declare class DataManager {
60
60
  supportedFirmware: ({
61
61
  coin: string[];
62
62
  methods: string[];
63
- min: string[];
63
+ min: {
64
+ T1B1: string;
65
+ T2T1: string;
66
+ T2B1?: undefined;
67
+ };
64
68
  max: undefined;
65
69
  comment: string[];
66
70
  capabilities?: undefined;
67
71
  } | {
68
72
  coin: string[];
69
- min: string[];
73
+ min: {
74
+ T1B1: string;
75
+ T2T1: string;
76
+ T2B1?: undefined;
77
+ };
70
78
  comment: string[];
71
79
  methods?: undefined;
72
80
  max?: undefined;
73
81
  capabilities?: undefined;
74
82
  } | {
75
83
  methods: string[];
76
- min: string[];
84
+ min: {
85
+ T1B1: string;
86
+ T2T1: string;
87
+ T2B1?: undefined;
88
+ };
77
89
  comment: string[];
78
90
  coin?: undefined;
79
91
  max?: undefined;
80
92
  capabilities?: undefined;
81
93
  } | {
82
94
  capabilities: string[];
83
- min: string[];
95
+ min: {
96
+ T1B1: string;
97
+ T2T1: string;
98
+ T2B1?: undefined;
99
+ };
84
100
  comment: string[];
85
101
  coin?: undefined;
86
102
  methods?: undefined;
@@ -88,17 +104,47 @@ export declare class DataManager {
88
104
  } | {
89
105
  coin: string[];
90
106
  methods: string[];
91
- min: string[];
107
+ min: {
108
+ T1B1: string;
109
+ T2T1: string;
110
+ T2B1?: undefined;
111
+ };
92
112
  comment: string[];
93
113
  max?: undefined;
94
114
  capabilities?: undefined;
95
115
  } | {
96
116
  capabilities: string[];
97
117
  methods: string[];
98
- min: string[];
118
+ min: {
119
+ T1B1: string;
120
+ T2T1: string;
121
+ T2B1?: undefined;
122
+ };
123
+ coin?: undefined;
124
+ max?: undefined;
125
+ comment?: undefined;
126
+ } | {
127
+ methods: string[];
128
+ min: {
129
+ T1B1: string;
130
+ T2T1: string;
131
+ T2B1: string;
132
+ };
133
+ comment: string[];
134
+ coin?: undefined;
135
+ max?: undefined;
136
+ capabilities?: undefined;
137
+ } | {
138
+ methods: string[];
139
+ min: {
140
+ T1B1: string;
141
+ T2T1: string;
142
+ T2B1?: undefined;
143
+ };
99
144
  coin?: undefined;
100
145
  max?: undefined;
101
146
  comment?: undefined;
147
+ capabilities?: undefined;
102
148
  })[];
103
149
  };
104
150
  }
@@ -6,6 +6,7 @@ const coinInfo_1 = require("./coinInfo");
6
6
  const firmwareInfo_1 = require("./firmwareInfo");
7
7
  const transportInfo_1 = require("./transportInfo");
8
8
  const config_1 = require("./config");
9
+ const types_1 = require("../types");
9
10
  class DataManager {
10
11
  static async load(settings, withAssets = true) {
11
12
  const ts = settings.env === 'web' ? `?r=${settings.timestamp}` : '';
@@ -23,8 +24,9 @@ class DataManager {
23
24
  ...this.assets.coins,
24
25
  eth: this.assets.coinsEth,
25
26
  });
26
- (0, firmwareInfo_1.parseFirmware)(this.assets['firmware-t1'], 1);
27
- (0, firmwareInfo_1.parseFirmware)(this.assets['firmware-t2'], 2);
27
+ (0, firmwareInfo_1.parseFirmware)(this.assets['firmware-t1b1'], types_1.DeviceModelInternal.T1B1);
28
+ (0, firmwareInfo_1.parseFirmware)(this.assets['firmware-t2t1'], types_1.DeviceModelInternal.T2T1);
29
+ (0, firmwareInfo_1.parseFirmware)(this.assets['firmware-t2b1'], types_1.DeviceModelInternal.T2B1);
28
30
  }
29
31
  static getProtobufMessages() {
30
32
  return this.messages;
@@ -48,27 +48,43 @@ export declare const config: {
48
48
  supportedFirmware: ({
49
49
  coin: string[];
50
50
  methods: string[];
51
- min: string[];
51
+ min: {
52
+ T1B1: string;
53
+ T2T1: string;
54
+ T2B1?: undefined;
55
+ };
52
56
  max: undefined;
53
57
  comment: string[];
54
58
  capabilities?: undefined;
55
59
  } | {
56
60
  coin: string[];
57
- min: string[];
61
+ min: {
62
+ T1B1: string;
63
+ T2T1: string;
64
+ T2B1?: undefined;
65
+ };
58
66
  comment: string[];
59
67
  methods?: undefined;
60
68
  max?: undefined;
61
69
  capabilities?: undefined;
62
70
  } | {
63
71
  methods: string[];
64
- min: string[];
72
+ min: {
73
+ T1B1: string;
74
+ T2T1: string;
75
+ T2B1?: undefined;
76
+ };
65
77
  comment: string[];
66
78
  coin?: undefined;
67
79
  max?: undefined;
68
80
  capabilities?: undefined;
69
81
  } | {
70
82
  capabilities: string[];
71
- min: string[];
83
+ min: {
84
+ T1B1: string;
85
+ T2T1: string;
86
+ T2B1?: undefined;
87
+ };
72
88
  comment: string[];
73
89
  coin?: undefined;
74
90
  methods?: undefined;
@@ -76,17 +92,47 @@ export declare const config: {
76
92
  } | {
77
93
  coin: string[];
78
94
  methods: string[];
79
- min: string[];
95
+ min: {
96
+ T1B1: string;
97
+ T2T1: string;
98
+ T2B1?: undefined;
99
+ };
80
100
  comment: string[];
81
101
  max?: undefined;
82
102
  capabilities?: undefined;
83
103
  } | {
84
104
  capabilities: string[];
85
105
  methods: string[];
86
- min: string[];
106
+ min: {
107
+ T1B1: string;
108
+ T2T1: string;
109
+ T2B1?: undefined;
110
+ };
111
+ coin?: undefined;
112
+ max?: undefined;
113
+ comment?: undefined;
114
+ } | {
115
+ methods: string[];
116
+ min: {
117
+ T1B1: string;
118
+ T2T1: string;
119
+ T2B1: string;
120
+ };
121
+ comment: string[];
122
+ coin?: undefined;
123
+ max?: undefined;
124
+ capabilities?: undefined;
125
+ } | {
126
+ methods: string[];
127
+ min: {
128
+ T1B1: string;
129
+ T2T1: string;
130
+ T2B1?: undefined;
131
+ };
87
132
  coin?: undefined;
88
133
  max?: undefined;
89
134
  comment?: undefined;
135
+ capabilities?: undefined;
90
136
  })[];
91
137
  };
92
138
  //# sourceMappingURL=config.d.ts.map
@@ -55,12 +55,16 @@ exports.config = {
55
55
  url: './data/bridge/releases.json',
56
56
  },
57
57
  {
58
- name: 'firmware-t1',
59
- url: './data/firmware/1/releases.json',
58
+ name: 'firmware-t1b1',
59
+ url: './data/firmware/t1b1/releases.json',
60
60
  },
61
61
  {
62
- name: 'firmware-t2',
63
- url: './data/firmware/2/releases.json',
62
+ name: 'firmware-t2t1',
63
+ url: './data/firmware/t2t1/releases.json',
64
+ },
65
+ {
66
+ name: 'firmware-t2b1',
67
+ url: './data/firmware/t2b1/releases.json',
64
68
  },
65
69
  ],
66
70
  messages: './data/messages/messages.json',
@@ -90,7 +94,7 @@ exports.config = {
90
94
  {
91
95
  coin: ['xrp', 'txrp'],
92
96
  methods: ['getAccountInfo'],
93
- min: ['0', '2.1.0'],
97
+ min: { T1B1: '0', T2T1: '2.1.0' },
94
98
  max: undefined,
95
99
  comment: [
96
100
  "Since firmware 2.1.0 there is a new protobuf field 'destination_tag' in RippleSignTx",
@@ -98,70 +102,70 @@ exports.config = {
98
102
  },
99
103
  {
100
104
  coin: ['bnb'],
101
- min: ['1.9.0', '2.3.0'],
105
+ min: { T1B1: '1.9.0', T2T1: '2.3.0' },
102
106
  comment: [
103
107
  'There were protobuf backwards incompatible changes with introduction of 1.9.0/2.3.0 firmwares',
104
108
  ],
105
109
  },
106
110
  {
107
111
  coin: ['eth', 'tsep', 'tgor'],
108
- min: ['1.8.0', '2.1.0'],
112
+ min: { T1B1: '1.8.0', T2T1: '2.1.0' },
109
113
  comment: ['There were protobuf backwards incompatible changes.'],
110
114
  },
111
115
  {
112
116
  methods: ['rippleGetAddress', 'rippleSignTransaction'],
113
- min: ['0', '2.1.0'],
117
+ min: { T1B1: '0', T2T1: '2.1.0' },
114
118
  comment: [
115
119
  "Since firmware 2.1.0 there is a new protobuf field 'destination_tag' in RippleSignTx",
116
120
  ],
117
121
  },
118
122
  {
119
123
  methods: ['cardanoGetAddress', 'cardanoGetPublicKey'],
120
- min: ['0', '2.3.2'],
124
+ min: { T1B1: '0', T2T1: '2.3.2' },
121
125
  comment: ['Shelley fork support since firmware 2.3.2'],
122
126
  },
123
127
  {
124
128
  methods: ['cardanoSignTransaction'],
125
- min: ['0', '2.4.2'],
129
+ min: { T1B1: '0', T2T1: '2.4.2' },
126
130
  comment: ['Non-streamed signing no longer supported'],
127
131
  },
128
132
  {
129
133
  methods: ['cardanoGetNativeScriptHash'],
130
- min: ['0', '2.4.3'],
134
+ min: { T1B1: '0', T2T1: '2.4.3' },
131
135
  comment: ['Cardano GetNativeScriptHash call added in 2.4.3'],
132
136
  },
133
137
  {
134
138
  methods: ['tezosSignTransaction'],
135
- min: ['0', '2.1.8'],
139
+ min: { T1B1: '0', T2T1: '2.1.8' },
136
140
  comment: [
137
141
  'Since 2.1.8 there are new protobuf fields in tezos transaction (Babylon fork)',
138
142
  ],
139
143
  },
140
144
  {
141
145
  methods: ['stellarSignTransaction'],
142
- min: ['1.9.0', '2.3.0'],
146
+ min: { T1B1: '1.9.0', T2T1: '2.3.0' },
143
147
  comment: [
144
148
  'There were protobuf backwards incompatible changes with introduction of 1.9.0/2.3.0 firmwares',
145
149
  ],
146
150
  },
147
151
  {
148
152
  capabilities: ['replaceTransaction', 'amountUnit'],
149
- min: ['1.9.4', '2.3.5'],
153
+ min: { T1B1: '1.9.4', T2T1: '2.3.5' },
150
154
  comment: ['new sign tx process since 1.9.4/2.3.5'],
151
155
  },
152
156
  {
153
157
  capabilities: ['decreaseOutput'],
154
- min: ['1.10.0', '2.4.0'],
158
+ min: { T1B1: '1.10.0', T2T1: '2.4.0' },
155
159
  comment: ['allow reduce output in RBF transaction since 1.10.0/2.4.0'],
156
160
  },
157
161
  {
158
162
  capabilities: ['eip1559'],
159
- min: ['1.10.4', '2.4.2'],
163
+ min: { T1B1: '1.10.4', T2T1: '2.4.2' },
160
164
  comment: ['new eth transaction pricing mechanism (EIP1559) since 1.10.4/2.4.2'],
161
165
  },
162
166
  {
163
167
  capabilities: ['taproot', 'signMessageNoScriptType'],
164
- min: ['1.10.4', '2.4.3'],
168
+ min: { T1B1: '1.10.4', T2T1: '2.4.3' },
165
169
  comment: [
166
170
  'new btc accounts taproot since 1.10.4/2.4.3 (BTC + TEST only)',
167
171
  'SignMessage with no_script_type support',
@@ -170,17 +174,17 @@ exports.config = {
170
174
  {
171
175
  coin: ['dcr', 'tdcr'],
172
176
  methods: ['signTransaction'],
173
- min: ['1.10.1', '2.4.0'],
177
+ min: { T1B1: '1.10.1', T2T1: '2.4.0' },
174
178
  comment: [''],
175
179
  },
176
180
  {
177
181
  methods: ['ethereumSignTypedData'],
178
- min: ['1.10.5', '2.4.3'],
182
+ min: { T1B1: '1.10.5', T2T1: '2.4.3' },
179
183
  comment: ['EIP-712 typed signing support added in 1.10.5/2.4.3'],
180
184
  },
181
185
  {
182
186
  capabilities: ['eip712-domain-only'],
183
- min: ['1.10.6', '2.4.4'],
187
+ min: { T1B1: '1.10.6', T2T1: '2.4.4' },
184
188
  comment: ['EIP-712 domain-only signing, when primaryType=EIP712Domain'],
185
189
  },
186
190
  {
@@ -193,13 +197,21 @@ exports.config = {
193
197
  'setBusy',
194
198
  'unlockPath',
195
199
  ],
196
- min: ['1.12.1', '2.5.3'],
200
+ min: { T1B1: '1.12.1', T2T1: '2.5.3' },
197
201
  },
198
202
  {
199
- methods: ['showDeviceTutorial'],
200
- min: ['0', '2.6.1'],
203
+ methods: ['showDeviceTutorial', 'authenticateDevice'],
204
+ min: { T1B1: '0', T2T1: '0', T2B1: '2.6.1' },
201
205
  comment: ['Only on T2B1'],
202
206
  },
207
+ {
208
+ methods: ['rebootToBootloader'],
209
+ min: { T1B1: '1.11.0', T2T1: '2.6.0' },
210
+ },
211
+ {
212
+ methods: ['getFirmwareHash'],
213
+ min: { T1B1: '1.11.1', T2T1: '2.5.1' },
214
+ },
203
215
  ],
204
216
  };
205
217
  //# sourceMappingURL=config.js.map
@@ -57,6 +57,9 @@ const parseConnectSettings = (input = {}) => {
57
57
  settings.debug = input.debug === 'true';
58
58
  }
59
59
  }
60
+ if (input.trustedHost === false) {
61
+ settings.trustedHost = input.trustedHost;
62
+ }
60
63
  if (typeof input.connectSrc === 'string' && ((_a = input.connectSrc) === null || _a === void 0 ? void 0 : _a.startsWith('http'))) {
61
64
  settings.connectSrc = (0, exports.corsValidator)(input.connectSrc);
62
65
  }
@@ -0,0 +1,15 @@
1
+ import { PROTO } from '../constants';
2
+ type CertPubKeys = {
3
+ rootPubKeys: string[];
4
+ caPubKeys: string[];
5
+ };
6
+ type ModelPubKeys = Record<PROTO.DeviceModelInternal.T2B1, CertPubKeys & {
7
+ debug?: CertPubKeys;
8
+ }> & Partial<Record<Exclude<PROTO.DeviceModelInternal, 'T2B1'>, undefined>>;
9
+ export interface DeviceAuthenticityConfig extends ModelPubKeys {
10
+ version: number;
11
+ timestamp: string;
12
+ }
13
+ export declare const deviceAuthenticityConfig: DeviceAuthenticityConfig;
14
+ export {};
15
+ //# sourceMappingURL=deviceAuthenticityConfig.d.ts.map