@trezor/connect 9.5.4 → 9.5.5-beta.2

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 (87) hide show
  1. package/CHANGELOG.md +800 -775
  2. package/README.md +5 -5
  3. package/lib/api/bitcoin/TransactionComposer.d.ts +3 -1
  4. package/lib/api/bitcoin/TransactionComposer.js +6 -3
  5. package/lib/api/bitcoin/index.d.ts +0 -1
  6. package/lib/api/bitcoin/index.js +0 -1
  7. package/lib/api/bitcoin/transactionBytes.d.ts +5 -0
  8. package/lib/api/bitcoin/transactionBytes.js +74 -0
  9. package/lib/api/bleUnpair.d.ts +9 -0
  10. package/lib/api/bleUnpair.js +36 -0
  11. package/lib/api/blockchainEstimateFee.js +4 -16
  12. package/lib/api/common/Discovery.d.ts +12 -10
  13. package/lib/api/common/Discovery.js +2 -4
  14. package/lib/api/composeTransaction.js +1 -1
  15. package/lib/api/ethereum/api/ethereumSignMessage.d.ts +6 -0
  16. package/lib/api/ethereum/api/ethereumSignMessage.js +10 -0
  17. package/lib/api/ethereum/api/ethereumSignTransaction.d.ts +21 -1
  18. package/lib/api/ethereum/api/ethereumSignTransaction.js +66 -0
  19. package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +6 -0
  20. package/lib/api/ethereum/api/ethereumSignTypedData.js +10 -0
  21. package/lib/api/getFeatures.js +1 -0
  22. package/lib/api/index.d.ts +1 -0
  23. package/lib/api/index.js +3 -1
  24. package/lib/api/signMessage.d.ts +8 -0
  25. package/lib/api/signMessage.js +16 -6
  26. package/lib/api/signTransaction.d.ts +205 -0
  27. package/lib/api/signTransaction.js +43 -0
  28. package/lib/api/solana/api/solanaSignTransaction.d.ts +20 -0
  29. package/lib/api/solana/api/solanaSignTransaction.js +132 -0
  30. package/lib/api/solana/solanaUtils.d.ts +1 -0
  31. package/lib/api/solana/solanaUtils.js +2 -1
  32. package/lib/backend/BackendManager.js +1 -1
  33. package/lib/backend/Blockchain.d.ts +1 -3
  34. package/lib/backend/Blockchain.js +1 -21
  35. package/lib/{api/bitcoin/BitcoinFees.d.ts → backend/fees/BitcoinFeeLevels.d.ts} +5 -6
  36. package/lib/{api/bitcoin/BitcoinFees.js → backend/fees/BitcoinFeeLevels.js} +5 -4
  37. package/lib/{api/ethereum/EthereumFees.d.ts → backend/fees/EthereumFeeLevels.d.ts} +4 -5
  38. package/lib/{api/ethereum/EthereumFees.js → backend/fees/EthereumFeeLevels.js} +4 -5
  39. package/lib/{api/common/MiscFees.d.ts → backend/fees/MiscFeeLevels.d.ts} +3 -3
  40. package/lib/{api/common/MiscFees.js → backend/fees/MiscFeeLevels.js} +3 -2
  41. package/lib/backend/fees/index.d.ts +6 -0
  42. package/lib/backend/fees/index.js +33 -0
  43. package/lib/constants/firmware.d.ts +0 -1
  44. package/lib/constants/firmware.js +1 -2
  45. package/lib/core/AbstractMethod.d.ts +7 -4
  46. package/lib/core/AbstractMethod.js +8 -1
  47. package/lib/core/index.d.ts +0 -1
  48. package/lib/core/index.js +22 -27
  49. package/lib/core/onCallFirmwareUpdate.js +1 -1
  50. package/lib/data/DataManager.d.ts +4 -1
  51. package/lib/data/DataManager.js +7 -0
  52. package/lib/data/config.d.ts +0 -14
  53. package/lib/data/config.js +4 -12
  54. package/lib/data/connectSettings.d.ts +5 -1
  55. package/lib/data/connectSettings.js +26 -2
  56. package/lib/data/defaultFeeLevels.js +3 -3
  57. package/lib/data/deviceAuthenticityConfig.js +22 -7
  58. package/lib/data/thpSettings.d.ts +3 -0
  59. package/lib/data/thpSettings.js +37 -0
  60. package/lib/data/version.d.ts +1 -1
  61. package/lib/data/version.js +1 -1
  62. package/lib/device/Device.d.ts +8 -11
  63. package/lib/device/Device.js +40 -80
  64. package/lib/device/DeviceCurrentSession.d.ts +9 -1
  65. package/lib/device/DeviceList.js +1 -1
  66. package/lib/events/index.d.ts +2 -0
  67. package/lib/events/ui-request.d.ts +18 -4
  68. package/lib/events/ui-request.js +1 -0
  69. package/lib/events/ui-response.d.ts +7 -1
  70. package/lib/events/ui-response.js +1 -0
  71. package/lib/factory.js +1 -0
  72. package/lib/tsconfig.lib.tsbuildinfo +1 -1
  73. package/lib/types/api/bleUnpair.d.ts +4 -0
  74. package/lib/types/api/bleUnpair.js +3 -0
  75. package/lib/types/api/index.d.ts +2 -0
  76. package/lib/types/api/solana/index.d.ts +4 -0
  77. package/lib/types/api/solana/index.js +1 -0
  78. package/lib/types/device.d.ts +4 -0
  79. package/lib/types/fees.d.ts +2 -0
  80. package/lib/types/fees.js +2 -0
  81. package/lib/types/firmware.d.ts +5 -0
  82. package/lib/types/settings.d.ts +20 -2
  83. package/lib/utils/firmwareUtils.d.ts +3 -1
  84. package/lib/utils/firmwareUtils.js +7 -1
  85. package/lib/utils/uiPromiseManager.d.ts +2 -0
  86. package/lib/utils/versionCheck.js +1 -1
  87. package/package.json +17 -16
