Skip to content

Commit 020770b

Browse files
authored
Merge branch 'develop' into florianduros/rip-out-legacy-crypto/call
2 parents 9c4f21b + bdd4d82 commit 020770b

File tree

98 files changed

+2885
-2591
lines changed

Some content is hidden

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

98 files changed

+2885
-2591
lines changed

.eslintrc.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ module.exports = {
138138
tryExtensions: [".ts"],
139139
},
140140
],
141+
"no-extra-boolean-cast": "error",
141142
},
142143
},
143144
{

.github/workflows/pull_request.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
name: Preview Changelog
1616
runs-on: ubuntu-24.04
1717
steps:
18-
- uses: mheap/github-action-required-labels@d25134c992b943fb6ad00c25ea00eb5988c0a9dd # v5
18+
- uses: mheap/github-action-required-labels@388fd6af37b34cdfe5a23b37060e763217e58b03 # v5
1919
if: github.event_name != 'merge_group'
2020
with:
2121
labels: |

.github/workflows/release-checks.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Release Sanity checks
2+
on:
3+
workflow_call:
4+
secrets:
5+
ELEMENT_BOT_TOKEN:
6+
required: false
7+
inputs:
8+
repository:
9+
type: string
10+
required: false
11+
default: ${{ github.repository }}
12+
description: "The repository (in form owner/repo) to check for release blockers"
13+
14+
permissions: {}
15+
jobs:
16+
checks:
17+
name: Sanity checks
18+
runs-on: ubuntu-24.04
19+
steps:
20+
- name: Check for X-Release-Blocker label on any open issues or PRs
21+
uses: actions/github-script@v7
22+
env:
23+
REPO: ${{ inputs.repository }}
24+
with:
25+
github-token: ${{ secrets.ELEMENT_BOT_TOKEN || secrets.GITHUB_TOKEN }}
26+
script: |
27+
const { REPO } = process.env;
28+
const { data } = await github.rest.search.issuesAndPullRequests({
29+
q: `repo:${REPO} label:X-Release-Blocker is:open`,
30+
per_page: 50,
31+
});
32+
33+
if (data.total_count) {
34+
data.items.forEach(item => {
35+
core.error(`Release blocker: ${item.html_url}`);
36+
});
37+
core.setFailed(`Found release blockers!`);
38+
}

.github/workflows/release-make.yml

+1-17
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,10 @@ permissions: {}
4242
jobs:
4343
checks:
4444
name: Sanity checks
45-
runs-on: ubuntu-24.04
4645
permissions:
4746
issues: read
4847
pull-requests: read
49-
steps:
50-
- name: Check for X-Release-Blocker label on any open issues or PRs
51-
uses: actions/github-script@v7
52-
with:
53-
script: |
54-
const { data } = await github.rest.search.issuesAndPullRequests({
55-
q: `repo:${context.repo.owner}/${context.repo.repo} label:X-Release-Blocker is:open`,
56-
per_page: 50,
57-
});
58-
59-
if (data.total_count) {
60-
data.items.forEach(item => {
61-
core.error(`Release blocker: ${item.html_url}`);
62-
});
63-
core.setFailed(`Found release blockers!`);
64-
}
48+
uses: matrix-org/matrix-js-sdk/.github/workflows/release-checks.yml@develop
6549

6650
release:
6751
name: Release

.github/workflows/sonarcloud.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
steps:
2828
# We create the status here and then update it to success/failure in the `report` stage
2929
# This provides an easy link to this workflow_run from the PR before Sonarcloud is done.
30-
- uses: guibranco/github-status-action-v2@66088c44e212a906c32a047529a213d81809ec1c
30+
- uses: guibranco/github-status-action-v2@56cd38caf0615dd03f49d42ed301f1469911ac61
3131
with:
3232
authToken: ${{ secrets.GITHUB_TOKEN }}
3333
state: pending
@@ -87,7 +87,7 @@ jobs:
8787
revision: ${{ github.event.workflow_run.head_sha }}
8888
token: ${{ secrets.SONAR_TOKEN }}
8989

90-
- uses: guibranco/github-status-action-v2@66088c44e212a906c32a047529a213d81809ec1c
90+
- uses: guibranco/github-status-action-v2@56cd38caf0615dd03f49d42ed301f1469911ac61
9191
if: always()
9292
with:
9393
authToken: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/static_analysis.yml

+35
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,41 @@ jobs:
4444
- name: Run Linter
4545
run: "yarn run lint:js"
4646

47+
node_example_lint:
48+
name: "Node.js example"
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v4
52+
53+
- uses: actions/setup-node@v4
54+
with:
55+
cache: "yarn"
56+
node-version-file: package.json
57+
58+
- name: Install Deps
59+
run: "yarn install"
60+
61+
- name: Build Types
62+
run: "yarn build:types"
63+
64+
- uses: actions/setup-node@v4
65+
with:
66+
cache: "npm"
67+
node-version-file: "examples/node/package.json"
68+
# cache-dependency-path: '**/package-lock.json'
69+
70+
- name: Install Example Deps
71+
run: "npm install"
72+
working-directory: "examples/node"
73+
74+
- name: Check Syntax
75+
run: "node --check app.js"
76+
working-directory: "examples/node"
77+
78+
- name: Typecheck
79+
run: "npx tsc"
80+
working-directory: "examples/node"
81+
4782
workflow_lint:
4883
name: "Workflow Lint"
4984
runs-on: ubuntu-24.04

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ jobs:
116116
steps:
117117
- name: Skip SonarCloud on merge queues
118118
if: env.ENABLE_COVERAGE == 'false'
119-
uses: guibranco/github-status-action-v2@66088c44e212a906c32a047529a213d81809ec1c
119+
uses: guibranco/github-status-action-v2@56cd38caf0615dd03f49d42ed301f1469911ac61
120120
with:
121121
authToken: ${{ secrets.GITHUB_TOKEN }}
122122
state: success

CHANGELOG.md

+79
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,82 @@
1+
Changes in [36.0.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v36.0.0) (2025-01-14)
2+
==================================================================================================
3+
## 🚨 BREAKING CHANGES
4+
5+
* Remove support for "legacy" MSC3898 group calling in MatrixRTCSession and CallMembership ([#4583](https://github.com/matrix-org/matrix-js-sdk/pull/4583)). Contributed by @toger5.
6+
7+
## ✨ Features
8+
9+
* MatrixRTC: Implement expiry logic for CallMembership and additional test coverage ([#4587](https://github.com/matrix-org/matrix-js-sdk/pull/4587)). Contributed by @toger5.
10+
11+
## 🐛 Bug Fixes
12+
13+
* Don't retry on 4xx responses ([#4601](https://github.com/matrix-org/matrix-js-sdk/pull/4601)). Contributed by @dbkr.
14+
* Upgrade matrix-sdk-crypto-wasm to 12.1.0 ([#4596](https://github.com/matrix-org/matrix-js-sdk/pull/4596)). Contributed by @andybalaam.
15+
* Avoid key prompts when resetting crypto ([#4586](https://github.com/matrix-org/matrix-js-sdk/pull/4586)). Contributed by @dbkr.
16+
* Handle when aud OIDC claim is an Array ([#4584](https://github.com/matrix-org/matrix-js-sdk/pull/4584)). Contributed by @liamdiprose.
17+
* Save the key backup key to 4S during `bootstrapSecretStorage ` ([#4542](https://github.com/matrix-org/matrix-js-sdk/pull/4542)). Contributed by @dbkr.
18+
* Only re-prepare MatrixrRTC delayed disconnection event on 404 ([#4575](https://github.com/matrix-org/matrix-js-sdk/pull/4575)). Contributed by @toger5.
19+
20+
21+
Changes in [35.1.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v35.1.0) (2024-12-18)
22+
==================================================================================================
23+
This release updates matrix-sdk-crypto-wasm to fix a bug which could prevent loading stored crypto state from storage.
24+
25+
## 🐛 Bug Fixes
26+
27+
* Upgrade matrix-sdk-crypto-wasm to 1.11.0 ([#4593](https://github.com/matrix-org/matrix-js-sdk/pull/4593)).
28+
29+
30+
Changes in [35.0.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v35.0.0) (2024-12-17)
31+
==================================================================================================
32+
## 🚨 BREAKING CHANGES
33+
34+
This release contains several breaking changes which will need code changes in your app. Most notably, `initCrypto()`
35+
no longer exists and has been moved to `initLegacyCrypto()` in preparation for the eventual removal of Olm. You can
36+
continue to use legacy Olm crypto for now by calling `initLegacyCrypto()` instead.
37+
38+
You may also need to make further changes if you use more advanced APIs. See the individual PRs (listed in order of size of change) for specific APIs changed and how to migrate.
39+
40+
* Rename `MatrixClient.initCrypto` into `MatrixClient.initLegacyCrypto` ([#4567](https://github.com/matrix-org/matrix-js-sdk/pull/4567)). Contributed by @florianduros.
41+
* Support MSC4222 `state_after` ([#4487](https://github.com/matrix-org/matrix-js-sdk/pull/4487)). Contributed by @dbkr.
42+
* Avoid use of Buffer as it does not exist in the Web natively ([#4569](https://github.com/matrix-org/matrix-js-sdk/pull/4569)). Contributed by @t3chguy.
43+
44+
## 🦖 Deprecations
45+
46+
* Deprecate remaining legacy functions and move `CryptoEvent.LegacyCryptoStoreMigrationProgress` handler ([#4560](https://github.com/matrix-org/matrix-js-sdk/pull/4560)). Contributed by @florianduros.
47+
48+
## ✨ Features
49+
50+
* Rename `MatrixClient.initCrypto` into `MatrixClient.initLegacyCrypto` ([#4567](https://github.com/matrix-org/matrix-js-sdk/pull/4567)). Contributed by @florianduros.
51+
* Avoid use of Buffer as it does not exist in the Web natively ([#4569](https://github.com/matrix-org/matrix-js-sdk/pull/4569)). Contributed by @t3chguy.
52+
* Re-send MatrixRTC media encryption keys for a new joiner even if a rotation is in progress ([#4561](https://github.com/matrix-org/matrix-js-sdk/pull/4561)). Contributed by @hughns.
53+
* Support MSC4222 `state_after` ([#4487](https://github.com/matrix-org/matrix-js-sdk/pull/4487)). Contributed by @dbkr.
54+
* Revert "Fix room state being updated with old (now overwritten) state and emitting for those updates. (#4242)" ([#4532](https://github.com/matrix-org/matrix-js-sdk/pull/4532)). Contributed by @toger5.
55+
56+
## 🐛 Bug Fixes
57+
58+
* Fix age field check in event echo processing ([#3635](https://github.com/matrix-org/matrix-js-sdk/pull/3635)). Contributed by @stas-demydiuk.
59+
60+
61+
Changes in [34.13.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v34.13.0) (2024-12-03)
62+
====================================================================================================
63+
## 🦖 Deprecations
64+
65+
* Deprecate `MatrixClient.isEventSenderVerified` ([#4527](https://github.com/matrix-org/matrix-js-sdk/pull/4527)). Contributed by @florianduros.
66+
* Add `restoreKeybackup` to `CryptoApi`. ([#4476](https://github.com/matrix-org/matrix-js-sdk/pull/4476)). Contributed by @florianduros.
67+
68+
## ✨ Features
69+
70+
* Ensure we disambiguate display names which look like MXIDs ([#4540](https://github.com/matrix-org/matrix-js-sdk/pull/4540)). Contributed by @t3chguy.
71+
* Add `CryptoApi.getBackupInfo` ([#4512](https://github.com/matrix-org/matrix-js-sdk/pull/4512)). Contributed by @florianduros.
72+
* Fix local echo in embedded mode ([#4498](https://github.com/matrix-org/matrix-js-sdk/pull/4498)). Contributed by @toger5.
73+
* Add `restoreKeybackup` to `CryptoApi`. ([#4476](https://github.com/matrix-org/matrix-js-sdk/pull/4476)). Contributed by @florianduros.
74+
75+
## 🐛 Bug Fixes
76+
77+
* Fix `RustBackupManager` remaining values after current backup removal ([#4537](https://github.com/matrix-org/matrix-js-sdk/pull/4537)). Contributed by @florianduros.
78+
79+
180
Changes in [34.12.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v34.12.0) (2024-11-19)
281
====================================================================================================
382
## 🦖 Deprecations

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ Then visit `http://localhost:8005` to see the API docs.
307307

308308
## Initialization
309309

310-
**Do not use `matrixClient.initCrypto()`. This method is deprecated and no longer maintained.**
310+
**Do not use `matrixClient.initLegacyCrypto()`. This method is deprecated and no longer maintained.**
311311

312312
To initialize the end-to-end encryption support in the matrix client:
313313

@@ -325,6 +325,8 @@ await matrixClient.initRustCrypto();
325325

326326
After calling `initRustCrypto`, you can obtain a reference to the [`CryptoApi`](https://matrix-org.github.io/matrix-js-sdk/interfaces/crypto_api.CryptoApi.html) interface, which is the main entry point for end-to-end encryption, by calling [`MatrixClient.getCrypto`](https://matrix-org.github.io/matrix-js-sdk/classes/matrix.MatrixClient.html#getCrypto).
327327

328+
**WARNING**: the cryptography stack is not thread-safe. Having multiple `MatrixClient` instances connected to the same Indexed DB will cause data corruption and decryption failures. The application layer is responsible for ensuring that only one `MatrixClient` issue is instantiated at a time.
329+
328330
## Secret storage
329331

330332
You should normally set up [secret storage](https://spec.matrix.org/v1.12/client-server-api/#secret-storage) before using the end-to-end encryption. To do this, call [`CryptoApi.bootstrapSecretStorage`](https://matrix-org.github.io/matrix-js-sdk/interfaces/crypto_api.CryptoApi.html#bootstrapSecretStorage).
@@ -396,10 +398,10 @@ Once the cross-signing is set up on one of your devices, you can verify another
396398

397399
## Migrating from the legacy crypto stack to Rust crypto
398400

399-
If your application previously used the legacy crypto stack, (i.e, it called `MatrixClient.initCrypto()`), you will
401+
If your application previously used the legacy crypto stack, (i.e, it called `MatrixClient.initLegacyCrypto()`), you will
400402
need to migrate existing devices to the Rust crypto stack.
401403

402-
This migration happens automatically when you call `initRustCrypto()` instead of `initCrypto()`,
404+
This migration happens automatically when you call `initRustCrypto()` instead of `initLegacyCrypto()`,
403405
but you need to provide the legacy [`cryptoStore`](https://matrix-org.github.io/matrix-js-sdk/interfaces/matrix.ICreateClientOpts.html#cryptoStore) and [`pickleKey`](https://matrix-org.github.io/matrix-js-sdk/interfaces/matrix.ICreateClientOpts.html#pickleKey) to [`createClient`](https://matrix-org.github.io/matrix-js-sdk/functions/matrix.createClient.html):
404406

405407
```javascript

examples/node/app.js

+9-15
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,14 @@ rl.on("line", function (line) {
9494
);
9595
} else if (line.indexOf("/file ") === 0) {
9696
var filename = line.split(" ")[1].trim();
97-
var stream = fs.createReadStream(filename);
98-
matrixClient
99-
.uploadContent({
100-
stream: stream,
101-
name: filename,
102-
})
103-
.then(function (url) {
104-
var content = {
105-
msgtype: MsgType.File,
106-
body: filename,
107-
url: JSON.parse(url).content_uri,
108-
};
109-
matrixClient.sendMessage(viewingRoom.roomId, content);
97+
let buffer = fs.readFileSync("./your_file_name");
98+
matrixClient.uploadContent(new Blob([buffer])).then(function (response) {
99+
matrixClient.sendMessage(viewingRoom.roomId, {
100+
msgtype: MsgType.File,
101+
body: filename,
102+
url: response.content_uri,
110103
});
104+
});
111105
} else {
112106
matrixClient.sendTextMessage(viewingRoom.roomId, line).finally(function () {
113107
printMessages();
@@ -167,7 +161,7 @@ matrixClient.on(RoomEvent.Timeline, function (event, room, toStartOfTimeline) {
167161
if (toStartOfTimeline) {
168162
return; // don't print paginated results
169163
}
170-
if (!viewingRoom || viewingRoom.roomId !== room.roomId) {
164+
if (!viewingRoom || viewingRoom.roomId !== room?.roomId) {
171165
return; // not viewing a room or viewing the wrong room.
172166
}
173167
printLine(event);
@@ -386,7 +380,7 @@ function print(str, formatter) {
386380
}
387381
console.log.apply(console.log, newArgs);
388382
} else {
389-
console.log.apply(console.log, arguments);
383+
console.log.apply(console.log, [...arguments]);
390384
}
391385
}
392386

examples/node/package.json

+7
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,12 @@
99
"dependencies": {
1010
"cli-color": "^1.0.0",
1111
"matrix-js-sdk": "^34.5.0"
12+
},
13+
"devDependencies": {
14+
"@types/cli-color": "^2.0.6",
15+
"typescript": "^5.6.2"
16+
},
17+
"engines": {
18+
"node": ">=20.0.0"
1219
}
1320
}

examples/node/tsconfig.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es2022",
4+
"module": "commonjs",
5+
"esModuleInterop": true,
6+
"noImplicitAny": false,
7+
"noEmit": true,
8+
"skipLibCheck": true,
9+
"allowJs": true,
10+
"checkJs": true,
11+
"strict": true
12+
},
13+
"include": ["app.js"]
14+
}

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "matrix-js-sdk",
3-
"version": "34.12.0",
3+
"version": "36.0.0",
44
"description": "Matrix Client-Server SDK for Javascript",
55
"engines": {
66
"node": ">=20.0.0"
@@ -50,7 +50,7 @@
5050
],
5151
"dependencies": {
5252
"@babel/runtime": "^7.12.5",
53-
"@matrix-org/matrix-sdk-crypto-wasm": "^9.0.0",
53+
"@matrix-org/matrix-sdk-crypto-wasm": "^12.1.0",
5454
"@matrix-org/olm": "3.2.15",
5555
"another-json": "^0.2.0",
5656
"bs58": "^6.0.0",
@@ -117,10 +117,10 @@
117117
"lint-staged": "^15.0.2",
118118
"matrix-mock-request": "^2.5.0",
119119
"node-fetch": "^2.7.0",
120-
"prettier": "3.4.1",
120+
"prettier": "3.4.2",
121121
"rimraf": "^6.0.0",
122122
"ts-node": "^10.9.2",
123-
"typedoc": "^0.26.0",
123+
"typedoc": "^0.27.0",
124124
"typedoc-plugin-coverage": "^3.0.0",
125125
"typedoc-plugin-mdn-links": "^4.0.0",
126126
"typedoc-plugin-missing-exports": "^3.0.0",

0 commit comments

Comments
 (0)