@trezor/connect 9.6.3-beta.2 → 9.6.4-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/CHANGELOG.md +16 -9
  2. package/README.md +1 -1
  3. package/lib/api/applyFlags.d.ts +1 -1
  4. package/lib/api/applyFlags.js +2 -2
  5. package/lib/api/applySettings.d.ts +1 -1
  6. package/lib/api/authenticateDevice.js +4 -0
  7. package/lib/api/authorizeCoinjoin.d.ts +1 -1
  8. package/lib/api/backupDevice.d.ts +1 -1
  9. package/lib/api/backupDevice.js +2 -2
  10. package/lib/api/bitcoin/TransactionComposer.d.ts +1 -1
  11. package/lib/api/bitcoin/inputs.d.ts +1 -1
  12. package/lib/api/bitcoin/transactionBytes.d.ts +2 -2
  13. package/lib/api/bleUnpair.js +1 -1
  14. package/lib/api/cancelCoinjoinAuthorization.d.ts +1 -1
  15. package/lib/api/cardano/api/cardanoSignTransaction.d.ts +2 -2
  16. package/lib/api/cardano/cardanoInputs.js +2 -2
  17. package/lib/api/changePin.d.ts +1 -1
  18. package/lib/api/changePin.js +2 -2
  19. package/lib/api/changeWipeCode.d.ts +1 -1
  20. package/lib/api/cipherKeyValue.d.ts +1 -1
  21. package/lib/api/eos/api/eosGetPublicKey.d.ts +1 -1
  22. package/lib/api/eos/api/eosSignTransaction.d.ts +1 -1
  23. package/lib/api/eos/eosSignTx.d.ts +20 -20
  24. package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +5 -5
  25. package/lib/api/ethereum/api/ethereumSignMessage.d.ts +1 -2
  26. package/lib/api/ethereum/api/ethereumVerifyMessage.d.ts +1 -1
  27. package/lib/api/evoluGetNode.d.ts +1 -1
  28. package/lib/api/evoluGetNode.js +2 -2
  29. package/lib/api/firmware/calculateFirmwareHash.d.ts +9 -2
  30. package/lib/api/firmware/calculateFirmwareHash.js +11 -1
  31. package/lib/api/firmware/verifyAuthenticityProof.d.ts +3 -1
  32. package/lib/api/firmware/verifyAuthenticityProof.js +10 -15
  33. package/lib/api/getCoinInfo.d.ts +34 -34
  34. package/lib/api/getFeatures.d.ts +1 -0
  35. package/lib/api/getFirmwareHash.d.ts +1 -1
  36. package/lib/api/getFirmwareHash.js +2 -2
  37. package/lib/api/getNonce.d.ts +1 -1
  38. package/lib/api/getOwnershipId.d.ts +1 -1
  39. package/lib/api/getOwnershipId.js +2 -2
  40. package/lib/api/getOwnershipProof.d.ts +1 -1
  41. package/lib/api/getOwnershipProof.js +2 -2
  42. package/lib/api/getPublicKey.d.ts +5 -5
  43. package/lib/api/loadDevice.d.ts +1 -1
  44. package/lib/api/loadDevice.js +2 -2
  45. package/lib/api/nem/api/nemSignTransaction.d.ts +1 -1
  46. package/lib/api/nem/nemSignTx.d.ts +9 -9
  47. package/lib/api/recoveryDevice.d.ts +1 -1
  48. package/lib/api/requestLogin.d.ts +1 -1
  49. package/lib/api/ripple/api/rippleSignTransaction.d.ts +1 -1
  50. package/lib/api/setBrightness.d.ts +1 -1
  51. package/lib/api/setBrightness.js +2 -2
  52. package/lib/api/setBusy.d.ts +1 -1
  53. package/lib/api/setBusy.js +2 -2
  54. package/lib/api/showDeviceTutorial.d.ts +1 -1
  55. package/lib/api/signMessage.d.ts +1 -1
  56. package/lib/api/solana/api/solanaComposeTransaction.d.ts +6 -0
  57. package/lib/api/solana/api/solanaComposeTransaction.js +9 -0
  58. package/lib/api/solana/api/solanaSignTransaction.js +4 -4
  59. package/lib/api/tezos/api/tezosGetPublicKey.d.ts +1 -1
  60. package/lib/api/tezos/api/tezosSignTransaction.d.ts +1 -1
  61. package/lib/api/tezos/tezosSignTx.d.ts +17 -17
  62. package/lib/api/unlockPath.d.ts +1 -1
  63. package/lib/core/AbstractMethod.d.ts +4 -1
  64. package/lib/core/index.js +8 -1
  65. package/lib/core/onCallFirmwareUpdate.js +42 -51
  66. package/lib/data/coinInfo.d.ts +94 -93
  67. package/lib/data/config.js +9 -1
  68. package/lib/data/defaultFeeLevels.d.ts +1 -1
  69. package/lib/data/defaultFeeLevels.js +1 -1
  70. package/lib/data/deviceAuthenticityBlacklist.d.ts +3 -0
  71. package/lib/data/deviceAuthenticityBlacklist.js +11 -0
  72. package/lib/data/deviceAuthenticityBlacklistConfig.d.ts +11 -0
  73. package/lib/data/deviceAuthenticityBlacklistConfig.js +15 -0
  74. package/lib/data/deviceAuthenticityConfig.js +4 -140
  75. package/lib/data/deviceAuthenticityConfigTypes.d.ts +0 -9
  76. package/lib/data/deviceAuthenticityConfigTypes.js +3 -5
  77. package/lib/data/firmwareInfo.d.ts +12 -7
  78. package/lib/data/firmwareInfo.js +58 -15
  79. package/lib/data/transportInfo.d.ts +11 -1
  80. package/lib/data/udevInfo.d.ts +9 -1
  81. package/lib/data/version.d.ts +1 -1
  82. package/lib/data/version.js +1 -1
  83. package/lib/device/Device.d.ts +20 -10
  84. package/lib/device/Device.js +95 -23
  85. package/lib/device/DeviceCommands.d.ts +4 -4
  86. package/lib/device/DeviceCurrentSession.d.ts +242 -242
  87. package/lib/device/DeviceCurrentSession.js +1 -1
  88. package/lib/device/DeviceList.d.ts +7 -4
  89. package/lib/device/DeviceList.js +14 -4
  90. package/lib/device/StateStorage.d.ts +1 -1
  91. package/lib/device/checkFirmwareRevision.d.ts +1 -1
  92. package/lib/device/checkFirmwareRevision.js +2 -2
  93. package/lib/device/thp/handshake.d.ts +1 -1
  94. package/lib/device/thp/handshake.js +14 -3
  95. package/lib/device/thp/index.d.ts +1 -1
  96. package/lib/device/thp/index.js +29 -4
  97. package/lib/device/thp/pairing.js +1 -3
  98. package/lib/device/thp/session.js +1 -1
  99. package/lib/device/workflow/checkFirmwareHash.js +6 -1
  100. package/lib/device/workflow/handshake.js +3 -7
  101. package/lib/device/workflow/trezorPushNotification.d.ts +3 -0
  102. package/lib/device/workflow/trezorPushNotification.js +76 -0
  103. package/lib/device/workflow/validateState.js +3 -0
  104. package/lib/events/call.d.ts +1 -1
  105. package/lib/events/device.d.ts +11 -3
  106. package/lib/events/device.js +5 -1
  107. package/lib/events/popup.d.ts +1 -1
  108. package/lib/events/transport.d.ts +3 -21
  109. package/lib/events/ui-request.d.ts +15 -8
  110. package/lib/tsconfig.lib.tsbuildinfo +1 -1
  111. package/lib/types/api/applyFlags.d.ts +1 -1
  112. package/lib/types/api/applySettings.d.ts +1 -0
  113. package/lib/types/api/authenticateDevice.d.ts +9 -10
  114. package/lib/types/api/authenticateDevice.js +2 -0
  115. package/lib/types/api/backupDevice.d.ts +1 -1
  116. package/lib/types/api/bitcoin/index.d.ts +1 -1
  117. package/lib/types/api/bleUnpair.d.ts +1 -1
  118. package/lib/types/api/cancelCoinjoinAuthorization.d.ts +1 -1
  119. package/lib/types/api/cardanoComposeTransaction.d.ts +2 -2
  120. package/lib/types/api/cardanoComposeTransaction.js +2 -2
  121. package/lib/types/api/changePin.d.ts +1 -1
  122. package/lib/types/api/changeWipeCode.d.ts +1 -1
  123. package/lib/types/api/composeTransaction.d.ts +1 -1
  124. package/lib/types/api/discoverAccounts.d.ts +1 -1
  125. package/lib/types/api/discoverAccounts.js +1 -1
  126. package/lib/types/api/eosSignTransaction.d.ts +1 -1
  127. package/lib/types/api/ethereum/index.d.ts +8 -8
  128. package/lib/types/api/ethereumSignMessage.d.ts +1 -1
  129. package/lib/types/api/ethereumSignTypedData.d.ts +1 -1
  130. package/lib/types/api/ethereumVerifyMessage.d.ts +1 -1
  131. package/lib/types/api/getAccountInfo.d.ts +1 -1
  132. package/lib/types/api/getAddress.d.ts +6 -6
  133. package/lib/types/api/getFirmwareHash.d.ts +1 -1
  134. package/lib/types/api/nemGetAddress.d.ts +1 -1
  135. package/lib/types/api/nemSignTransaction.d.ts +1 -1
  136. package/lib/types/api/recoveryDevice.d.ts +2 -2
  137. package/lib/types/api/setBusy.d.ts +1 -1
  138. package/lib/types/api/setProxy.d.ts +1 -1
  139. package/lib/types/api/showDeviceTutorial.d.ts +1 -1
  140. package/lib/types/api/signMessage.d.ts +1 -1
  141. package/lib/types/api/solana/index.d.ts +26 -3
  142. package/lib/types/api/solana/index.js +19 -3
  143. package/lib/types/api/tezosSignTransaction.d.ts +1 -1
  144. package/lib/types/api/thpRemoveCredentials.d.ts +1 -1
  145. package/lib/types/api/unlockPath.d.ts +1 -1
  146. package/lib/types/api/verifyMessage.d.ts +1 -1
  147. package/lib/types/api/wipeDevice.d.ts +1 -1
  148. package/lib/types/device.d.ts +9 -4
  149. package/lib/types/device.js +5 -3
  150. package/lib/types/firmware.d.ts +1 -0
  151. package/lib/types/settings.d.ts +2 -2
  152. package/lib/types/workflow.d.ts +4 -0
  153. package/lib/utils/assetUtils.d.ts +6 -4
  154. package/lib/utils/assetUtils.js +13 -2
  155. package/lib/utils/assets-browser.d.ts +0 -4
  156. package/lib/utils/assets-browser.js +3 -11
  157. package/lib/utils/assets.native.js +1 -1
  158. package/lib/utils/deviceFeaturesUtils.d.ts +1 -1
  159. package/lib/utils/firmwareUtils.d.ts +7 -4
  160. package/lib/utils/firmwareUtils.js +21 -14
  161. package/lib/utils/pathUtils.d.ts +3 -2
  162. package/lib/utils/uiPromiseManager.d.ts +9 -9
  163. package/package.json +16 -15