@@ -5,8 +5,8 @@ const bigNumber_1 = require("@trezor/utils/lib/bigNumber");
5
5
  class MiscFeeLevels {
6
6
  coinInfo;
7
7
  levels;
8
- longTermFeeRate;
9
8
  blocks = [];
9
+ wasFetchedSuccessfully = false;
10
10
  constructor(coinInfo) {
11
11
  this.coinInfo = coinInfo;
12
12
  this.levels = coinInfo.defaultFees;
@@ -21,6 +21,7 @@ class MiscFeeLevels {
21
21
  ...response,
22
22
  feePerUnit,
23
23
  };
24
+ this.wasFetchedSuccessfully = true;
24
25
  }
25
26
  catch {
26
27
  }
@@ -28,4 +29,4 @@ class MiscFeeLevels {
28
29
  }
29
30
  }
30
31
  exports.MiscFeeLevels = MiscFeeLevels;
31
- //# sourceMappingURL=MiscFees.js.map
32
+ //# sourceMappingURL=MiscFeeLevels.js.map
@@ -0,0 +1,6 @@
1
+ import { BitcoinFeeLevels } from './BitcoinFeeLevels';
2
+ import { MiscFeeLevels } from './MiscFeeLevels';
3
+ import type { BitcoinNetworkInfo, CoinInfo } from '../../types';
4
+ export declare const getOrInitFeeLevels: (coinInfo: CoinInfo) => MiscFeeLevels;
5
+ export declare const getOrInitBitcoinFeeLevels: (coinInfo: BitcoinNetworkInfo) => BitcoinFeeLevels;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOrInitBitcoinFeeLevels = exports.getOrInitFeeLevels = void 0;
4
+ const type_utils_1 = require("@trezor/type-utils");
5
+ const BitcoinFeeLevels_1 = require("./BitcoinFeeLevels");
6
+ const EthereumFeeLevels_1 = require("./EthereumFeeLevels");
7
+ const MiscFeeLevels_1 = require("./MiscFeeLevels");
8
+ const instancesPerCoin = {};
9
+ const feeLevelsPerTypeFactory = (coinInfo) => {
10
+ const { type } = coinInfo;
11
+ switch (type) {
12
+ case 'bitcoin':
13
+ return new BitcoinFeeLevels_1.BitcoinFeeLevels(coinInfo);
14
+ case 'ethereum':
15
+ return new EthereumFeeLevels_1.EthereumFeeLevels(coinInfo);
16
+ case 'misc':
17
+ case 'nem':
18
+ return new MiscFeeLevels_1.MiscFeeLevels(coinInfo);
19
+ default:
20
+ return (0, type_utils_1.exhaustive)(type);
21
+ }
22
+ };
23
+ const getOrInitFeeLevels = (coinInfo) => {
24
+ const { shortcut } = coinInfo;
25
+ if (!Object.prototype.hasOwnProperty.call(instancesPerCoin, shortcut)) {
26
+ instancesPerCoin[shortcut] = feeLevelsPerTypeFactory(coinInfo);
27
+ }
28
+ return instancesPerCoin[shortcut];
29
+ };
30
+ exports.getOrInitFeeLevels = getOrInitFeeLevels;
31
+ const getOrInitBitcoinFeeLevels = (coinInfo) => (0, exports.getOrInitFeeLevels)(coinInfo);
32
+ exports.getOrInitBitcoinFeeLevels = getOrInitBitcoinFeeLevels;
33
+ //# sourceMappingURL=index.js.map
@@ -1,4 +1,3 @@
1
- export declare const FW_HASH_SUPPORTED_VERSIONS: string[];
2
1
  export declare const HASH_CHECK_MAX_ATTEMPTS = 3;
3
2
  export declare const HASH_CHECK_RETRIABLE_ERRORS: "other-error"[];
4
3
  export declare const REVISION_CHECK_RETRIABLE_ERRORS: ("cannot-perform-check-offline" | "other-error")[];
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.REVISION_CHECK_RETRIABLE_ERRORS = exports.HASH_CHECK_RETRIABLE_ERRORS = exports.HASH_CHECK_MAX_ATTEMPTS = exports.FW_HASH_SUPPORTED_VERSIONS = void 0;
4
- exports.FW_HASH_SUPPORTED_VERSIONS = ['1.11.1', '2.5.1'];
3
+ exports.REVISION_CHECK_RETRIABLE_ERRORS = exports.HASH_CHECK_RETRIABLE_ERRORS = exports.HASH_CHECK_MAX_ATTEMPTS = void 0;
5
4
  exports.HASH_CHECK_MAX_ATTEMPTS = 3;
