Skip to content

Commit 1474204

Browse files
committed
Merge tag 'v21.1.0' into sc
* Loading threads with server-side assistance ([\matrix-org#2735](matrix-org#2735)). Contributed by @justjanne. * Support sign in + E2EE set up using QR code implementing MSC3886, MSC3903 and MSC3906 ([\matrix-org#2747](matrix-org#2747)). Contributed by @hughns. * Replace `instanceof Array` with `Array.isArray` ([\matrix-org#2812](matrix-org#2812)). Fixes matrix-org#2811. * Emit UnreadNotification event on notifications reset ([\matrix-org#2804](matrix-org#2804)). Fixes element-hq/element-web#23590. * Fix incorrect prevEv being sent in ClientEvent.AccountData events ([\matrix-org#2794](matrix-org#2794)). * Fix build error caused by wrong ts-strict improvements ([\matrix-org#2783](matrix-org#2783)). Contributed by @justjanne. * Encryption should not hinder verification ([\matrix-org#2734](matrix-org#2734)).
2 parents 679ba69 + 47b729f commit 1474204

File tree

156 files changed

+7210
-3682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+7210
-3682
lines changed

.eslintrc.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ module.exports = {
2020
// NOTE: These rules are frozen and new rules should not be added here.
2121
// New changes belong in https://github.com/matrix-org/eslint-plugin-matrix-org/
2222
rules: {
23-
"no-var": ["warn"],
24-
"prefer-rest-params": ["warn"],
25-
"prefer-spread": ["warn"],
26-
"one-var": ["warn"],
27-
"padded-blocks": ["warn"],
28-
"no-extend-native": ["warn"],
29-
"camelcase": ["warn"],
23+
"no-var": ["error"],
24+
"prefer-rest-params": ["error"],
25+
"prefer-spread": ["error"],
26+
"one-var": ["error"],
27+
"padded-blocks": ["error"],
28+
"no-extend-native": ["error"],
29+
"camelcase": ["error"],
3030
"no-multi-spaces": ["error", { "ignoreEOLComments": true }],
3131
"space-before-function-paren": ["error", {
3232
"anonymous": "never",

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
Changes in [21.1.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v21.1.0) (2022-11-08)
2+
==================================================================================================
3+
4+
## ✨ Features
5+
* Loading threads with server-side assistance ([\#2735](https://github.com/matrix-org/matrix-js-sdk/pull/2735)). Contributed by @justjanne.
6+
* Support sign in + E2EE set up using QR code implementing MSC3886, MSC3903 and MSC3906 ([\#2747](https://github.com/matrix-org/matrix-js-sdk/pull/2747)). Contributed by @hughns.
7+
8+
## 🐛 Bug Fixes
9+
* Replace `instanceof Array` with `Array.isArray` ([\#2812](https://github.com/matrix-org/matrix-js-sdk/pull/2812)). Fixes #2811.
10+
* Emit UnreadNotification event on notifications reset ([\#2804](https://github.com/matrix-org/matrix-js-sdk/pull/2804)). Fixes vector-im/element-web#23590.
11+
* Fix incorrect prevEv being sent in ClientEvent.AccountData events ([\#2794](https://github.com/matrix-org/matrix-js-sdk/pull/2794)).
12+
* Fix build error caused by wrong ts-strict improvements ([\#2783](https://github.com/matrix-org/matrix-js-sdk/pull/2783)). Contributed by @justjanne.
13+
* Encryption should not hinder verification ([\#2734](https://github.com/matrix-org/matrix-js-sdk/pull/2734)).
14+
115
Changes in [21.0.1](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v21.0.1) (2022-11-01)
216
==================================================================================================
317

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ host the API reference from the source files like this:
302302
```
303303
$ yarn gendoc
304304
$ cd .jsdoc
305-
$ python -m SimpleHTTPServer 8005
305+
$ python -m http.server 8005
306306
```
307307

308308
Then visit ``http://localhost:8005`` to see the API docs.

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "matrix-js-sdk",
3-
"version": "21.0.1",
3+
"version": "21.1.0",
44
"description": "Matrix Client-Server SDK for Javascript",
55
"engines": {
66
"node": ">=16.0.0"
@@ -91,16 +91,17 @@
9191
"browserify": "^17.0.0",
9292
"docdash": "^1.2.0",
9393
"domexception": "^4.0.0",
94-
"eslint": "8.24.0",
94+
"eslint": "8.25.0",
9595
"eslint-config-google": "^0.14.0",
9696
"eslint-import-resolver-typescript": "^3.5.1",
9797
"eslint-plugin-import": "^2.26.0",
98-
"eslint-plugin-matrix-org": "^0.6.0",
98+
"eslint-plugin-matrix-org": "^0.7.0",
99+
"eslint-plugin-unicorn": "^44.0.2",
99100
"exorcist": "^2.0.0",
100101
"fake-indexeddb": "^4.0.0",
101102
"jest": "^29.0.0",
102103
"jest-localstorage-mock": "^2.4.6",
103-
"jest-mock": "^27.5.1",
104+
"jest-mock": "^29.0.0",
104105
"jest-sonar-reporter": "^2.0.0",
105106
"jsdoc": "^3.6.6",
106107
"matrix-mock-request": "^2.5.0",

spec/TestClient.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ import { IKeysUploadResponse, IUploadKeysRequest } from '../src/client';
3838
export class TestClient {
3939
public readonly httpBackend: MockHttpBackend;
4040
public readonly client: MatrixClient;
41-
public deviceKeys: IDeviceKeys;
42-
public oneTimeKeys: Record<string, IOneTimeKey>;
41+
public deviceKeys?: IDeviceKeys | null;
42+
public oneTimeKeys?: Record<string, IOneTimeKey>;
4343

4444
constructor(
4545
public readonly userId?: string,
@@ -123,7 +123,7 @@ export class TestClient {
123123

124124
logger.log(this + ': received device keys');
125125
// we expect this to happen before any one-time keys are uploaded.
126-
expect(Object.keys(this.oneTimeKeys).length).toEqual(0);
126+
expect(Object.keys(this.oneTimeKeys!).length).toEqual(0);
127127

128128
this.deviceKeys = content.device_keys;
129129
return { one_time_key_counts: { signed_curve25519: 0 } };
@@ -138,17 +138,17 @@ export class TestClient {
138138
* @returns {Promise} for the one-time keys
139139
*/
140140
public awaitOneTimeKeyUpload(): Promise<Record<string, IOneTimeKey>> {
141-
if (Object.keys(this.oneTimeKeys).length != 0) {
141+
if (Object.keys(this.oneTimeKeys!).length != 0) {
142142
// already got one-time keys
143-
return Promise.resolve(this.oneTimeKeys);
143+
return Promise.resolve(this.oneTimeKeys!);
144144
}
145145

146146
this.httpBackend.when("POST", "/keys/upload")
147147
.respond<IKeysUploadResponse, IUploadKeysRequest>(200, (_path, content: IUploadKeysRequest) => {
148148
expect(content.device_keys).toBe(undefined);
149149
expect(content.one_time_keys).toBe(undefined);
150150
return { one_time_key_counts: {
151-
signed_curve25519: Object.keys(this.oneTimeKeys).length,
151+
signed_curve25519: Object.keys(this.oneTimeKeys!).length,
152152
} };
153153
});
154154

@@ -158,17 +158,17 @@ export class TestClient {
158158
expect(content.one_time_keys).toBeTruthy();
159159
expect(content.one_time_keys).not.toEqual({});
160160
logger.log('%s: received %i one-time keys', this,
161-
Object.keys(content.one_time_keys).length);
161+
Object.keys(content.one_time_keys!).length);
162162
this.oneTimeKeys = content.one_time_keys;
163163
return { one_time_key_counts: {
164-
signed_curve25519: Object.keys(this.oneTimeKeys).length,
164+
signed_curve25519: Object.keys(this.oneTimeKeys!).length,
165165
} };
166166
});
167167

168168
// this can take ages
169169
return this.httpBackend.flush('/keys/upload', 2, 1000).then((flushed) => {
170170
expect(flushed).toEqual(2);
171-
return this.oneTimeKeys;
171+
return this.oneTimeKeys!;
172172
});
173173
}
174174

@@ -183,7 +183,7 @@ export class TestClient {
183183
this.httpBackend.when('POST', '/keys/query').respond<IDownloadKeyResult>(
184184
200, (_path, content) => {
185185
Object.keys(response.device_keys).forEach((userId) => {
186-
expect(content.device_keys[userId]).toEqual([]);
186+
expect(content.device_keys![userId]).toEqual([]);
187187
});
188188
return response;
189189
});
@@ -206,7 +206,7 @@ export class TestClient {
206206
*/
207207
public getDeviceKey(): string {
208208
const keyId = 'curve25519:' + this.deviceId;
209-
return this.deviceKeys.keys[keyId];
209+
return this.deviceKeys!.keys[keyId];
210210
}
211211

212212
/**
@@ -216,7 +216,7 @@ export class TestClient {
216216
*/
217217
public getSigningKey(): string {
218218
const keyId = 'ed25519:' + this.deviceId;
219-
return this.deviceKeys.keys[keyId];
219+
return this.deviceKeys!.keys[keyId];
220220
}
221221

222222
/**
@@ -237,6 +237,6 @@ export class TestClient {
237237
}
238238

239239
public getUserId(): string {
240-
return this.userId;
240+
return this.userId!;
241241
}
242242
}

spec/integ/matrix-client-crypto.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ async function bobUploadsDeviceKeys(): Promise<void> {
5959
bobTestClient.client.uploadKeys(),
6060
bobTestClient.httpBackend.flushAllExpected(),
6161
]);
62-
expect(Object.keys(bobTestClient.deviceKeys).length).not.toEqual(0);
62+
expect(Object.keys(bobTestClient.deviceKeys!).length).not.toEqual(0);
6363
}
6464

6565
/**
@@ -99,7 +99,7 @@ async function expectAliClaimKeys(): Promise<void> {
9999
expect(claimType).toEqual("signed_curve25519");
100100
let keyId = '';
101101
for (keyId in keys) {
102-
if (bobTestClient.oneTimeKeys.hasOwnProperty(keyId)) {
102+
if (bobTestClient.oneTimeKeys!.hasOwnProperty(keyId)) {
103103
if (keyId.indexOf(claimType + ":") === 0) {
104104
break;
105105
}
@@ -137,7 +137,7 @@ async function aliDownloadsKeys(): Promise<void> {
137137
// @ts-ignore - protected
138138
aliTestClient.client.cryptoStore.getEndToEndDeviceData(null, (data) => {
139139
const devices = data!.devices[bobUserId]!;
140-
expect(devices[bobDeviceId].keys).toEqual(bobTestClient.deviceKeys.keys);
140+
expect(devices[bobDeviceId].keys).toEqual(bobTestClient.deviceKeys!.keys);
141141
expect(devices[bobDeviceId].verified).
142142
toBe(DeviceInfo.DeviceVerification.UNVERIFIED);
143143
});
@@ -223,7 +223,7 @@ async function expectBobSendMessageRequest(): Promise<OlmPayload> {
223223
const content = await expectSendMessageRequest(bobTestClient.httpBackend);
224224
bobMessages.push(content);
225225
const aliKeyId = "curve25519:" + aliDeviceId;
226-
const aliDeviceCurve25519Key = aliTestClient.deviceKeys.keys[aliKeyId];
226+
const aliDeviceCurve25519Key = aliTestClient.deviceKeys!.keys[aliKeyId];
227227
expect(Object.keys(content.ciphertext)).toEqual([aliDeviceCurve25519Key]);
228228
const ciphertext = content.ciphertext[aliDeviceCurve25519Key];
229229
expect(ciphertext).toBeTruthy();
@@ -393,7 +393,7 @@ describe("MatrixClient crypto", () => {
393393
it("Ali gets keys with an invalid signature", async () => {
394394
await bobUploadsDeviceKeys();
395395
// tamper bob's keys
396-
const bobDeviceKeys = bobTestClient.deviceKeys;
396+
const bobDeviceKeys = bobTestClient.deviceKeys!;
397397
expect(bobDeviceKeys.keys["curve25519:" + bobDeviceId]).toBeTruthy();
398398
bobDeviceKeys.keys["curve25519:" + bobDeviceId] += "abc";
399399
await Promise.all([
@@ -479,7 +479,7 @@ describe("MatrixClient crypto", () => {
479479
await bobTestClient.start();
480480
const keys = await bobTestClient.awaitOneTimeKeyUpload();
481481
expect(Object.keys(keys).length).toEqual(5);
482-
expect(Object.keys(bobTestClient.deviceKeys).length).not.toEqual(0);
482+
expect(Object.keys(bobTestClient.deviceKeys!).length).not.toEqual(0);
483483
});
484484

485485
it("Ali sends a message", async () => {

0 commit comments

Comments
 (0)