@@ -1,5 +1,5 @@
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
1
2
  import type { ThpCredentials } from '@trezor/protocol';
2
- import type { PROTO } from '../../constants';
3
3
  import type { CommonParams, Response } from '../params';
4
4
  export declare function thpRemoveCredentials(params: CommonParams & {
5
5
  credentials?: ThpCredentials[];
@@ -1,5 +1,5 @@
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
1
2
  import { Static } from '@trezor/schema-utils';
2
- import type { PROTO } from '../../constants';
3
3
  import { Params, Response } from '../params';
4
4
  export type UnlockPathParams = Static<typeof UnlockPathParams>;
5
5
  export declare const UnlockPathParams: import("@trezor/schema-utils").TObject<{
@@ -1,4 +1,4 @@
1
- import type { PROTO } from '../../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import type { Params, Response } from '../params';
3
3
  import type { VerifyMessage } from './bitcoin';
4
4
  export declare function verifyMessage(params: Params<VerifyMessage>): Response<PROTO.Success>;
@@ -1,4 +1,4 @@
1
- import type { PROTO } from '../../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import type { CommonParams, Response } from '../params';
3
3
  export declare function wipeDevice(params?: CommonParams): Response<PROTO.Success>;
4
4
  //# sourceMappingURL=wipeDevice.d.ts.map
@@ -1,9 +1,11 @@
1
1
  import { FeaturesNarrowing, FirmwareType } from '@trezor/device-utils';
2
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
3
  import type { ThpStateSerialized } from '@trezor/protocol';
4
+ import { Descriptor } from '@trezor/transport';
3
5
  import { Branded } from '@trezor/type-utils';
4
- import type { PROTO } from '../constants';
5
6
  import type { FirmwareReleaseConfigInfo } from './firmware';
6
- export type DeviceStatus = 'available' | 'occupied' | 'used' | 'busy';
7
+ export type DeviceBusyStatus = 'busy' | 'rebooting' | 'bootloader-locked' | 'hard-locked' | 'pin-locked' | 'thp-locked';
8
+ export type DeviceStatus = 'available' | 'occupied' | 'used' | DeviceBusyStatus;
7
9
  export type DeviceMode = 'normal' | 'bootloader' | 'initialize' | 'seedless';
8
10
  export type DeviceFirmwareStatus = 'valid' | 'outdated' | 'required' | 'unknown' | 'custom' | 'none';
9
11
  export type UnavailableCapability = 'no-capability' | 'no-support' | 'update-required' | 'trezor-connect-outdated';
@@ -36,13 +38,16 @@ export type FirmwareHashCheckResult = {
36
38
  errorPayload?: unknown;
37
39
  };
38
40
  export type DeviceUniquePath = string & Branded<'DeviceUniquePath'>;
39
- export declare const DeviceUniquePath: (id: string) => DeviceUniquePath;
41
+ export declare const asDeviceUniquePath: (id: string) => DeviceUniquePath;
40
42
  type BaseDevice = {
41
43
  path: DeviceUniquePath;
42
44
  name: string;
45
+ descriptor: Pick<Descriptor, 'apiType' | 'id'>;
43
46
  };
47
+ export type BluetoothDeviceId = string & Branded<'BluetoothDeviceId'>;
48
+ export declare const asBluetoothDeviceId: (id: string) => BluetoothDeviceId;
44
49
  export type BluetoothDeviceProps = {
45
- id: string;
50
+ id: BluetoothDeviceId;
46
51
  };
47
52
  export type KnownDevice = BaseDevice & {
48
53
  type: 'acquired';
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeviceUniquePath = void 0;
4
- const DeviceUniquePath = (id) => id;
5
- exports.DeviceUniquePath = DeviceUniquePath;
3
+ exports.asBluetoothDeviceId = exports.asDeviceUniquePath = void 0;
4
+ const asDeviceUniquePath = (id) => id;
5
+ exports.asDeviceUniquePath = asDeviceUniquePath;
6
+ const asBluetoothDeviceId = (id) => id;
7
+ exports.asBluetoothDeviceId = asBluetoothDeviceId;
6
8
  //# sourceMappingURL=device.js.map
@@ -21,4 +21,5 @@ export type FirmwareReleaseConfigInfo = {
21
21
  translations?: Record<string, string>;
22
22
  };
23
23
  export type FirmwareUpdateFlowType = 'reboot_and_wait' | 'reboot_and_upgrade' | 'manual' | 'unknown_flow';
24
+ export type FirmwareUpdateSource = 'production' | 'test-unsigned' | 'test-unsigned-stable' | 'test-signed' | 'localhost-unsigned' | 'localhost-signed';
24
25
  //# sourceMappingURL=firmware.d.ts.map
@@ -3,7 +3,7 @@ import type { DeviceModelInternal } from '@trezor/device-utils';
3
3
  import type { ThpCredentials, ThpPairingMethod } from '@trezor/protocol';
4
4
  import type { Transport } from '@trezor/transport';
5
5
  import { PartialRecord } from '@trezor/type-utils';
6
- import { FirmwareUpdateSource } from '../data/firmwareInfo';
6
+ import type { FirmwareUpdateSource } from '../types/firmware';
7
7
  export type { SystemInfo } from '@trezor/connect-common';
8
8
  export interface Manifest {
9
9
  appName: string;
@@ -17,7 +17,7 @@ export type LocalFirmwares = {
17
17
  firmwareDir: string;
18
18
  firmwareList: string[];
19
19
  };
20
- type KnownTransport = Exclude<Transport['name'], 'NativeUsbTransport' | 'BluetoothTransport'>;
20
+ type KnownTransport = Exclude<Transport['name'], 'NativeUsbTransport' | 'BluetoothTransport' | 'NativeBluetoothTransport'>;
21
21
  export type ThpSettings = {
22
22
  hostName?: string;
23
23
  appName?: string;
@@ -5,4 +5,8 @@ export type WorkflowContext = {
5
5
  method: AbstractMethod<any>;
6
6
  signal: AbortSignal;
7
7
  };
8
+ export type TpnWorkflowContext = {
9
+ device: Device;
10
+ message: number[];
11
+ };
8
12
  //# sourceMappingURL=workflow.d.ts.map
@@ -1,8 +1,10 @@
1
1
  import { DeviceModelInternal, FirmwareRelease, FirmwareType, VersionArray } from '@trezor/device-utils';
2
- export declare const getReleasesAssetByDeviceModelAndFirmwareType: (deviceModel: DeviceModelInternal, firmwareType: FirmwareType) => {
3
- [file: string]: FirmwareRelease;
4
- };
2
+ export declare class HttpRequestError extends Error {
3
+ response: Response;
4
+ constructor(response: Response);
5
+ }
6
+ export declare const getReleasesAssetByDeviceModelAndFirmwareType: (deviceModel: DeviceModelInternal, firmwareType: FirmwareType) => FirmwareRelease[];
5
7
  export declare const getReleaseAsset: (deviceModel: DeviceModelInternal, version: VersionArray, firmwareType: FirmwareType) => FirmwareRelease;
6
8
  export declare const firmwareReleaseConfigAssets: any;
7
- export declare const tryLocalAssetRequire: (url: string) => any;
9
+ export declare const tryLocalAssetRequire: (url: string) => unknown;
8
10
  //# sourceMappingURL=assetUtils.d.ts.map
@@ -1,11 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tryLocalAssetRequire = exports.firmwareReleaseConfigAssets = exports.getReleaseAsset = exports.getReleasesAssetByDeviceModelAndFirmwareType = void 0;
3
+ exports.tryLocalAssetRequire = exports.firmwareReleaseConfigAssets = exports.getReleaseAsset = exports.getReleasesAssetByDeviceModelAndFirmwareType = exports.HttpRequestError = void 0;
4
4
  const connect_common_1 = require("@trezor/connect-common");
5
5
  const device_utils_1 = require("@trezor/device-utils");
6
+ const utils_1 = require("@trezor/utils");
7
+ class HttpRequestError extends Error {
8
+ response;
9
+ constructor(response) {
10
+ const message = `${response.status} while fetching ${response.url}`;
11
+ super(message);
12
+ this.response = response;
13
+ }
14
+ }
15
+ exports.HttpRequestError = HttpRequestError;
6
16
  const getReleasesAssetByDeviceModelAndFirmwareType = (deviceModel, firmwareType) => {
7
17
  const firmwareTypeInFileName = firmwareType === device_utils_1.FirmwareType.BitcoinOnly ? 'bitcoinonly' : 'universal';
8
- return connect_common_1.firmwareAssets[deviceModel.toLowerCase()][firmwareTypeInFileName];
18
+ const availableReleasesRecord = connect_common_1.firmwareAssets?.[deviceModel.toLowerCase()]?.[firmwareTypeInFileName] ?? {};
19
+ return Object.values(availableReleasesRecord).sort((a, b) => utils_1.versionUtils.isNewer(b.version, a.version) ? 1 : -1);
9
20
  };
10
21
  exports.getReleasesAssetByDeviceModelAndFirmwareType = getReleasesAssetByDeviceModelAndFirmwareType;
11
22
  const getReleaseAsset = (deviceModel, version, firmwareType) => {
@@ -1,7 +1,3 @@
1
1
  import { HttpRequestOptions, HttpRequestReturnType, HttpRequestType } from './assetsTypes';
2
- export declare class HttpRequestError extends Error {
3
- response: Response;
4
- constructor(response: Response);
5
- }
6
2
  export declare const httpRequest: <T extends HttpRequestType>(url: string, type?: T, options?: HttpRequestOptions) => Promise<HttpRequestReturnType<T>>;
7
3
  //# sourceMappingURL=assets-browser.d.ts.map
@@ -1,17 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.httpRequest = exports.HttpRequestError = void 0;
3
+ exports.httpRequest = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const cross_fetch_1 = tslib_1.__importDefault(require("cross-fetch"));
6
- class HttpRequestError extends Error {
7
- response;
8
- constructor(response) {
9
- const message = `${response.status} while fetching ${response.url}`;
10
- super(message);
11
- this.response = response;
12
- }
13
- }
14
- exports.HttpRequestError = HttpRequestError;
6
+ const assetUtils_1 = require("./assetUtils");
15
7
  const httpRequest = async (url, type = 'text', options) => {
16
8
  const init = { ...options, credentials: 'same-origin' };
17
9
  const response = await (0, cross_fetch_1.default)(url, init);
@@ -25,7 +17,7 @@ const httpRequest = async (url, type = 'text', options) => {
25
17
  }
26
18
  return response.text();
27
19
  }
28
- throw new HttpRequestError(response);
20
+ throw new assetUtils_1.HttpRequestError(response);
29
21
  };
30
22
  exports.httpRequest = httpRequest;
31
23
  //# sourceMappingURL=assets-browser.js.map
@@ -10,7 +10,7 @@ function httpRequest(url, type, options) {
10
10
  })
11
11
  .then(response => {
12
12
  if (!response.ok) {
13
- throw new Error(`HTTP request failed with status ${response.status} ${response.statusText}`);
13
+ throw new assetUtils_1.HttpRequestError(response);
14
14
  }
15
15
  if (type === 'binary') {
16
16
  return response.arrayBuffer();
@@ -1,5 +1,5 @@
1
1
  import { DeviceModelInternal } from '@trezor/device-utils';
2
- import { PROTO } from '../constants';
2
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
3
3
  import { CoinInfo, Features, UnavailableCapabilities } from '../types';
4
4
  export declare const parseCapabilities: (features?: Features) => PROTO.Capability[];
5
5
  export declare const getUnavailableCapabilities: (features: Features, coins: CoinInfo[]) => UnavailableCapabilities;
@@ -1,12 +1,15 @@
1
- import type { DeviceModelInternal, FirmwareRelease } from '@trezor/device-utils';
2
- import { CurrentVersion } from '../data/firmwareInfo';
3
- import { Features, FirmwareType, StrictFeatures, VersionArray } from '../types';
1
+ import { FirmwareType } from '@trezor/device-utils';
2
+ import type { DeviceModelInternal, FirmwareRelease, VersionArray } from '@trezor/device-utils';
3
+ import type { CurrentVersion } from '../data/firmwareInfo';
4
+ import type { Features, StrictFeatures } from '../types/device';
4
5
  export declare const isStrictFeatures: (extFeatures: Features) => extFeatures is StrictFeatures;
5
6
  type VersionCheckProperty = 'min_firmware_version' | 'min_bootloader_version';
6
- export declare const findBestCompatibleRelease: (releasesOfDevice: Record<string, FirmwareRelease>, currentVesion: CurrentVersion, checkProperty: VersionCheckProperty) => FirmwareRelease | undefined;
7
+ export declare const findBestCompatibleRelease: (availableFirmwares: FirmwareRelease[], currentVesion: CurrentVersion, checkProperty: VersionCheckProperty) => FirmwareRelease | undefined;
8
+ export declare const buildLocalReleaseName: (firmwareType: FirmwareType, deviceModel: DeviceModelInternal, version: VersionArray) => string;
7
9
  export declare const buildLocalFirmwareFileName: (firmwareType: FirmwareType, deviceModel: DeviceModelInternal, version: VersionArray) => string;
8
10
  export declare const buildIntermediaryFirmwareFileName: (internalModel: DeviceModelInternal, version: number) => string;
9
11
  export declare const getFirmwareMode: (features: Features) => "normal" | "bootloader" | "initialize" | "seedless";
10
12
  export declare const getFirmwareType: (features: Features) => FirmwareType;
13
+ export declare const isFirmwareCacheUsedForSelectedSource: () => boolean;
11
14
  export {};
12
15
  //# sourceMappingURL=firmwareUtils.d.ts.map
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFirmwareType = exports.getFirmwareMode = exports.buildIntermediaryFirmwareFileName = exports.buildLocalFirmwareFileName = exports.findBestCompatibleRelease = exports.isStrictFeatures = void 0;
3
+ exports.isFirmwareCacheUsedForSelectedSource = exports.getFirmwareType = exports.getFirmwareMode = exports.buildIntermediaryFirmwareFileName = exports.buildLocalFirmwareFileName = exports.buildLocalReleaseName = exports.findBestCompatibleRelease = exports.isStrictFeatures = void 0;
4
+ const device_utils_1 = require("@trezor/device-utils");
4
5
  const utils_1 = require("@trezor/utils");
5
- const types_1 = require("../types");
6
+ const DataManager_1 = require("../data/DataManager");
6
7
  const isStrictFeatures = (extFeatures) => [1, 2].includes(extFeatures.major_version) &&
7
8
  (extFeatures.firmware_present === false ||
8
9
  extFeatures.bootloader_mode == null ||
9
10
  extFeatures.bootloader_mode === true);
10
11
  exports.isStrictFeatures = isStrictFeatures;
11
- const findBestCompatibleRelease = (releasesOfDevice, currentVesion, checkProperty) => {
12
- if (!releasesOfDevice || Object.keys(releasesOfDevice).length === 0) {
12
+ const findBestCompatibleRelease = (availableFirmwares, currentVesion, checkProperty) => {
13
+ if (!availableFirmwares || availableFirmwares.length === 0) {
13
14
  return;
14
15
  }
15
- const availableFirmwares = Object.values(releasesOfDevice);
16
16
  const currentFirmwareVersion = currentVesion.firmwareVersion;
17
17
  const currentBootloaderVersion = currentVesion.bootloaderVersion;
18
18
  let versionToCompare = currentFirmwareVersion;
@@ -33,10 +33,15 @@ const findBestCompatibleRelease = (releasesOfDevice, currentVesion, checkPropert
33
33
  return compatibleFirmware;
34
34
  };
35
35
  exports.findBestCompatibleRelease = findBestCompatibleRelease;
36
- const buildLocalFirmwareFileName = (firmwareType, deviceModel, version) => {
37
- const firmwareTypeFileString = firmwareType === types_1.FirmwareType.BitcoinOnly ? '-bitcoinonly' : '';
38
- return `trezor-${deviceModel.toLowerCase()}-${version.join('.')}${firmwareTypeFileString}.bin`;
36
+ const buildLocalFileBaseName = (firmwareType, deviceModel, version) => {
37
+ const firmwareSuffix = firmwareType === device_utils_1.FirmwareType.BitcoinOnly ? '-bitcoinonly' : '';
38
+ const model = deviceModel.toLowerCase();
39
+ const versionString = version.join('.');
40
+ return `trezor-${model}-${versionString}${firmwareSuffix}`;
39
41
  };
42
+ const buildLocalReleaseName = (firmwareType, deviceModel, version) => `${buildLocalFileBaseName(firmwareType, deviceModel, version)}.json`;
43
+ exports.buildLocalReleaseName = buildLocalReleaseName;
44
+ const buildLocalFirmwareFileName = (firmwareType, deviceModel, version) => `${buildLocalFileBaseName(firmwareType, deviceModel, version)}.bin`;
40
45
  exports.buildLocalFirmwareFileName = buildLocalFirmwareFileName;
41
46
  const buildIntermediaryFirmwareFileName = (internalModel, version) => `trezor-${internalModel.toLowerCase()}-inter-v${version}.bin`;
42
47
  exports.buildIntermediaryFirmwareFileName = buildIntermediaryFirmwareFileName;
@@ -51,25 +56,27 @@ const getFirmwareMode = (features) => {
51
56
  };
52
57
  exports.getFirmwareMode = getFirmwareMode;
53
58
  const getFirmwareType = (features) => {
54
- let type = types_1.FirmwareType.Universal;
59
+ let type = device_utils_1.FirmwareType.Universal;
55
60
  if (features.fw_vendor === 'Trezor Bitcoin-only') {
56
- type = types_1.FirmwareType.BitcoinOnly;
61
+ type = device_utils_1.FirmwareType.BitcoinOnly;
57
62
  }
58
63
  else if (features.fw_vendor === 'Trezor') {
59
- type = types_1.FirmwareType.Universal;
64
+ type = device_utils_1.FirmwareType.Universal;
60
65
  }
61
66
  else if ((0, exports.getFirmwareMode)(features) !== 'bootloader') {
62
67
  type =
63
68
  features.capabilities &&
64
69
  features.capabilities.length > 0 &&
65
70
  !features.capabilities.includes('Capability_Bitcoin_like')
66
- ? types_1.FirmwareType.BitcoinOnly
67
- : types_1.FirmwareType.Universal;
71
+ ? device_utils_1.FirmwareType.BitcoinOnly
72
+ : device_utils_1.FirmwareType.Universal;
68
73
  }
69
74
  else if ((0, exports.getFirmwareMode)(features) === 'bootloader' && features.unit_btconly) {
70
- type = types_1.FirmwareType.BitcoinOnly;
75
+ type = device_utils_1.FirmwareType.BitcoinOnly;
71
76
  }
72
77
  return type;
73
78
  };
74
79
  exports.getFirmwareType = getFirmwareType;
80
+ const isFirmwareCacheUsedForSelectedSource = () => DataManager_1.DataManager.getSettings('firmwareUpdateSource') === 'production';
81
+ exports.isFirmwareCacheUsedForSelectedSource = isFirmwareCacheUsedForSelectedSource;
75
82
  //# sourceMappingURL=firmwareUtils.js.map
@@ -1,5 +1,6 @@
1
1
  import { PROTO } from '../constants';
2
- import type { CoinInfo, DerivationPath, ProtoWithAddressN, ProtoWithDerivationPath } from '../types';
2
+ import type { CoinInfo } from '../types/coinInfo';
3
+ import type { DerivationPath, ProtoWithAddressN, ProtoWithDerivationPath } from '../types/params';
3
4
  export declare const HD_HARDENED = 2147483648;
4
5
  export declare const toHardened: (n: number) => number;
5
6
  export declare const fromHardened: (n: number) => number;
@@ -8,7 +9,7 @@ export declare const getHDPath: (path: string) => number[];
8
9
  export declare const isSegwitPath: (path: number[] | undefined) => boolean;
9
10
  export declare const isBech32Path: (path: number[] | undefined) => boolean;
10
11
  export declare const isTaprootPath: (path: number[] | undefined) => boolean;
11
- export declare const getAccountType: (path: number[] | undefined) => "p2pkh" | "p2sh" | "p2tr" | "p2wpkh";
12
+ export declare const getAccountType: (path: number[] | undefined) => "p2tr" | "p2wpkh" | "p2sh" | "p2pkh";
12
13
  export declare const getScriptType: (path: number[] | undefined) => PROTO.InternalInputScriptType | undefined;
13
14
  export declare const getOutputScriptType: (path?: number[]) => PROTO.ChangeOutputScriptType | undefined;
14
15
  export declare const validatePath: (path: DerivationPath, length?: number, base?: boolean) => number[];
@@ -6,23 +6,23 @@ export declare const createUiPromiseManager: (interactionTimeout: () => void) =>
6
6
  resolve: (event: UiPromiseResponse) => boolean;
7
7
  rejectAll: (error: Error) => void;
8
8
  disconnected: (devicePath: DeviceUniquePath) => boolean;
9
- get: <T extends UiPromiseResponse["type"]>(type: T) => Promise<Extract<import("../events").UiResponsePopupHandshake, {
9
+ get: <T extends UiPromiseResponse["type"]>(type: T) => Promise<Extract<import("../events").UiResponsePin, {
10
10
  type: T;
11
- }> | Extract<import("../events").UiResponsePermission, {
11
+ }> | Extract<import("../events").UiResponsePassphrase, {
12
12
  type: T;
13
- }> | Extract<import("../events").UiResponseConfirmation, {
13
+ }> | Extract<import("../events").UiResponseWord, {
14
14
  type: T;
15
- }> | Extract<import("../events").UiResponseFirmwares, {
15
+ }> | Extract<import("../events").UiResponseThpPairingTag, {
16
16
  type: T;
17
- }> | Extract<import("../events").UiResponseDevice, {
17
+ }> | Extract<import("../events").UiResponsePopupHandshake, {
18
18
  type: T;
19
- }> | Extract<import("../events").UiResponsePin, {
19
+ }> | Extract<import("../events").UiResponsePermission, {
20
20
  type: T;
21
- }> | Extract<import("../events").UiResponseWord, {
21
+ }> | Extract<import("../events").UiResponseConfirmation, {
22
22
  type: T;
23
- }> | Extract<import("../events").UiResponsePassphrase, {
23
+ }> | Extract<import("../events").UiResponseFirmwares, {
24
24
  type: T;
25
- }> | Extract<import("../events").UiResponseThpPairingTag, {
25
+ }> | Extract<import("../events").UiResponseDevice, {
26
26
  type: T;
27
27
  }> | Extract<import("../events").UiResponsePassphraseAction, {
28
28
  type: T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trezor/connect",
3
- "version": "9.6.3-beta.2",
3
+ "version": "9.6.4-beta.1",
4
4
  "author": "Trezor <info@trezor.io>",
5
5
  "homepage": "https://github.com/trezor/trezor-suite/tree/develop/packages/connect",
6
6
  "description": "High-level javascript interface for Trezor hardware wallet.",
@@ -79,21 +79,21 @@
79
79
  "@solana-program/token": "^0.5.1",
80
80
  "@solana-program/token-2022": "^0.4.2",
81
81
  "@solana/kit": "^2.3.0",
82
- "@trezor/blockchain-link": "2.5.3-beta.1",
83
- "@trezor/blockchain-link-types": "1.4.3-beta.1",
84
- "@trezor/blockchain-link-utils": "1.4.3-beta.1",
85
- "@trezor/connect-analytics": "1.3.5",
86
- "@trezor/connect-common": "0.4.3-beta.2",
87
- "@trezor/crypto-utils": "1.1.4",
88
- "@trezor/device-utils": "1.1.3-beta.2",
89
- "@trezor/env-utils": "^1.4.3-beta.1",
90
- "@trezor/protobuf": "1.4.3-beta.1",
91
- "@trezor/protocol": "1.2.9-beta.1",
82
+ "@trezor/blockchain-link": "2.5.4-beta.1",
83
+ "@trezor/blockchain-link-types": "1.4.4-beta.1",
84
+ "@trezor/blockchain-link-utils": "1.4.4-beta.1",
85
+ "@trezor/connect-analytics": "1.3.6",
86
+ "@trezor/connect-common": "0.4.4-beta.1",
87
+ "@trezor/crypto-utils": "1.1.5-beta.1",
88
+ "@trezor/device-utils": "1.1.4-beta.1",
89
+ "@trezor/env-utils": "^1.4.3",
90
+ "@trezor/protobuf": "1.4.4-beta.1",
91
+ "@trezor/protocol": "1.2.10-beta.1",
92
92
  "@trezor/schema-utils": "1.3.4",
93
- "@trezor/transport": "1.5.3-beta.2",
94
- "@trezor/type-utils": "1.1.9-beta.1",
95
- "@trezor/utils": "9.4.3-beta.1",
96
- "@trezor/utxo-lib": "2.4.3-beta.1",
93
+ "@trezor/transport": "1.5.4-beta.1",
94
+ "@trezor/type-utils": "1.1.9",
95
+ "@trezor/utils": "9.4.4-beta.1",
96
+ "@trezor/utxo-lib": "2.4.4-beta.1",
97
97
  "blakejs": "^1.2.1",
98
98
  "bs58": "^6.0.0",
99
99
  "bs58check": "^4.0.0",
@@ -107,6 +107,7 @@
107
107
  "@trezor/trezor-user-env-link": "1.0.2",
108
108
  "@types/jws": "^3.2.10",
109
109
  "@types/karma": "^6.3.9",
110
+ "@types/node-fetch": "^2.6.12",
110
111
  "babel-loader": "^10.0.0",
111
112
  "jest": "29.7.0",
112
113
  "karma": "^6.4.4",