@trezor/connect 9.6.3-beta.1 → 9.6.3-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.
- package/CHANGELOG.md +10 -5
- package/README.md +1 -1
- package/lib/api/tezos/tezosSignTx.d.ts +1 -1
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.js +1 -1
- package/lib/device/thp/thpCall.d.ts +1 -1
- package/lib/device/thp/thpCall.js +1 -4
- package/lib/impl/core-in-module.js +3 -0
- package/lib/types/device.d.ts +1 -1
- package/lib/utils/assetUtils.js +3 -3
- package/lib/utils/firmwareReleaseConfigUtils.js +37 -56
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
| Package | Stable | Canary |
|
|
2
2
|
| :------------------------------: | :----: | :----------: |
|
|
3
|
-
| npm @trezor/connect | 9.6.2 | 9.6.3-beta.
|
|
4
|
-
| npm @trezor/connect-web | 9.6.2 | 9.6.3-beta.
|
|
5
|
-
| npm @trezor/connect-webextension | 9.6.2 | 9.6.3-beta.
|
|
6
|
-
| npm @trezor/connect-mobile | 9.6.2 | 9.6.3-beta.
|
|
3
|
+
| npm @trezor/connect | 9.6.2 | 9.6.3-beta.2 |
|
|
4
|
+
| npm @trezor/connect-web | 9.6.2 | 9.6.3-beta.2 |
|
|
5
|
+
| npm @trezor/connect-webextension | 9.6.2 | 9.6.3-beta.2 |
|
|
6
|
+
| npm @trezor/connect-mobile | 9.6.2 | 9.6.3-beta.2 |
|
|
7
7
|
|
|
8
8
|
| Deployment | Stable | Canary |
|
|
9
9
|
| :----------------: | :----: | :----------: |
|
|
10
|
-
| connect.trezor.io/ | 9.6.2 | 9.6.3-beta.
|
|
10
|
+
| connect.trezor.io/ | 9.6.2 | 9.6.3-beta.2 |
|
|
11
11
|
|
|
12
12
|
Use the persistent link [connect.trezor.io/9](https://connect.trezor.io/9/) to access the latest stable version of Connect Explorer.
|
|
13
13
|
|
|
14
|
+
# 9.6.3-beta.2
|
|
15
|
+
|
|
16
|
+
- feat(connect): trezor bridge pinging now runs in a worker to prevent spamming developer console
|
|
17
|
+
- chore(connect): stellar code is now wrapped in a worker in the same way other coins are wrapped
|
|
18
|
+
|
|
14
19
|
# 9.6.3-beta.1
|
|
15
20
|
|
|
16
21
|
We’ve added support for Cardano message signing based on the CIP-8 standard, available through the new cardanoSignMessage method.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @trezor/connect
|
|
2
2
|
|
|
3
|
-
API version 9.6.3-beta.
|
|
3
|
+
API version 9.6.3-beta.2
|
|
4
4
|
|
|
5
5
|
[](https://github.com/trezor/trezor-suite/actions/workflows/test-connect.yml)
|
|
6
6
|
[](https://www.npmjs.org/package/@trezor/connect)
|
|
@@ -17,11 +17,11 @@ export declare const createTx: (address_n: number[], branch: string, operation:
|
|
|
17
17
|
} | undefined;
|
|
18
18
|
fee: string | number;
|
|
19
19
|
amount: string | number;
|
|
20
|
-
source: Uint8Array<ArrayBufferLike>;
|
|
21
20
|
destination: {
|
|
22
21
|
hash: Uint8Array<ArrayBufferLike>;
|
|
23
22
|
tag: number;
|
|
24
23
|
};
|
|
24
|
+
source: Uint8Array<ArrayBufferLike>;
|
|
25
25
|
counter: number;
|
|
26
26
|
gas_limit: number;
|
|
27
27
|
storage_limit: number;
|
package/lib/data/version.d.ts
CHANGED
package/lib/data/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEEPLINK_VERSION = exports.CONTENT_SCRIPT_VERSION = exports.DEFAULT_DOMAIN = exports.DEFAULT_DOMAIN_MAJOR_VER = exports.VERSION = void 0;
|
|
4
|
-
exports.VERSION = '9.6.3-beta.
|
|
4
|
+
exports.VERSION = '9.6.3-beta.2';
|
|
5
5
|
const versionN = exports.VERSION.split('.').map(s => parseInt(s, 10));
|
|
6
6
|
const isBeta = exports.VERSION.includes('beta');
|
|
7
7
|
exports.DEFAULT_DOMAIN_MAJOR_VER = `https://connect.trezor.io/${versionN[0]}/`;
|
package/lib/device/Device.js
CHANGED
|
@@ -259,7 +259,7 @@ class Device extends utils_1.TypedEmitter {
|
|
|
259
259
|
return this.runPromise;
|
|
260
260
|
}
|
|
261
261
|
async interrupt(reason) {
|
|
262
|
-
await (0, thp_1.abortThpWorkflow)(this
|
|
262
|
+
await (0, thp_1.abortThpWorkflow)(this);
|
|
263
263
|
await this.currentSession?.abort(reason);
|
|
264
264
|
this.runAbort?.abort(reason);
|
|
265
265
|
await this.currentRun;
|
|
@@ -36,6 +36,6 @@ type ThpCallResponse = {
|
|
|
36
36
|
};
|
|
37
37
|
type ThpMessagePayload<T extends MessageKey = MessageKey> = ThpMessage[T];
|
|
38
38
|
export declare const thpCall: <T extends MessageKey>(device: Device, name: T, data: ThpMessagePayload<T>) => Promise<ThpCallResponse[T]>;
|
|
39
|
-
export declare const abortThpWorkflow: (device: Device
|
|
39
|
+
export declare const abortThpWorkflow: (device: Device) => Promise<void>;
|
|
40
40
|
export {};
|
|
41
41
|
//# sourceMappingURL=thpCall.d.ts.map
|
|
@@ -34,7 +34,7 @@ const thpCall = async (device, name, data) => {
|
|
|
34
34
|
return result.payload;
|
|
35
35
|
};
|
|
36
36
|
exports.thpCall = thpCall;
|
|
37
|
-
const abortThpWorkflow = async (device
|
|
37
|
+
const abortThpWorkflow = async (device) => {
|
|
38
38
|
const thpState = device.getThpState();
|
|
39
39
|
if (!thpState || !device.currentRun) {
|
|
40
40
|
return Promise.resolve();
|
|
@@ -47,9 +47,6 @@ const abortThpWorkflow = async (device, abort) => {
|
|
|
47
47
|
else if (thpState.cancelablePromise) {
|
|
48
48
|
thpState.sync('send', 'Cancel');
|
|
49
49
|
await device.getCurrentSession().send('Cancel', {});
|
|
50
|
-
if (abort) {
|
|
51
|
-
abort();
|
|
52
|
-
}
|
|
53
50
|
await device.currentRun;
|
|
54
51
|
}
|
|
55
52
|
};
|
|
@@ -134,6 +134,9 @@ class CoreInModule {
|
|
|
134
134
|
this._log.enabled = !!this._settings.debug;
|
|
135
135
|
}
|
|
136
136
|
setTransports({ transports }) {
|
|
137
|
+
if (!transports?.length) {
|
|
138
|
+
transports = ['BridgeTransport', 'WebUsbTransport'];
|
|
139
|
+
}
|
|
137
140
|
this._settings = (0, connectSettings_1.parseConnectSettings)({ ...this._settings, transports });
|
|
138
141
|
this.handleCoreMessage({
|
|
139
142
|
type: events_2.TRANSPORT.SET_TRANSPORTS,
|
package/lib/types/device.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ export type UnreadableDevice = BaseDevice & {
|
|
|
109
109
|
availableTranslations?: typeof undefined;
|
|
110
110
|
transportSessionOwner?: undefined;
|
|
111
111
|
hid: boolean;
|
|
112
|
-
bluetoothProps?:
|
|
112
|
+
bluetoothProps?: typeof undefined;
|
|
113
113
|
};
|
|
114
114
|
export type Device = KnownDevice | UnknownDevice | UnreadableDevice;
|
|
115
115
|
export type Features = PROTO.Features;
|
package/lib/utils/assetUtils.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tryLocalAssetRequire = exports.firmwareReleaseConfigAssets = exports.getReleaseAsset = exports.getReleasesAssetByDeviceModelAndFirmwareType = void 0;
|
|
4
|
-
const
|
|
4
|
+
const connect_common_1 = require("@trezor/connect-common");
|
|
5
5
|
const device_utils_1 = require("@trezor/device-utils");
|
|
6
6
|
const getReleasesAssetByDeviceModelAndFirmwareType = (deviceModel, firmwareType) => {
|
|
7
7
|
const firmwareTypeInFileName = firmwareType === device_utils_1.FirmwareType.BitcoinOnly ? 'bitcoinonly' : 'universal';
|
|
8
|
-
return
|
|
8
|
+
return connect_common_1.firmwareAssets[deviceModel.toLowerCase()][firmwareTypeInFileName];
|
|
9
9
|
};
|
|
10
10
|
exports.getReleasesAssetByDeviceModelAndFirmwareType = getReleasesAssetByDeviceModelAndFirmwareType;
|
|
11
11
|
const getReleaseAsset = (deviceModel, version, firmwareType) => {
|
|
12
12
|
const firmwareTypeInFileName = firmwareType === device_utils_1.FirmwareType.BitcoinOnly ? 'bitcoinonly' : 'universal';
|
|
13
13
|
const fileName = `${deviceModel.toLowerCase()}-${version.join('.')}-${firmwareTypeInFileName}`;
|
|
14
14
|
const deviceModelLower = deviceModel.toLowerCase();
|
|
15
|
-
const asset =
|
|
15
|
+
const asset = connect_common_1.firmwareAssets?.[deviceModelLower]?.[firmwareTypeInFileName]?.[fileName];
|
|
16
16
|
return asset;
|
|
17
17
|
};
|
|
18
18
|
exports.getReleaseAsset = getReleaseAsset;
|
|
@@ -11,88 +11,69 @@ const JWS_CONFIG = {
|
|
|
11
11
|
REMOTE_FILENAME: 'releases.v1.json',
|
|
12
12
|
REQUEST_TIMEOUT_MS: 5000,
|
|
13
13
|
};
|
|
14
|
-
const
|
|
14
|
+
const fetchRemoteJws = async () => {
|
|
15
15
|
const { BASE_URL, MIDDLE_PATH, env } = (0, firmwareInfo_1.getOnlineFirmwareBaseUrl)();
|
|
16
|
-
const
|
|
17
|
-
remoteReleasesUrl
|
|
16
|
+
const path = `${MIDDLE_PATH}/${env === 'production' ? 'config/' : ''}${JWS_CONFIG.REMOTE_FILENAME}`;
|
|
17
|
+
const remoteReleasesUrl = new URL(path, BASE_URL);
|
|
18
18
|
try {
|
|
19
19
|
const controller = new AbortController();
|
|
20
|
-
const timeoutId = setTimeout(() => controller.abort(), JWS_CONFIG.REQUEST_TIMEOUT_MS);
|
|
20
|
+
const timeoutId = setTimeout(() => controller.abort('Request timed out'), JWS_CONFIG.REQUEST_TIMEOUT_MS);
|
|
21
21
|
const response = await fetch(remoteReleasesUrl.toString(), { signal: controller.signal });
|
|
22
22
|
clearTimeout(timeoutId);
|
|
23
23
|
if (!response.ok) {
|
|
24
|
-
throw new Error(`
|
|
24
|
+
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
25
25
|
}
|
|
26
26
|
const data = await response.json();
|
|
27
|
-
|
|
27
|
+
if (typeof data.jws !== 'string') {
|
|
28
|
+
throw new Error('Invalid response format: "jws" property missing or not a string.');
|
|
29
|
+
}
|
|
30
|
+
return { jws: data.jws, env };
|
|
28
31
|
}
|
|
29
32
|
catch (error) {
|
|
30
|
-
|
|
31
|
-
return { jws: assetUtils_1.firmwareReleaseConfigAssets.jws, source: 'local', env };
|
|
33
|
+
throw new Error(`Failed to fetch remote JWS: ${error instanceof Error ? error.message : String(error)}`);
|
|
32
34
|
}
|
|
33
35
|
};
|
|
34
|
-
const
|
|
36
|
+
const verifyAndDecodeJws = (jws, publicKey) => {
|
|
35
37
|
const decoded = (0, jws_1.decode)(jws);
|
|
36
|
-
if (!decoded || !decoded.payload) {
|
|
37
|
-
throw new Error('
|
|
38
|
+
if (!decoded || !decoded.payload || !decoded.header) {
|
|
39
|
+
throw new Error('Invalid JWS structure.');
|
|
38
40
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (
|
|
44
|
-
throw new Error(
|
|
41
|
+
const parsedPayload = JSON.parse(decoded.payload);
|
|
42
|
+
if (decoded.header.alg !== JWS_CONFIG.SIGN_ALGORITHM) {
|
|
43
|
+
throw new Error('Invalid JWS algorithm');
|
|
44
|
+
}
|
|
45
|
+
if (parsedPayload.version !== JWS_CONFIG.VERSION) {
|
|
46
|
+
throw new Error('Config version mismatch.');
|
|
45
47
|
}
|
|
46
48
|
if (!(0, jws_1.verify)(jws, JWS_CONFIG.SIGN_ALGORITHM, publicKey)) {
|
|
47
49
|
throw new Error('JWS signature is invalid.');
|
|
48
50
|
}
|
|
51
|
+
return parsedPayload;
|
|
49
52
|
};
|
|
50
53
|
const getFirmwareReleaseConfig = async () => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
if (localPayload.sequence >= remotePayload.sequence) {
|
|
63
|
-
finalJws = assetUtils_1.firmwareReleaseConfigAssets.jws;
|
|
64
|
-
finalSource = 'local';
|
|
65
|
-
config = localPayload;
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
config = remotePayload;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
console.error(`Error comparing remote/local JWS: ${error}. Using remote as is.`);
|
|
54
|
+
try {
|
|
55
|
+
const { jws, env } = await fetchRemoteJws();
|
|
56
|
+
const useProductionKey = ['test-signed', 'production'].includes(env);
|
|
57
|
+
const publicKey = (0, env_utils_1.getFirmwareReleaseJwsPublicKey)(useProductionKey);
|
|
58
|
+
const remoteConfig = verifyAndDecodeJws(jws, publicKey);
|
|
59
|
+
if (remoteConfig.sequence > assetUtils_1.firmwareReleaseConfigAssets.sequence) {
|
|
60
|
+
return {
|
|
61
|
+
config: remoteConfig,
|
|
62
|
+
isRemote: true,
|
|
63
|
+
};
|
|
73
64
|
}
|
|
74
65
|
}
|
|
75
|
-
|
|
76
|
-
const publicKey = (0, env_utils_1.getFirmwareReleaseJwsPublicKey)(useProductionKey);
|
|
77
|
-
verifyJwsSignature(finalJws, publicKey);
|
|
78
|
-
if (!config) {
|
|
79
|
-
config = decodeJwsPayload(finalJws);
|
|
66
|
+
catch {
|
|
80
67
|
}
|
|
81
68
|
return {
|
|
82
|
-
config,
|
|
83
|
-
isRemote: finalSource === 'remote',
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
exports.getFirmwareReleaseConfig = getFirmwareReleaseConfig;
|
|
87
|
-
const getOnlyLocalFirmwareReleaseConfig = () => {
|
|
88
|
-
const localJws = assetUtils_1.firmwareReleaseConfigAssets.jws;
|
|
89
|
-
const publicKey = (0, env_utils_1.getFirmwareReleaseJwsPublicKey)(true);
|
|
90
|
-
verifyJwsSignature(localJws, publicKey);
|
|
91
|
-
const config = decodeJwsPayload(localJws);
|
|
92
|
-
return {
|
|
93
|
-
config,
|
|
69
|
+
config: assetUtils_1.firmwareReleaseConfigAssets,
|
|
94
70
|
isRemote: false,
|
|
95
71
|
};
|
|
96
72
|
};
|
|
73
|
+
exports.getFirmwareReleaseConfig = getFirmwareReleaseConfig;
|
|
74
|
+
const getOnlyLocalFirmwareReleaseConfig = () => ({
|
|
75
|
+
config: assetUtils_1.firmwareReleaseConfigAssets,
|
|
76
|
+
isRemote: false,
|
|
77
|
+
});
|
|
97
78
|
exports.getOnlyLocalFirmwareReleaseConfig = getOnlyLocalFirmwareReleaseConfig;
|
|
98
79
|
//# sourceMappingURL=firmwareReleaseConfigUtils.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trezor/connect",
|
|
3
|
-
"version": "9.6.3-beta.
|
|
3
|
+
"version": "9.6.3-beta.2",
|
|
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.",
|
|
@@ -83,14 +83,14 @@
|
|
|
83
83
|
"@trezor/blockchain-link-types": "1.4.3-beta.1",
|
|
84
84
|
"@trezor/blockchain-link-utils": "1.4.3-beta.1",
|
|
85
85
|
"@trezor/connect-analytics": "1.3.5",
|
|
86
|
-
"@trezor/connect-common": "0.4.3-beta.
|
|
86
|
+
"@trezor/connect-common": "0.4.3-beta.2",
|
|
87
87
|
"@trezor/crypto-utils": "1.1.4",
|
|
88
|
-
"@trezor/device-utils": "1.1.3-beta.
|
|
88
|
+
"@trezor/device-utils": "1.1.3-beta.2",
|
|
89
89
|
"@trezor/env-utils": "^1.4.3-beta.1",
|
|
90
90
|
"@trezor/protobuf": "1.4.3-beta.1",
|
|
91
91
|
"@trezor/protocol": "1.2.9-beta.1",
|
|
92
92
|
"@trezor/schema-utils": "1.3.4",
|
|
93
|
-
"@trezor/transport": "1.5.3-beta.
|
|
93
|
+
"@trezor/transport": "1.5.3-beta.2",
|
|
94
94
|
"@trezor/type-utils": "1.1.9-beta.1",
|
|
95
95
|
"@trezor/utils": "9.4.3-beta.1",
|
|
96
96
|
"@trezor/utxo-lib": "2.4.3-beta.1",
|