Skip to content

Commit 54d9823

Browse files
committed
Merge tag 'v26.0.0' into sc
* Ensure we do not add relations to the wrong timeline ([\matrix-org#3427](matrix-org#3427)). Fixes element-hq/element-web#25450 and element-hq/element-web#25494. * Deprecate `QrCodeEvent`, `SasEvent` and `VerificationEvent` ([\matrix-org#3386](matrix-org#3386)). * Move crypto classes into a separate namespace ([\matrix-org#3385](matrix-org#3385)). * Mention deno support in the README ([\matrix-org#3417](matrix-org#3417)). Contributed by @sigmaSd. * Mark room version 10 as safe ([\matrix-org#3425](matrix-org#3425)). * Prioritise entirely supported flows for UIA ([\matrix-org#3402](matrix-org#3402)). * Add methods to terminate idb worker ([\matrix-org#3362](matrix-org#3362)). * Total summary count ([\matrix-org#3351](matrix-org#3351)). Contributed by @toger5. * Audio concealment ([\matrix-org#3349](matrix-org#3349)). Contributed by @toger5. * Correctly accumulate sync summaries. ([\matrix-org#3366](matrix-org#3366)). Fixes element-hq/element-web#23345. * Keep measuring a call feed's volume after a stream replacement ([\matrix-org#3361](matrix-org#3361)). Fixes element-hq/element-call#1051. * Element-R: Avoid uploading a new fallback key at every `/sync` ([\matrix-org#3338](matrix-org#3338)). Fixes element-hq/element-web#25215. * Accumulate receipts for the main thread and unthreaded separately ([\matrix-org#3339](matrix-org#3339)). Fixes element-hq/element-web#24629. * Remove spec non-compliant extended glob format ([\matrix-org#3423](matrix-org#3423)). Fixes element-hq/element-web#25474. * Fix bug where original event was inserted into timeline instead of the edit event ([\matrix-org#3398](matrix-org#3398)). Contributed by @andybalaam. * Only add a local receipt if it's after an existing receipt ([\matrix-org#3399](matrix-org#3399)). Contributed by @andybalaam. * Attempt a potential workaround for stuck notifs ([\matrix-org#3384](matrix-org#3384)). Fixes element-hq/element-web#25406. Contributed by @andybalaam. * Fix verification bug with `pendingEventOrdering: "chronological"` ([\matrix-org#3382](matrix-org#3382)).
2 parents 399467c + f41fa84 commit 54d9823

File tree

115 files changed

+4732
-2016
lines changed

Some content is hidden

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

115 files changed

+4732
-2016
lines changed

.github/workflows/docs-pr-netlify.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
path: docs
2323

2424
- name: 📤 Deploy to Netlify
25-
uses: matrix-org/netlify-pr-preview@v1
25+
uses: matrix-org/netlify-pr-preview@v2
2626
with:
2727
path: docs
2828
owner: ${{ github.event.workflow_run.head_repository.owner.login }}

CHANGELOG.md

+35
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1+
Changes in [26.0.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v26.0.0) (2023-06-06)
2+
==================================================================================================
3+
4+
## 🚨 BREAKING CHANGES
5+
* Ensure we do not add relations to the wrong timeline ([\#3427](https://github.com/matrix-org/matrix-js-sdk/pull/3427)). Fixes vector-im/element-web#25450 and vector-im/element-web#25494.
6+
* Deprecate `QrCodeEvent`, `SasEvent` and `VerificationEvent` ([\#3386](https://github.com/matrix-org/matrix-js-sdk/pull/3386)).
7+
8+
## 🦖 Deprecations
9+
* Move crypto classes into a separate namespace ([\#3385](https://github.com/matrix-org/matrix-js-sdk/pull/3385)).
10+
11+
## ✨ Features
12+
* Mention deno support in the README ([\#3417](https://github.com/matrix-org/matrix-js-sdk/pull/3417)). Contributed by @sigmaSd.
13+
* Mark room version 10 as safe ([\#3425](https://github.com/matrix-org/matrix-js-sdk/pull/3425)).
14+
* Prioritise entirely supported flows for UIA ([\#3402](https://github.com/matrix-org/matrix-js-sdk/pull/3402)).
15+
* Add methods to terminate idb worker ([\#3362](https://github.com/matrix-org/matrix-js-sdk/pull/3362)).
16+
* Total summary count ([\#3351](https://github.com/matrix-org/matrix-js-sdk/pull/3351)). Contributed by @toger5.
17+
* Audio concealment ([\#3349](https://github.com/matrix-org/matrix-js-sdk/pull/3349)). Contributed by @toger5.
18+
19+
## 🐛 Bug Fixes
20+
* Correctly accumulate sync summaries. ([\#3366](https://github.com/matrix-org/matrix-js-sdk/pull/3366)). Fixes vector-im/element-web#23345.
21+
* Keep measuring a call feed's volume after a stream replacement ([\#3361](https://github.com/matrix-org/matrix-js-sdk/pull/3361)). Fixes vector-im/element-call#1051.
22+
* Element-R: Avoid uploading a new fallback key at every `/sync` ([\#3338](https://github.com/matrix-org/matrix-js-sdk/pull/3338)). Fixes vector-im/element-web#25215.
23+
* Accumulate receipts for the main thread and unthreaded separately ([\#3339](https://github.com/matrix-org/matrix-js-sdk/pull/3339)). Fixes vector-im/element-web#24629.
24+
* Remove spec non-compliant extended glob format ([\#3423](https://github.com/matrix-org/matrix-js-sdk/pull/3423)). Fixes vector-im/element-web#25474.
25+
* Fix bug where original event was inserted into timeline instead of the edit event ([\#3398](https://github.com/matrix-org/matrix-js-sdk/pull/3398)). Contributed by @andybalaam.
26+
* Only add a local receipt if it's after an existing receipt ([\#3399](https://github.com/matrix-org/matrix-js-sdk/pull/3399)). Contributed by @andybalaam.
27+
* Attempt a potential workaround for stuck notifs ([\#3384](https://github.com/matrix-org/matrix-js-sdk/pull/3384)). Fixes vector-im/element-web#25406. Contributed by @andybalaam.
28+
* Fix verification bug with `pendingEventOrdering: "chronological"` ([\#3382](https://github.com/matrix-org/matrix-js-sdk/pull/3382)).
29+
30+
Changes in [25.1.1](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v25.1.1) (2023-05-16)
31+
==================================================================================================
32+
33+
## 🐛 Bug Fixes
34+
* Rebuild to fix packaging glitch in 25.1.0. Fixes #3363
35+
136
Changes in [25.1.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v25.1.0) (2023-05-09)
237
==================================================================================================
338

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ client.publicRooms(function (err, data) {
5656
See below for how to include libolm to enable end-to-end-encryption. Please check
5757
[the Node.js terminal app](examples/node) for a more complex example.
5858

59+
You can also use the sdk with [Deno](https://deno.land/) (`import npm:matrix-js-sdk`) but its not officialy supported.
60+
5961
To start the client:
6062

6163
```javascript

package.json

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "matrix-js-sdk",
3-
"version": "25.1.0",
3+
"version": "26.0.0",
44
"description": "Matrix Client-Server SDK for Javascript",
55
"engines": {
66
"node": ">=16.0.0"
@@ -55,7 +55,7 @@
5555
],
5656
"dependencies": {
5757
"@babel/runtime": "^7.12.5",
58-
"@matrix-org/matrix-sdk-crypto-js": "^0.1.0-alpha.7",
58+
"@matrix-org/matrix-sdk-crypto-js": "^0.1.0-alpha.9",
5959
"another-json": "^0.2.0",
6060
"bs58": "^5.0.0",
6161
"content-type": "^1.0.4",
@@ -101,16 +101,16 @@
101101
"debug": "^4.3.4",
102102
"docdash": "^2.0.0",
103103
"domexception": "^4.0.0",
104-
"eslint": "8.39.0",
104+
"eslint": "8.40.0",
105105
"eslint-config-google": "^0.14.0",
106106
"eslint-config-prettier": "^8.5.0",
107107
"eslint-import-resolver-typescript": "^3.5.1",
108108
"eslint-plugin-import": "^2.26.0",
109109
"eslint-plugin-jest": "^27.1.6",
110-
"eslint-plugin-jsdoc": "^43.0.6",
110+
"eslint-plugin-jsdoc": "^44.0.0",
111111
"eslint-plugin-matrix-org": "^1.0.0",
112112
"eslint-plugin-tsdoc": "^0.2.17",
113-
"eslint-plugin-unicorn": "^46.0.0",
113+
"eslint-plugin-unicorn": "^47.0.0",
114114
"exorcist": "^2.0.0",
115115
"fake-indexeddb": "^4.0.0",
116116
"fetch-mock-jest": "^1.5.1",
@@ -120,14 +120,16 @@
120120
"jest-mock": "^29.0.0",
121121
"matrix-mock-request": "^2.5.0",
122122
"prettier": "2.8.8",
123-
"rimraf": "^4.0.0",
123+
"rimraf": "^5.0.0",
124124
"terser": "^5.5.1",
125125
"ts-node": "^10.9.1",
126126
"tsify": "^5.0.2",
127127
"typedoc": "^0.24.0",
128+
"typedoc-plugin-coverage": "^2.1.0",
128129
"typedoc-plugin-mdn-links": "^3.0.3",
129130
"typedoc-plugin-missing-exports": "^2.0.0",
130131
"typedoc-plugin-versions": "^0.2.3",
132+
"typedoc-plugin-versions-cli": "^0.1.12",
131133
"typescript": "^5.0.0"
132134
},
133135
"@casualbot/jest-sonar-reporter": {

scripts/changelog_head.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
break
1616
found_first_header = True
1717
elif not re.match(r"^=+$", line) and len(line) > 0:
18-
print line
18+
print(line)

spec/integ/cross-signing.spec.ts

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/*
2+
Copyright 2023 The Matrix.org Foundation C.I.C.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
import fetchMock from "fetch-mock-jest";
18+
import "fake-indexeddb/auto";
19+
import { IDBFactory } from "fake-indexeddb";
20+
21+
import { CRYPTO_BACKENDS, InitCrypto } from "../test-utils/test-utils";
22+
import { createClient, MatrixClient, UIAuthCallback } from "../../src";
23+
24+
afterEach(() => {
25+
// reset fake-indexeddb after each test, to make sure we don't leak connections
26+
// cf https://github.com/dumbmatter/fakeIndexedDB#wipingresetting-the-indexeddb-for-a-fresh-state
27+
// eslint-disable-next-line no-global-assign
28+
indexedDB = new IDBFactory();
29+
});
30+
31+
const TEST_USER_ID = "@alice:localhost";
32+
const TEST_DEVICE_ID = "xzcvb";
33+
34+
/**
35+
* Integration tests for cross-signing functionality.
36+
*
37+
* These tests work by intercepting HTTP requests via fetch-mock rather than mocking out bits of the client, so as
38+
* to provide the most effective integration tests possible.
39+
*/
40+
describe.each(Object.entries(CRYPTO_BACKENDS))("cross-signing (%s)", (backend: string, initCrypto: InitCrypto) => {
41+
let aliceClient: MatrixClient;
42+
43+
beforeEach(async () => {
44+
// anything that we don't have a specific matcher for silently returns a 404
45+
fetchMock.catch(404);
46+
fetchMock.config.warnOnFallback = false;
47+
48+
const homeserverUrl = "https://alice-server.com";
49+
aliceClient = createClient({
50+
baseUrl: homeserverUrl,
51+
userId: TEST_USER_ID,
52+
accessToken: "akjgkrgjs",
53+
deviceId: TEST_DEVICE_ID,
54+
});
55+
56+
await initCrypto(aliceClient);
57+
});
58+
59+
afterEach(async () => {
60+
await aliceClient.stopClient();
61+
fetchMock.mockReset();
62+
});
63+
64+
describe("bootstrapCrossSigning (before initialsync completes)", () => {
65+
it("publishes keys if none were yet published", async () => {
66+
// have account_data requests return an empty object
67+
fetchMock.get("express:/_matrix/client/r0/user/:userId/account_data/:type", {});
68+
69+
// we expect a request to upload signatures for our device ...
70+
fetchMock.post({ url: "path:/_matrix/client/v3/keys/signatures/upload", name: "upload-sigs" }, {});
71+
72+
// ... and one to upload the cross-signing keys (with UIA)
73+
fetchMock.post(
74+
// legacy crypto uses /unstable/; /v3/ is correct
75+
{
76+
url: new RegExp("/_matrix/client/(unstable|v3)/keys/device_signing/upload"),
77+
name: "upload-keys",
78+
},
79+
{},
80+
);
81+
82+
// provide a UIA callback, so that the cross-signing keys are uploaded
83+
const authDict = { type: "test" };
84+
const uiaCallback: UIAuthCallback<void> = async (makeRequest) => {
85+
await makeRequest(authDict);
86+
};
87+
88+
// now bootstrap cross signing, and check it resolves successfully
89+
await aliceClient.bootstrapCrossSigning({
90+
authUploadDeviceSigningKeys: uiaCallback,
91+
});
92+
93+
// check the cross-signing keys upload
94+
expect(fetchMock.called("upload-keys")).toBeTruthy();
95+
const [, keysOpts] = fetchMock.lastCall("upload-keys")!;
96+
const keysBody = JSON.parse(keysOpts!.body as string);
97+
expect(keysBody.auth).toEqual(authDict); // check uia dict was passed
98+
// there should be a key of each type
99+
// master key is signed by the device
100+
expect(keysBody).toHaveProperty(`master_key.signatures.[${TEST_USER_ID}].[ed25519:${TEST_DEVICE_ID}]`);
101+
const masterKeyId = Object.keys(keysBody.master_key.keys)[0];
102+
// ssk and usk are signed by the master key
103+
expect(keysBody).toHaveProperty(`self_signing_key.signatures.[${TEST_USER_ID}].[${masterKeyId}]`);
104+
expect(keysBody).toHaveProperty(`user_signing_key.signatures.[${TEST_USER_ID}].[${masterKeyId}]`);
105+
const sskId = Object.keys(keysBody.self_signing_key.keys)[0];
106+
107+
// check the publish call
108+
expect(fetchMock.called("upload-sigs")).toBeTruthy();
109+
const [, sigsOpts] = fetchMock.lastCall("upload-sigs")!;
110+
const body = JSON.parse(sigsOpts!.body as string);
111+
// there should be a signature for our device, by our self-signing key.
112+
expect(body).toHaveProperty(
113+
`[${TEST_USER_ID}].[${TEST_DEVICE_ID}].signatures.[${TEST_USER_ID}].[${sskId}]`,
114+
);
115+
});
116+
});
117+
});

spec/integ/crypto.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("crypto (%s)", (backend: string,
11111111
} catch (e) {
11121112
expect((e as any).name).toEqual("UnknownDeviceError");
11131113
expect([...(e as any).devices.keys()]).toEqual([aliceClient.getUserId()!]);
1114-
expect((e as any).devices.get(aliceClient.getUserId()!).has("DEVICE_ID"));
1114+
expect((e as any).devices.get(aliceClient.getUserId()!).has("DEVICE_ID")).toBeTruthy();
11151115
}
11161116

11171117
// mark the device as known, and resend.

spec/integ/matrix-client-event-timeline.spec.ts

+5-10
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ describe("MatrixClient event timelines", function () {
11421142

11431143
const prom = emitPromise(room, ThreadEvent.Update);
11441144
// Assume we're seeing the reply while loading backlog
1145-
room.addLiveEvents([THREAD_REPLY2]);
1145+
await room.addLiveEvents([THREAD_REPLY2]);
11461146
httpBackend
11471147
.when(
11481148
"GET",
@@ -1156,7 +1156,7 @@ describe("MatrixClient event timelines", function () {
11561156
});
11571157
await flushHttp(prom);
11581158
// but while loading the metadata, a new reply has arrived
1159-
room.addLiveEvents([THREAD_REPLY3]);
1159+
await room.addLiveEvents([THREAD_REPLY3]);
11601160
const thread = room.getThread(THREAD_ROOT_UPDATED.event_id!)!;
11611161
// then the events should still be all in the right order
11621162
expect(thread.events.map((it) => it.getId())).toEqual([
@@ -1248,7 +1248,7 @@ describe("MatrixClient event timelines", function () {
12481248

12491249
const prom = emitPromise(room, ThreadEvent.Update);
12501250
// Assume we're seeing the reply while loading backlog
1251-
room.addLiveEvents([THREAD_REPLY2]);
1251+
await room.addLiveEvents([THREAD_REPLY2]);
12521252
httpBackend
12531253
.when(
12541254
"GET",
@@ -1267,7 +1267,7 @@ describe("MatrixClient event timelines", function () {
12671267
});
12681268
await flushHttp(prom);
12691269
// but while loading the metadata, a new reply has arrived
1270-
room.addLiveEvents([THREAD_REPLY3]);
1270+
await room.addLiveEvents([THREAD_REPLY3]);
12711271
const thread = room.getThread(THREAD_ROOT_UPDATED.event_id!)!;
12721272
// then the events should still be all in the right order
12731273
expect(thread.events.map((it) => it.getId())).toEqual([
@@ -1572,7 +1572,7 @@ describe("MatrixClient event timelines", function () {
15721572
respondToEvent(THREAD_ROOT_UPDATED);
15731573
respondToEvent(THREAD_ROOT_UPDATED);
15741574
respondToEvent(THREAD2_ROOT);
1575-
room.addLiveEvents([THREAD_REPLY2]);
1575+
await room.addLiveEvents([THREAD_REPLY2]);
15761576
await httpBackend.flushAllExpected();
15771577
await prom;
15781578
expect(thread.length).toBe(2);
@@ -1937,11 +1937,6 @@ describe("MatrixClient event timelines", function () {
19371937
.respond(200, function () {
19381938
return THREAD_ROOT;
19391939
});
1940-
httpBackend
1941-
.when("GET", "/rooms/!foo%3Abar/event/" + encodeURIComponent(THREAD_ROOT.event_id!))
1942-
.respond(200, function () {
1943-
return THREAD_ROOT;
1944-
});
19451940
httpBackend
19461941
.when("GET", "/rooms/!foo%3Abar/context/" + encodeURIComponent(THREAD_ROOT.event_id!))
19471942
.respond(200, function () {

0 commit comments

Comments
 (0)