@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.
- package/CHANGELOG.md +16 -9
- package/README.md +1 -1
- package/lib/api/applyFlags.d.ts +1 -1
- package/lib/api/applyFlags.js +2 -2
- package/lib/api/applySettings.d.ts +1 -1
- package/lib/api/authenticateDevice.js +4 -0
- package/lib/api/authorizeCoinjoin.d.ts +1 -1
- package/lib/api/backupDevice.d.ts +1 -1
- package/lib/api/backupDevice.js +2 -2
- package/lib/api/bitcoin/TransactionComposer.d.ts +1 -1
- package/lib/api/bitcoin/inputs.d.ts +1 -1
- package/lib/api/bitcoin/transactionBytes.d.ts +2 -2
- package/lib/api/bleUnpair.js +1 -1
- package/lib/api/cancelCoinjoinAuthorization.d.ts +1 -1
- package/lib/api/cardano/api/cardanoSignTransaction.d.ts +2 -2
- package/lib/api/cardano/cardanoInputs.js +2 -2
- package/lib/api/changePin.d.ts +1 -1
- package/lib/api/changePin.js +2 -2
- package/lib/api/changeWipeCode.d.ts +1 -1
- package/lib/api/cipherKeyValue.d.ts +1 -1
- package/lib/api/eos/api/eosGetPublicKey.d.ts +1 -1
- package/lib/api/eos/api/eosSignTransaction.d.ts +1 -1
- package/lib/api/eos/eosSignTx.d.ts +20 -20
- package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +5 -5
- package/lib/api/ethereum/api/ethereumSignMessage.d.ts +1 -2
- package/lib/api/ethereum/api/ethereumVerifyMessage.d.ts +1 -1
- package/lib/api/evoluGetNode.d.ts +1 -1
- package/lib/api/evoluGetNode.js +2 -2
- package/lib/api/firmware/calculateFirmwareHash.d.ts +9 -2
- package/lib/api/firmware/calculateFirmwareHash.js +11 -1
- package/lib/api/firmware/verifyAuthenticityProof.d.ts +3 -1
- package/lib/api/firmware/verifyAuthenticityProof.js +10 -15
- package/lib/api/getCoinInfo.d.ts +34 -34
- package/lib/api/getFeatures.d.ts +1 -0
- package/lib/api/getFirmwareHash.d.ts +1 -1
- package/lib/api/getFirmwareHash.js +2 -2
- package/lib/api/getNonce.d.ts +1 -1
- package/lib/api/getOwnershipId.d.ts +1 -1
- package/lib/api/getOwnershipId.js +2 -2
- package/lib/api/getOwnershipProof.d.ts +1 -1
- package/lib/api/getOwnershipProof.js +2 -2
- package/lib/api/getPublicKey.d.ts +5 -5
- package/lib/api/loadDevice.d.ts +1 -1
- package/lib/api/loadDevice.js +2 -2
- package/lib/api/nem/api/nemSignTransaction.d.ts +1 -1
- package/lib/api/nem/nemSignTx.d.ts +9 -9
- package/lib/api/recoveryDevice.d.ts +1 -1
- package/lib/api/requestLogin.d.ts +1 -1
- package/lib/api/ripple/api/rippleSignTransaction.d.ts +1 -1
- package/lib/api/setBrightness.d.ts +1 -1
- package/lib/api/setBrightness.js +2 -2
- package/lib/api/setBusy.d.ts +1 -1
- package/lib/api/setBusy.js +2 -2
- package/lib/api/showDeviceTutorial.d.ts +1 -1
- package/lib/api/signMessage.d.ts +1 -1
- package/lib/api/solana/api/solanaComposeTransaction.d.ts +6 -0
- package/lib/api/solana/api/solanaComposeTransaction.js +9 -0
- package/lib/api/solana/api/solanaSignTransaction.js +4 -4
- package/lib/api/tezos/api/tezosGetPublicKey.d.ts +1 -1
- package/lib/api/tezos/api/tezosSignTransaction.d.ts +1 -1
- package/lib/api/tezos/tezosSignTx.d.ts +17 -17
- package/lib/api/unlockPath.d.ts +1 -1
- package/lib/core/AbstractMethod.d.ts +4 -1
- package/lib/core/index.js +8 -1
- package/lib/core/onCallFirmwareUpdate.js +42 -51
- package/lib/data/coinInfo.d.ts +94 -93
- package/lib/data/config.js +9 -1
- package/lib/data/defaultFeeLevels.d.ts +1 -1
- package/lib/data/defaultFeeLevels.js +1 -1
- package/lib/data/deviceAuthenticityBlacklist.d.ts +3 -0
- package/lib/data/deviceAuthenticityBlacklist.js +11 -0
- package/lib/data/deviceAuthenticityBlacklistConfig.d.ts +11 -0
- package/lib/data/deviceAuthenticityBlacklistConfig.js +15 -0
- package/lib/data/deviceAuthenticityConfig.js +4 -140
- package/lib/data/deviceAuthenticityConfigTypes.d.ts +0 -9
- package/lib/data/deviceAuthenticityConfigTypes.js +3 -5
- package/lib/data/firmwareInfo.d.ts +12 -7
- package/lib/data/firmwareInfo.js +58 -15
- package/lib/data/transportInfo.d.ts +11 -1
- package/lib/data/udevInfo.d.ts +9 -1
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +20 -10
- package/lib/device/Device.js +95 -23
- package/lib/device/DeviceCommands.d.ts +4 -4
- package/lib/device/DeviceCurrentSession.d.ts +242 -242
- package/lib/device/DeviceCurrentSession.js +1 -1
- package/lib/device/DeviceList.d.ts +7 -4
- package/lib/device/DeviceList.js +14 -4
- package/lib/device/StateStorage.d.ts +1 -1
- package/lib/device/checkFirmwareRevision.d.ts +1 -1
- package/lib/device/checkFirmwareRevision.js +2 -2
- package/lib/device/thp/handshake.d.ts +1 -1
- package/lib/device/thp/handshake.js +14 -3
- package/lib/device/thp/index.d.ts +1 -1
- package/lib/device/thp/index.js +29 -4
- package/lib/device/thp/pairing.js +1 -3
- package/lib/device/thp/session.js +1 -1
- package/lib/device/workflow/checkFirmwareHash.js +6 -1
- package/lib/device/workflow/handshake.js +3 -7
- package/lib/device/workflow/trezorPushNotification.d.ts +3 -0
- package/lib/device/workflow/trezorPushNotification.js +76 -0
- package/lib/device/workflow/validateState.js +3 -0
- package/lib/events/call.d.ts +1 -1
- package/lib/events/device.d.ts +11 -3
- package/lib/events/device.js +5 -1
- package/lib/events/popup.d.ts +1 -1
- package/lib/events/transport.d.ts +3 -21
- package/lib/events/ui-request.d.ts +15 -8
- package/lib/tsconfig.lib.tsbuildinfo +1 -1
- package/lib/types/api/applyFlags.d.ts +1 -1
- package/lib/types/api/applySettings.d.ts +1 -0
- package/lib/types/api/authenticateDevice.d.ts +9 -10
- package/lib/types/api/authenticateDevice.js +2 -0
- package/lib/types/api/backupDevice.d.ts +1 -1
- package/lib/types/api/bitcoin/index.d.ts +1 -1
- package/lib/types/api/bleUnpair.d.ts +1 -1
- package/lib/types/api/cancelCoinjoinAuthorization.d.ts +1 -1
- package/lib/types/api/cardanoComposeTransaction.d.ts +2 -2
- package/lib/types/api/cardanoComposeTransaction.js +2 -2
- package/lib/types/api/changePin.d.ts +1 -1
- package/lib/types/api/changeWipeCode.d.ts +1 -1
- package/lib/types/api/composeTransaction.d.ts +1 -1
- package/lib/types/api/discoverAccounts.d.ts +1 -1
- package/lib/types/api/discoverAccounts.js +1 -1
- package/lib/types/api/eosSignTransaction.d.ts +1 -1
- package/lib/types/api/ethereum/index.d.ts +8 -8
- package/lib/types/api/ethereumSignMessage.d.ts +1 -1
- package/lib/types/api/ethereumSignTypedData.d.ts +1 -1
- package/lib/types/api/ethereumVerifyMessage.d.ts +1 -1
- package/lib/types/api/getAccountInfo.d.ts +1 -1
- package/lib/types/api/getAddress.d.ts +6 -6
- package/lib/types/api/getFirmwareHash.d.ts +1 -1
- package/lib/types/api/nemGetAddress.d.ts +1 -1
- package/lib/types/api/nemSignTransaction.d.ts +1 -1
- package/lib/types/api/recoveryDevice.d.ts +2 -2
- package/lib/types/api/setBusy.d.ts +1 -1
- package/lib/types/api/setProxy.d.ts +1 -1
- package/lib/types/api/showDeviceTutorial.d.ts +1 -1
- package/lib/types/api/signMessage.d.ts +1 -1
- package/lib/types/api/solana/index.d.ts +26 -3
- package/lib/types/api/solana/index.js +19 -3
- package/lib/types/api/tezosSignTransaction.d.ts +1 -1
- package/lib/types/api/thpRemoveCredentials.d.ts +1 -1
- package/lib/types/api/unlockPath.d.ts +1 -1
- package/lib/types/api/verifyMessage.d.ts +1 -1
- package/lib/types/api/wipeDevice.d.ts +1 -1
- package/lib/types/device.d.ts +9 -4
- package/lib/types/device.js +5 -3
- package/lib/types/firmware.d.ts +1 -0
- package/lib/types/settings.d.ts +2 -2
- package/lib/types/workflow.d.ts +4 -0
- package/lib/utils/assetUtils.d.ts +6 -4
- package/lib/utils/assetUtils.js +13 -2
- package/lib/utils/assets-browser.d.ts +0 -4
- package/lib/utils/assets-browser.js +3 -11
- package/lib/utils/assets.native.js +1 -1
- package/lib/utils/deviceFeaturesUtils.d.ts +1 -1
- package/lib/utils/firmwareUtils.d.ts +7 -4
- package/lib/utils/firmwareUtils.js +21 -14
- package/lib/utils/pathUtils.d.ts +3 -2
- package/lib/utils/uiPromiseManager.d.ts +9 -9
- 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
|
|
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
|
|
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
|
package/lib/types/device.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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:
|
|
50
|
+
id: BluetoothDeviceId;
|
|
46
51
|
};
|
|
47
52
|
export type KnownDevice = BaseDevice & {
|
|
48
53
|
type: 'acquired';
|
package/lib/types/device.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
5
|
-
exports.
|
|
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
|
package/lib/types/firmware.d.ts
CHANGED
|
@@ -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
|
package/lib/types/settings.d.ts
CHANGED
|
@@ -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 '../
|
|
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;
|
package/lib/types/workflow.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { DeviceModelInternal, FirmwareRelease, FirmwareType, VersionArray } from '@trezor/device-utils';
|
|
2
|
-
export declare
|
|
3
|
-
|
|
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) =>
|
|
9
|
+
export declare const tryLocalAssetRequire: (url: string) => unknown;
|
|
8
10
|
//# sourceMappingURL=assetUtils.d.ts.map
|
package/lib/utils/assetUtils.js
CHANGED
|
@@ -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
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
|
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 '
|
|
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
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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: (
|
|
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
|
|
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 = (
|
|
12
|
-
if (!
|
|
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
|
|
37
|
-
const
|
|
38
|
-
|
|
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 =
|
|
59
|
+
let type = device_utils_1.FirmwareType.Universal;
|
|
55
60
|
if (features.fw_vendor === 'Trezor Bitcoin-only') {
|
|
56
|
-
type =
|
|
61
|
+
type = device_utils_1.FirmwareType.BitcoinOnly;
|
|
57
62
|
}
|
|
58
63
|
else if (features.fw_vendor === 'Trezor') {
|
|
59
|
-
type =
|
|
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
|
-
?
|
|
67
|
-
:
|
|
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 =
|
|
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
|
package/lib/utils/pathUtils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PROTO } from '../constants';
|
|
2
|
-
import type { CoinInfo
|
|
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) => "
|
|
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").
|
|
9
|
+
get: <T extends UiPromiseResponse["type"]>(type: T) => Promise<Extract<import("../events").UiResponsePin, {
|
|
10
10
|
type: T;
|
|
11
|
-
}> | Extract<import("../events").
|
|
11
|
+
}> | Extract<import("../events").UiResponsePassphrase, {
|
|
12
12
|
type: T;
|
|
13
|
-
}> | Extract<import("../events").
|
|
13
|
+
}> | Extract<import("../events").UiResponseWord, {
|
|
14
14
|
type: T;
|
|
15
|
-
}> | Extract<import("../events").
|
|
15
|
+
}> | Extract<import("../events").UiResponseThpPairingTag, {
|
|
16
16
|
type: T;
|
|
17
|
-
}> | Extract<import("../events").
|
|
17
|
+
}> | Extract<import("../events").UiResponsePopupHandshake, {
|
|
18
18
|
type: T;
|
|
19
|
-
}> | Extract<import("../events").
|
|
19
|
+
}> | Extract<import("../events").UiResponsePermission, {
|
|
20
20
|
type: T;
|
|
21
|
-
}> | Extract<import("../events").
|
|
21
|
+
}> | Extract<import("../events").UiResponseConfirmation, {
|
|
22
22
|
type: T;
|
|
23
|
-
}> | Extract<import("../events").
|
|
23
|
+
}> | Extract<import("../events").UiResponseFirmwares, {
|
|
24
24
|
type: T;
|
|
25
|
-
}> | Extract<import("../events").
|
|
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
|
+
"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.
|
|
83
|
-
"@trezor/blockchain-link-types": "1.4.
|
|
84
|
-
"@trezor/blockchain-link-utils": "1.4.
|
|
85
|
-
"@trezor/connect-analytics": "1.3.
|
|
86
|
-
"@trezor/connect-common": "0.4.
|
|
87
|
-
"@trezor/crypto-utils": "1.1.
|
|
88
|
-
"@trezor/device-utils": "1.1.
|
|
89
|
-
"@trezor/env-utils": "^1.4.3
|
|
90
|
-
"@trezor/protobuf": "1.4.
|
|
91
|
-
"@trezor/protocol": "1.2.
|
|
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.
|
|
94
|
-
"@trezor/type-utils": "1.1.9
|
|
95
|
-
"@trezor/utils": "9.4.
|
|
96
|
-
"@trezor/utxo-lib": "2.4.
|
|
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",
|