6
5
  exports.HASH_CHECK_RETRIABLE_ERRORS = ['other-error'];
7
6
  exports.REVISION_CHECK_RETRIABLE_ERRORS = [
@@ -2,7 +2,7 @@ import { Capability } from '@trezor/protobuf/lib/messages';
2
2
  import { NETWORK } from '../constants';
3
3
  import type { Device } from '../device/Device';
4
4
  import { CallMethodPayload, CallMethodResponse, CoreEventMessage, UI, UiPromiseCreator, UiRequestButtonData, UiRequestConfirmation } from '../events';
5
- import type { ConnectSettings, DeviceState, FirmwareRange } from '../types';
5
+ import type { ConnectSettings, DeviceState, FirmwareRange, PrecomposeResultFinal } from '../types';
6
6
  export type Payload<M> = Extract<CallMethodPayload, {
7
7
  method: M;
8
8
  }> & {
@@ -49,7 +49,7 @@ export declare abstract class AbstractMethod<Name extends CallMethodPayload['met
49
49
  network: NETWORK.NetworkType;
50
50
  useCardanoDerivation: boolean;
51
51
  noBackupConfirmationMode: 'never' | 'always' | 'popup-only';
52
- getButtonRequestData?(code: string): UiRequestButtonData | undefined;
52
+ getButtonRequestData?(code: string, name?: string): UiRequestButtonData | undefined;
53
53
  postMessage: (message: CoreEventMessage) => void;
54
54
  createUiPromise: UiPromiseCreator;
55
55
  initAsync?(): Promise<void>;
@@ -64,7 +64,8 @@ export declare abstract class AbstractMethod<Name extends CallMethodPayload['met
64
64
  checkFirmwareRange(): "ui-device_firmware_old" | "ui-device_firmware_unsupported" | "ui-device_firmware_not_compatible" | "ui-device_firmware_not_installed" | undefined;
65
65
  isManagementRestricted({ popup, origin }: Pick<ConnectSettings, 'popup' | 'origin'>): boolean | undefined;
66
66
  abstract init(): void;
67
- getMethodInfo(): {
67
+ getMethodInfo(): Promise<{
68
+ useUi: boolean;
68
69
  useDevice: boolean;
69
70
  useDeviceState: boolean;
70
71
  name: Name;
@@ -83,7 +84,9 @@ export declare abstract class AbstractMethod<Name extends CallMethodPayload['met
83
84
  };
84
85
  analytics?: import("@trezor/connect-analytics").EventTypeDeviceSelected;
85
86
  } | undefined;
86
- };
87
+ precomposed: PrecomposeResultFinal | undefined;
88
+ }>;
89
+ payloadToPrecomposed(): Promise<PrecomposeResultFinal | undefined>;
87
90
  checkDeviceCapability(): void;
88
91
  abstract run(): Promise<MethodReturnType<Name>>;
89
92
  dispose(): void;
@@ -181,6 +181,8 @@ class AbstractMethod {
181
181
  const { device } = this;
182
182
  if (!device.features || device.isBootloader())
183
183
  return;
184
+ if (device.isSeedless())
185
+ return;
184
186
  const range = this.firmwareRange[device.features.internal_model];
185
187
  if (device.firmwareStatus === 'none') {
186
188
  return events_1.UI.FIRMWARE_NOT_INSTALLED;
@@ -211,16 +213,21 @@ class AbstractMethod {
211
213
  return !allowed;
212
214
  }
213
215
  }
214
- getMethodInfo() {
216
+ async getMethodInfo() {
215
217
  return {
218
+ useUi: this.useUi,
216
219
  useDevice: this.useDevice,
217
220
  useDeviceState: this.useDeviceState,
218
221
  name: this.name,
219
222
  requiredPermissions: this.requiredPermissions,
220
223
  info: this.info,
221
224
  confirmation: this.confirmation,
225
+ precomposed: await this.payloadToPrecomposed(),
222
226
  };
223
227
  }
228
+ payloadToPrecomposed() {
229
+ return Promise.resolve(undefined);
230
+ }
224
231
  checkDeviceCapability() {
225
232
  const deviceHasAllRequiredCapabilities = (this.requiredDeviceCapabilities || []).every(capability => this.device.features.capabilities.includes(capability));
226
233
  if (!deviceHasAllRequiredCapabilities) {
@@ -9,7 +9,6 @@ export declare class Core extends EventEmitter {
9
9
  private popupPromise;
10
10
  private methodSynchronize;
11
11
  private uiPromises;
12
- private overridePromise;
13
12
  private waitForFirstMethod;
14
13
  private _interactionTimeout?;
15
14
  private get interactionTimeout();
package/lib/core/index.js CHANGED
@@ -12,6 +12,7 @@ const onCallFirmwareUpdate_1 = require("./onCallFirmwareUpdate");
12
12
  const BlockchainLink_1 = require("../backend/BlockchainLink");
13
13
  const DataManager_1 = require("../data/DataManager");
14
14
  const analyticsInfo_1 = require("../data/analyticsInfo");
15
+ const connectSettings_1 = require("../data/connectSettings");
15
16
  const DeviceList_1 = require("../device/DeviceList");
16
17
  const StateStorage_1 = require("../device/StateStorage");
17
18
  const events_2 = require("../events");
@@ -156,7 +157,6 @@ const inner = async (context, method, device) => {
156
157
  }
157
158
  const unexpectedMode = device.hasUnexpectedMode(method.allowDeviceMode, method.requireDeviceMode);
158
159
  if (unexpectedMode) {
159
- device.releaseTransportSession();
160
160
  if (isUsingPopup) {
161
161
  await waitForPopup(context);
162
162
  sendCoreMessage((0, events_2.createUiMessage)(unexpectedMode, device.toMessageObject()));
@@ -290,7 +290,7 @@ const onCall = async (context, message) => {
290
290
  return Promise.resolve();
291
291
  }
292
292
  if (method.payload.__info) {
293
- const response = method.getMethodInfo();
293
+ const response = await method.getMethodInfo();
294
294
  sendCoreMessage((0, events_2.createResponseMessage)(method.responseID, true, response));
295
295
  return Promise.resolve();
296
296
  }
@@ -320,7 +320,7 @@ const onCall = async (context, message) => {
320
320
  return await onCallDevice(context, message, method);
321
321
  };
322
322
  const onCallDevice = async (context, message, method) => {
323
- const { deviceList, callMethods, getOverridePromise, setOverridePromise, sendCoreMessage } = context;
323
+ const { deviceList, callMethods, sendCoreMessage } = context;
324
324
  const responseID = message.id;
325
325
  const { origin, env, useCoreInPopup, transports } = DataManager_1.DataManager.getSettings();
326
326
  if (!deviceList.isConnected() && !deviceList.pendingConnection()) {
@@ -361,16 +361,15 @@ const onCallDevice = async (context, message, method) => {
361
361
  call.overridden = true;
362
362
  });
363
363
  const overrideError = constants_1.ERRORS.TypedError('Method_Override');
364
- setOverridePromise(device.override(overrideError));
365
- await getOverridePromise();
364
+ await device.interrupt(overrideError);
366
365
  if (method.overridden) {
367
366
  sendCoreMessage((0, events_2.createResponseMessage)(method.responseID, false, { error: overrideError }));
368
367
  throw overrideError;
369
368
  }
370
369
  }
371
- else if (device.isRunning()) {
372
- if (!device.isLoaded()) {
373
- await device.waitForFirstRun();
370
+ else if (device.currentRun) {
371
+ if (device.isUnacquired()) {
372
+ await device.currentRun;
374
373
  }
375
374
  else {
376
375
  sendCoreMessage((0, events_2.createResponseMessage)(responseID, false, {
@@ -389,9 +388,6 @@ const onCallDevice = async (context, message, method) => {
389
388
  }
390
389
  let messageResponse;
391
390
  try {
392
- if (getOverridePromise()) {
393
- await getOverridePromise();
394
- }
395
391
  const innerAction = () => inner(context, method, device).then(response => {
396
392
  messageResponse = response;
397
393
  });
@@ -417,9 +413,6 @@ const onCallDevice = async (context, message, method) => {
417
413
  }
418
414
  }
419
415
  finally {
420
- if (getOverridePromise()) {
421
- await getOverridePromise();
422
- }
423
416
  if (method.keepSession &&
424
417
  method.deviceState &&
425
418
  method.deviceState.sessionId !== device.getState()?.sessionId) {
@@ -427,10 +420,7 @@ const onCallDevice = async (context, message, method) => {
427
420
  }
428
421
  const response = messageResponse;
429
422
  if (response) {
430
- const shouldReleaseSession = response.success ||
431
- (!response.success &&
432
- response?.payload?.error !== 'device disconnected during action');
433
- await device.cleanup(shouldReleaseSession);
423
+ device.eventNames().forEach(e => device.removeAllListeners(e));
434
424
  if (useCoreInPopup) {
435
425
  sendCoreMessage(response);
436
426
  }
@@ -467,7 +457,7 @@ const onDeviceButtonHandler = (device, context, method) => async ({ payload: req
467
457
  await waitForPopup(context);
468
458
  }
469
459
  const data = typeof method?.getButtonRequestData === 'function' && request.code
470
- ? method?.getButtonRequestData(request.code)
460
+ ? method?.getButtonRequestData(request.code, request.name)
471
461
  : undefined;
472
462
  startInteractionTimeout(context);
473
463
  sendCoreMessage((0, events_2.createDeviceMessage)(events_2.DEVICE.BUTTON, { ...request, device: device.toMessageObject() }));
@@ -559,15 +549,14 @@ const registerDeviceEvents = (context, method) => (device) => {
559
549
  });
560
550
  };
561
551
  const onPopupClosed = (context, customErrorMessage) => {
562
- const { uiPromises, popupPromise, deviceList, callMethods, resetWaitForFirstMethod, setOverridePromise, sendCoreMessage, } = context;
552
+ const { uiPromises, popupPromise, deviceList, callMethods, resetWaitForFirstMethod, sendCoreMessage, } = context;
563
553
  const error = customErrorMessage
564
554
  ? constants_1.ERRORS.TypedError('Method_Cancel', customErrorMessage)
565
555
  : constants_1.ERRORS.TypedError('Method_Interrupted');
566
556
  if (deviceList.isConnected() && deviceList.getDeviceCount() > 0) {
567
557
  deviceList.getAllDevices().forEach(d => {
568
- d.releaseTransportSession();
569
558
  if (d.isUsedHere()) {
570
- setOverridePromise(d.interruptionFromUser(error));
559
+ d.interrupt(error);
571
560
  }
572
561
  else {
573
562
  const success = uiPromises.resolve({ type: events_2.DEVICE.DISCONNECT, payload: undefined });
@@ -644,7 +633,6 @@ class Core extends events_1.default {
644
633
  popupPromise = (0, popupPromiseManager_1.createPopupPromiseManager)();
645
634
  methodSynchronize = (0, utils_1.getSynchronize)();
646
635
  uiPromises = (0, uiPromiseManager_1.createUiPromiseManager)(() => startInteractionTimeout(this.getCoreContext()));
647
- overridePromise;
648
636
  waitForFirstMethod = (0, utils_1.createDeferred)();
649
637
  _interactionTimeout;
650
638
  get interactionTimeout() {
@@ -681,10 +669,6 @@ class Core extends events_1.default {
681
669
  resolveWaitForFirstMethod: () => {
682
670
  this.waitForFirstMethod.resolve();
683
671
  },
684
- getOverridePromise: () => this.overridePromise,
685
- setOverridePromise: (promise) => {
686
- this.overridePromise = promise;
687
- },
688
672
  };
689
673
  }
690
674
  handleMessage(message) {
@@ -731,6 +715,13 @@ class Core extends events_1.default {
731
715
  case events_2.UI.LOGIN_CHALLENGE_RESPONSE:
732
716
  this.uiPromises.resolve(message);
733
717
  break;
718
+ case events_2.UI.RECEIVE_FIRMWARE: {
719
+ const localFirmwares = message.payload && (0, connectSettings_1.parseLocalFirmwares)(message.payload);
720
+ if (localFirmwares) {
721
+ DataManager_1.DataManager.setLocalFirmwares(localFirmwares);
722
+ }
723
+ break;
724
+ }
734
725
  case events_2.IFRAME.CALL:
735
726
  if (message.payload.method === 'firmwareUpdate') {
736
727
  (0, DeviceList_1.assertDeviceListConnected)(this.deviceList);
@@ -790,6 +781,10 @@ class Core extends events_1.default {
790
781
  const onCoreEventThrottled = (message) => throttlePromise.promise.then(() => onCoreEvent(message));
791
782
  try {
792
783
  await DataManager_1.DataManager.load(settings);
784
+ const localFirmwares = settings.localFirmwares && (0, connectSettings_1.parseLocalFirmwares)(settings.localFirmwares);
785
+ if (localFirmwares) {
786
+ DataManager_1.DataManager.setLocalFirmwares(localFirmwares);
787
+ }
793
788
  const { debug, priority, _sessionsBackgroundUrl, manifest } = DataManager_1.DataManager.getSettings();
794
789
  const messages = DataManager_1.DataManager.getProtobufMessages();
795
790
  (0, debug_1.enableLog)(debug);
@@ -72,7 +72,7 @@ const waitForReconnectedDevice = async ({ bootloader, method, intermediary }, {
72
72
  throw constants_1.ERRORS.TypedError('Method_Interrupted');
73
73
  }
74
74
  registerEvents(reconnectedDevice);
75
- await reconnectedDevice.waitForFirstRun();
75
+ await reconnectedDevice.currentRun;
76
76
  if (!reconnectedDevice.isUsedHere()) {
77
77
  await reconnectedDevice.acquire();
78
78
  }
@@ -1,4 +1,4 @@
1
- import { ConnectSettings } from '../types';
1
+ import type { ConnectSettings, LocalFirmwares } from '../types/settings';
2
2
  type AssetCollection = {
3
3
  [key: string]: Record<string, any>;
4
4
  };
@@ -6,10 +6,13 @@ export declare class DataManager {
6
6
  static assets: AssetCollection;
7
7
  private static settings;
8
8
  private static messages;
9
+ private static localFirmwares;
9
10
  static load(settings: ConnectSettings, withAssets?: boolean): void;
10
11
  static getProtobufMessages(): Record<string, any>;
11
12
  static getSettings(key?: undefined): ConnectSettings;
12
13
  static getSettings<T extends keyof ConnectSettings>(key: T): ConnectSettings[T];
14
+ static setLocalFirmwares(firmwares: LocalFirmwares): void;
15
+ static getLocalFirmwares(): LocalFirmwares;
13
16
  }
14
17
  export {};
15
18
  //# sourceMappingURL=DataManager.d.ts.map
@@ -13,6 +13,7 @@ class DataManager {
13
13
  static assets = {};
14
14
  static settings;
15
15
  static messages = messages_json_1.default;
16
+ static localFirmwares = { firmwareDir: '', firmwareList: [] };
16
17
  static load(settings, withAssets = true) {
17
18
  this.settings = settings;
18
19
  if (!withAssets)
@@ -49,6 +50,12 @@ class DataManager {
49
50
  }
50
51
  return this.settings;
51
52
  }
53
+ static setLocalFirmwares(firmwares) {
54
+ this.localFirmwares = firmwares;
55
+ }
56
+ static getLocalFirmwares() {
57
+ return this.localFirmwares;
58
+ }
52
59
  }
53
60
  exports.DataManager = DataManager;
54
61
  //# sourceMappingURL=DataManager.js.map
@@ -13,7 +13,6 @@ export declare const config: {
13
13
  knownHosts: {
14
14
  origin: string;
15
15
  label: string;
16
- icon: string;
17
16
  }[];
18
17
  onionDomains: {
19
18
  'trezor.io': string;
@@ -156,19 +155,6 @@ export declare const config: {
156
155
  max?: undefined;
157
156
  comment?: undefined;
158
157
  capabilities?: undefined;
159
- } | {
160
- methods: string[];
161
- min: {
162
- T1B1: string;
163
- T2T1: string;
164
- T3T1?: undefined;
165
- T2B1?: undefined;
166
- T3B1?: undefined;
167
- };
168
- coin?: undefined;
169
- max?: undefined;
170
- comment?: undefined;
171
- capabilities?: undefined;
172
158
  } | {
173
159
  methods: string[];
174
160
  min: {
@@ -18,50 +18,41 @@ exports.config = {
18
18
  {
19
19
  origin: 'imloifkgjagghnncjkhggdhalmcnfklk',
20
20
  label: 'Trezor Password Manager (Develop)',
21
- icon: '',
22
21
  },
23
- { origin: 'niebkpllfhmpfbffbfifagfgoamhpflf', label: 'Trezor Password Manager', icon: '' },
22
+ { origin: 'niebkpllfhmpfbffbfifagfgoamhpflf', label: 'Trezor Password Manager' },
24
23
  {
25
24
  origin: 'mnpfhpndmjholfdlhpkjfmjkgppmodaf',
26
25
  label: 'MetaMask',
27
- icon: '',
28
26
  },
29
27
  {
30
28
  origin: 'webextension@metamask.io',
31
29
  label: 'MetaMask',
32
- icon: '',
33
30
  },
34
31
  {
35
32
  origin: 'nkbihfbeogaeaoehlefnkodbefgpgknn',
36
33
  label: 'MetaMask',
37
- icon: '',
38
34
  },
39
35
  {
40
36
  origin: 'bpcdaglidgnlggelgbjfagekoapjmccp',
41
37
  label: 'Rainbow DEV',
42
- icon: '',
43
38
  },
44
39
  {
45
40
  origin: 'opfgelmcmbiajamepnmloijbpoleiama',
46
41
  label: 'Rainbow',
47
- icon: '',
48
42
  },
49
43
  {
50
44
  origin: 'acmacodkjbdgmoleebolmdjonilkdbch',
51
45
  label: 'Rabby',
52
- icon: '',
53
46
  },
54
47
  {
55
48
  origin: 'ehnpnhnhcickeknioaiodjmielfaoajd',
56
49
  label: 'Ambire DEV',
57
- icon: '',
58
50
  },
59
51
  {
60
52
  origin: 'ehgjhhccekdedpbkifaojjaefeohnoea',
61
53
  label: 'Ambire',
62
- icon: '',
63
54
  },
64
- { origin: 'file://', label: ' ', icon: '' },
55
+ { origin: 'file://', label: ' ' },
65
56
  ],
66
57
  onionDomains: {
67
58
  'trezor.io': 'trezoriovpjcahpzkrewelclulmszwbqpzmzgub37gbcjlvluxtruqad.onion',
@@ -236,6 +227,7 @@ exports.config = {
236
227
  },
237
228
  },
238
229
  {
230
+ capabilities: ['getFirmwareHash'],
239
231
  methods: ['getFirmwareHash'],
240
232
  min: { T1B1: '1.11.1', T2T1: '2.5.1' },
241
233
  },
@@ -268,7 +260,7 @@ exports.config = {
268
260
  },
269
261
  {
270
262
  capabilities: ['entropyCheck'],
271
- min: { T1B1: '0', T2T1: '2.8.7', T2B1: '2.8.7', T3B1: '2.8.7', T3T1: '2.8.7' },
263
+ min: { T1B1: '1.13.1', T2T1: '2.8.7', T2B1: '2.8.7', T3B1: '2.8.7', T3T1: '2.8.7' },
272
264
  },
273
265
  ],
274
266
  };
@@ -1,5 +1,9 @@
1
- import type { ConnectSettings } from '../types';
1
+ import type { ConnectSettings, LocalFirmwares } from '../types/settings';
2
2
  export declare const DEFAULT_PRIORITY = 2;
3
+ export declare const parseLocalFirmwares: (localFirmwares: LocalFirmwares) => {
4
+ firmwareDir: string;
5
+ firmwareList: string[];
6
+ } | undefined;
3
7
  export declare const corsValidator: (url?: string) => string | undefined;
4
8
  export declare const parseConnectSettings: (input?: Partial<ConnectSettings>) => ConnectSettings;
5
9
  //# sourceMappingURL=connectSettings.d.ts.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseConnectSettings = exports.corsValidator = exports.DEFAULT_PRIORITY = void 0;
3
+ exports.parseConnectSettings = exports.corsValidator = exports.parseLocalFirmwares = exports.DEFAULT_PRIORITY = void 0;
4
+ const thpSettings_1 = require("./thpSettings");
4
5
  const version_1 = require("./version");
5
6
  exports.DEFAULT_PRIORITY = 2;
6
7
  const initialSettings = {
@@ -31,11 +32,30 @@ const parseManifest = (manifest) => {
31
32
  return;
32
33
  if (typeof manifest.appUrl !== 'string')
33
34
  return;
35
+ if (typeof manifest.appName !== 'undefined' && typeof manifest.appName !== 'string')
36
+ return;
37
+ if (typeof manifest.appIcon !== 'undefined' && typeof manifest.appIcon !== 'string')
38
+ return;
34
39
  return {
35
40
  email: manifest.email,
36
41
  appUrl: manifest.appUrl,
42
+ appName: manifest.appName,
43
+ appIcon: manifest.appIcon,
37
44
  };
38
45
  };
46
+ const parseLocalFirmwares = (localFirmwares) => {
47
+ if (!localFirmwares)
48
+ return;
49
+ if (typeof localFirmwares.firmwareDir !== 'string')
50
+ return;
51
+ if (!Array.isArray(localFirmwares.firmwareList))
52
+ return;
53
+ return {
54
+ firmwareDir: localFirmwares.firmwareDir,
55
+ firmwareList: localFirmwares.firmwareList,
56
+ };
57
+ };
58
+ exports.parseLocalFirmwares = parseLocalFirmwares;
39
59
  const corsValidator = (url) => {
40
60
  if (typeof url !== 'string')
41
61
  return;
@@ -77,6 +97,9 @@ const parseConnectSettings = (input = {}) => {
77
97
  if (typeof input.transportReconnect === 'boolean') {
78
98
  settings.transportReconnect = input.transportReconnect;
79
99
  }
100
+ if (typeof input.localFirmwares === 'object') {
101
+ settings.localFirmwares = (0, exports.parseLocalFirmwares)(input.localFirmwares);
102
+ }
80
103
  if (Array.isArray(input.transports)) {
81
104
  settings.transports = input.transports;
82
105
  }
@@ -108,7 +131,7 @@ const parseConnectSettings = (input = {}) => {
108
131
  settings.sharedLogger = input.sharedLogger;
109
132
  }
110
133
  if (typeof input.coreMode === 'string' &&
111
- ['auto', 'popup', 'iframe'].includes(input.coreMode)) {
134
+ ['auto', 'popup', 'iframe', 'suite-desktop'].includes(input.coreMode)) {
112
135
  settings.coreMode = input.coreMode;
113
136
  }
114
137
  if (typeof input._extendWebextensionLifetime === 'boolean') {
@@ -126,6 +149,7 @@ const parseConnectSettings = (input = {}) => {
126
149
  if (typeof input.npmVersion === 'string') {
127
150
  settings.npmVersion = input.npmVersion;
128
151
  }
152
+ settings.thp = (0, thpSettings_1.parseThpSettings)(input);
129
153
  return settings;
130
154
  };
131
155
  exports.parseConnectSettings = parseConnectSettings;
@@ -5,9 +5,9 @@ const utils_1 = require("@trezor/utils");
5
5
  const BLOCKS_FOR_FEE_LEVEL = {
6
6
  btc: {
7
7
  high: 1,
8
- normal: 6,
9
- economy: 36,
10
- low: 144,
8
+ normal: 3,
9
+ economy: 12,
10
+ low: 36,
11
11
  },
12
12
  };
13
13
  const getDefaultBlocksForFeeLevel = (shortcut, label) => BLOCKS_FOR_FEE_LEVEL[shortcut] && BLOCKS_FOR_FEE_LEVEL[shortcut][label]
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deviceAuthenticityConfig = void 0;
4
4
  exports.deviceAuthenticityConfig = {
5
5
  version: 1,
6
- timestamp: '2025-03-26T12:00:00.000Z',
6
+ timestamp: '2025-04-23T12:00:00.000Z',
7
7
  T2B1: {
8
8
  rootPubKeys: [
9
9
  '04ca97480ac0d7b1e6efafe518cd433cec2bf8ab9822d76eafd34363b55d63e60380bff20acc75cde03cffcb50ab6f8ce70c878e37ebc58ff7cca0a83b16b15fa5',
@@ -87,10 +87,19 @@ exports.deviceAuthenticityConfig = {
87
87
  '040abd7641975f6dab835e9189ba2e2f5e19feeef3eb43d3e940f903be7ddb6317450c6c0f40094584dfe8aea75f086e850b2b362982fdca684fbd07720e1482d9',
88
88
  '049e189082b8a35e4f46577d62fe15b76a713e9ef54f80c1aee33db05890048af5886518d643715a439ce3eead5dac6cbe1fbde26bf09ea083eccc7e8c1098c3dc',
89
89
  '04be948fcc006a7d719d89019a446a8f9ff298410d203db096cbd76383b3807f3d4927ef5db437b99696edbed37829b03235f49f25603bed32d7eee2c49ede403b',
90
+ '0406f9e393b85787a8cc64592da993088a8e2c67b80046e6c9b567b0317e4829d7c6b6c8776ed2bbdd7e5d0ce4a72728ef12b62a022bff9179476a2e73a5df77e9',
91
+ '0450fd843fc53a32bfb3db32ddbd8ba9010e3f2f68fc411b2f1f0807312e39469f463aad467afc1d43147e7832972c7b0308b247da9f284d259d96ee78fb6f5cb8',
92
+ '04e38848f936b8cd47500ff5343afbbbe41e47b83037a14bb84a7cf5f7d5e3e14a38374ce4af968bc842aa7a9f69e8bed74a0a0aab72e7e05184c1522beca6689e',
90
93
  ],
91
94
  debug: {
92
- rootPubKeys: [],
93
- caPubKeys: [],
95
+ rootPubKeys: [
96
+ '047f77368dea2d4d61e989f474a56723c3212dacf8a808d8795595ef38441427c4389bc454f02089d7f08b873005e4c28d432468997871c0bf286fd3861e21e96a',
97
+ ],
98
+ caPubKeys: [
99
+ '0410a6bc4f9eb52fd450be2c365189ea6a523fdddd62e44566dc349a8c7f813144cde81c8c106b74bfceae9c8ca5202af635ce1a5330c41c708ebbf505e025c339',
100
+ '04e979dab5fc3ed274f7a217850af3d483ed7e221f9a9845e1462ad8dd63e51c084682d736675df6273a114289f26e0150bd1cda97834c537f11e3506761352159',
101
+ '04f7c60026bfbb9bc75bcdf57bc3357457a16cfe25293f996bc32ee73597c9864f5ed8d2359f58b6797d69ef03b50fc3e99ac02a893b945f67b460fa84a6b2b35c',
102
+ ],
94
103
  },
95
104
  },
96
105
  T3T1: {
@@ -145,11 +154,17 @@ exports.deviceAuthenticityConfig = {
145
154
  },
146
155
  },
147
156
  T3W1: {
148
- rootPubKeys: ['you shall not pass'],
149
- caPubKeys: ['you shall not pass'],
157
+ rootPubKeys: [],
158
+ caPubKeys: [],
150
159
  debug: {
151
- rootPubKeys: ['you shall not pass'],
152
- caPubKeys: ['you shall not pass'],
160
+ rootPubKeys: [
161
+ '04521192e173a9da4e3023f747d836563725372681eba3079c56ff11b2fc137ab189eb4155f371127651b5594f8c332fc1e9c0f3b80d4212822668b63189706578',
162
+ ],
163
+ caPubKeys: [
164
+ '04a5d701fced9b5a2cd076a02d8a98e779c54946eefc7b2525fac782fa3d65b5d9e6a8c90946bd30b35dfeec34a053f1106ba130a8472037f2db8cf2c4b3b6e93a',
165
+ '047e5985facc7f4084581fc80aa7c15684a39138aa31d83064aa7fbbb1c20b77b9c65405257131e8e82bb587b07df89985b895ff50fb597d35ce8b37711b4b290b',
166
+ '0426be191b127e795456d4fc758ebf2a0119f5ed745b415e339588483a8b50942277ce5e791a1a40b4bcdf1ff27c98700bb878b2d9376334d609778f4a38077ab9',
167
+ ],
153
168
  },
154
169
  },
155
170
  };
@@ -0,0 +1,3 @@
1
+ import type { ConnectSettings, ThpSettings } from '../types/settings';
2
+ export declare const parseThpSettings: ({ manifest, thp }: Partial<ConnectSettings>) => ThpSettings;
3
+ //# sourceMappingURL=thpSettings.d.ts.map
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseThpSettings = void 0;
4
+ const parseThpSettings = ({ manifest, thp }) => {
5
+ const settings = {
6
+ pairingMethods: [],
7
+ };
8
+ if (Array.isArray(thp?.pairingMethods)) {
9
+ settings.pairingMethods = thp.pairingMethods;
10
+ }
11
+ else {
12
+ settings.pairingMethods = ['CodeEntry'];
13
+ }
14
+ if (typeof thp?.hostName === 'string') {
15
+ settings.hostName = thp.hostName;
16
+ }
17
+ else if (typeof manifest?.appName === 'string') {
18
+ settings.hostName = manifest?.appName;
19
+ }
20
+ if (typeof thp?.staticKey === 'string') {
21
+ settings.staticKey = thp.staticKey;
22
+ }
23
+ if (Array.isArray(thp?.knownCredentials)) {
24
+ settings.knownCredentials = thp.knownCredentials.flatMap(k => {
25
+ if (k &&
26
+ typeof k === 'object' &&
27
+ typeof k.credential === 'string' &&
28
+ typeof k.trezor_static_pubkey === 'string') {
29
+ return k;
30
+ }
31
+ return [];
32
+ });
33
+ }
34
+ return settings;
35
+ };
36
+ exports.parseThpSettings = parseThpSettings;
37
+ //# sourceMappingURL=thpSettings.js.map
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "9.5.4";
1
+ export declare const VERSION = "9.5.5-beta.2";
2
2
  export declare const DEFAULT_DOMAIN: string;
3
3
  export declare const CONTENT_SCRIPT_VERSION = 1;
4
4
  export declare const DEEPLINK_VERSION = 1;