Skip to content

Commit

Permalink
Merge branch 'develop' into renovate/fake-indexeddb-6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Jun 11, 2024
2 parents 000aea0 + f95954c commit 9289989
Show file tree
Hide file tree
Showing 30 changed files with 2,922 additions and 747 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
Changes in [33.0.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v33.0.0) (2024-06-04)
==================================================================================================
## 🚨 BREAKING CHANGES

* Remove more deprecated methods, fields, and exports ([#4217](https://github.com/matrix-org/matrix-js-sdk/pull/4217)). Contributed by @t3chguy.
* Remove deprecated methods and fields ([#4201](https://github.com/matrix-org/matrix-js-sdk/pull/4201)). Contributed by @t3chguy.

## 🦖 Deprecations

* Remove more deprecated methods, fields, and exports ([#4217](https://github.com/matrix-org/matrix-js-sdk/pull/4217)). Contributed by @t3chguy.
* Remove deprecated methods and fields ([#4201](https://github.com/matrix-org/matrix-js-sdk/pull/4201)). Contributed by @t3chguy.

## ✨ Features

* `initRustCrypto`: allow app to pass in the store key directly ([#4210](https://github.com/matrix-org/matrix-js-sdk/pull/4210)). Contributed by @richvdh.
* Preserve ESM for async imports to work correctly ([#4187](https://github.com/matrix-org/matrix-js-sdk/pull/4187)). Contributed by @ms-dosx86.

## 🐛 Bug Fixes

* Don't run migration for Rust crypto if the legacy store is empty ([#4218](https://github.com/matrix-org/matrix-js-sdk/pull/4218)). Contributed by @andybalaam.
* Bump matrix-sdk-crypto-wasm to 5.0.0 ([#4216](https://github.com/matrix-org/matrix-js-sdk/pull/4216)). Contributed by @richvdh.
* Wire up verification cancel \& mismatch for rust crypto ([#4202](https://github.com/matrix-org/matrix-js-sdk/pull/4202)). Contributed by @t3chguy.
* Only pass id\_server if we had one to begin with ([#4200](https://github.com/matrix-org/matrix-js-sdk/pull/4200)). Contributed by @t3chguy.


Changes in [32.4.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v32.4.0) (2024-05-22)
==================================================================================================
* No changes
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "matrix-js-sdk",
"version": "32.4.0",
"version": "33.0.0",
"description": "Matrix Client-Server SDK for Javascript",
"engines": {
"node": ">=18.0.0"
Expand Down Expand Up @@ -105,7 +105,7 @@
"eslint-plugin-jest": "^28.0.0",
"eslint-plugin-jsdoc": "^48.0.0",
"eslint-plugin-matrix-org": "^1.0.0",
"eslint-plugin-tsdoc": "^0.2.17",
"eslint-plugin-tsdoc": "^0.3.0",
"eslint-plugin-unicorn": "^53.0.0",
"fake-indexeddb": "^6.0.0",
"fetch-mock": "9.11.0",
Expand All @@ -119,7 +119,7 @@
"lint-staged": "^15.0.2",
"matrix-mock-request": "^2.5.0",
"node-fetch": "^2.7.0",
"prettier": "3.2.5",
"prettier": "3.3.0",
"rimraf": "^5.0.0",
"ts-node": "^10.9.2",
"typedoc": "^0.25.10",
Expand Down
68 changes: 68 additions & 0 deletions spec/integ/crypto/crypto.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,27 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("crypto (%s)", (backend: string,
expect(ev.decryptionFailureReason).toEqual(DecryptionFailureCode.HISTORICAL_MESSAGE_USER_NOT_JOINED);
});

newBackendOnly(

Check failure on line 633 in spec/integ/crypto/crypto.spec.ts

View workflow job for this annotation

GitHub Actions / Jest [integ] (Node 18)

crypto (rust-sdk) › Unable to decrypt error codes › Historical events › fails with NOT_JOINED if user is not member of room (MSC4115 unstable prefix)

thrown: "Exceeded timeout of 5000 ms for a test. Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout." at newBackendOnly (spec/integ/crypto/crypto.spec.ts:633:13) at describe (spec/integ/crypto/crypto.spec.ts:536:9) at describe (spec/integ/crypto/crypto.spec.ts:472:5) at Array.forEach (<anonymous>) at Object.<anonymous> (spec/integ/crypto/crypto.spec.ts:218:47)

Check failure on line 633 in spec/integ/crypto/crypto.spec.ts

View workflow job for this annotation

GitHub Actions / Jest [integ] (Node lts/*)

crypto (rust-sdk) › Unable to decrypt error codes › Historical events › fails with NOT_JOINED if user is not member of room (MSC4115 unstable prefix)

thrown: "Exceeded timeout of 5000 ms for a test. Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout." at newBackendOnly (spec/integ/crypto/crypto.spec.ts:633:13) at describe (spec/integ/crypto/crypto.spec.ts:536:9) at describe (spec/integ/crypto/crypto.spec.ts:472:5) at Array.forEach (<anonymous>) at Object.<anonymous> (spec/integ/crypto/crypto.spec.ts:218:47)

Check failure on line 633 in spec/integ/crypto/crypto.spec.ts

View workflow job for this annotation

GitHub Actions / Jest [integ] (Node 21)

crypto (rust-sdk) › Unable to decrypt error codes › Historical events › fails with NOT_JOINED if user is not member of room (MSC4115 unstable prefix)

thrown: "Exceeded timeout of 5000 ms for a test. Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout." at newBackendOnly (spec/integ/crypto/crypto.spec.ts:633:13) at describe (spec/integ/crypto/crypto.spec.ts:536:9) at describe (spec/integ/crypto/crypto.spec.ts:472:5) at Array.forEach (<anonymous>) at Object.<anonymous> (spec/integ/crypto/crypto.spec.ts:218:47)
"fails with NOT_JOINED if user is not member of room (MSC4115 unstable prefix)",
async () => {
fetchMock.get("path:/_matrix/client/v3/room_keys/version", {
status: 404,
body: { errcode: "M_NOT_FOUND", error: "No current backup version." },
});
expectAliceKeyQuery({ device_keys: { "@alice:localhost": {} }, failures: {} });
await startClientAndAwaitFirstSync();

const ev = await sendEventAndAwaitDecryption({
unsigned: {
[UNSIGNED_MEMBERSHIP_FIELD.altName!]: "leave",
},
});
expect(ev.decryptionFailureReason).toEqual(
DecryptionFailureCode.HISTORICAL_MESSAGE_USER_NOT_JOINED,
);
},
);

newBackendOnly(

Check failure on line 654 in spec/integ/crypto/crypto.spec.ts

View workflow job for this annotation

GitHub Actions / Jest [integ] (Node 18)

crypto (rust-sdk) › Unable to decrypt error codes › Historical events › fails with another error when the server reports user was a member of the room

thrown: "Exceeded timeout of 5000 ms for a test. Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout." at newBackendOnly (spec/integ/crypto/crypto.spec.ts:654:13) at describe (spec/integ/crypto/crypto.spec.ts:536:9) at describe (spec/integ/crypto/crypto.spec.ts:472:5) at Array.forEach (<anonymous>) at Object.<anonymous> (spec/integ/crypto/crypto.spec.ts:218:47)

Check failure on line 654 in spec/integ/crypto/crypto.spec.ts

View workflow job for this annotation

GitHub Actions / Jest [integ] (Node lts/*)

crypto (rust-sdk) › Unable to decrypt error codes › Historical events › fails with another error when the server reports user was a member of the room

thrown: "Exceeded timeout of 5000 ms for a test. Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout." at newBackendOnly (spec/integ/crypto/crypto.spec.ts:654:13) at describe (spec/integ/crypto/crypto.spec.ts:536:9) at describe (spec/integ/crypto/crypto.spec.ts:472:5) at Array.forEach (<anonymous>) at Object.<anonymous> (spec/integ/crypto/crypto.spec.ts:218:47)

Check failure on line 654 in spec/integ/crypto/crypto.spec.ts

View workflow job for this annotation

GitHub Actions / Jest [integ] (Node 21)

crypto (rust-sdk) › Unable to decrypt error codes › Historical events › fails with another error when the server reports user was a member of the room

thrown: "Exceeded timeout of 5000 ms for a test. Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout." at newBackendOnly (spec/integ/crypto/crypto.spec.ts:654:13) at describe (spec/integ/crypto/crypto.spec.ts:536:9) at describe (spec/integ/crypto/crypto.spec.ts:472:5) at Array.forEach (<anonymous>) at Object.<anonymous> (spec/integ/crypto/crypto.spec.ts:218:47)
"fails with another error when the server reports user was a member of the room",
async () => {
Expand All @@ -654,6 +675,30 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("crypto (%s)", (backend: string,
},
);

newBackendOnly(
"fails with another error when the server reports user was a member of the room (MSC4115 unstable prefix)",
async () => {
// This tests that when the server reports that the user
// was invited at the time the event was sent, then we
// don't get a HISTORICAL_MESSAGE_USER_NOT_JOINED error,
// and instead get some other error, since the user should
// have gotten the key for the event.
fetchMock.get("path:/_matrix/client/v3/room_keys/version", {
status: 404,
body: { errcode: "M_NOT_FOUND", error: "No current backup version." },
});
expectAliceKeyQuery({ device_keys: { "@alice:localhost": {} }, failures: {} });
await startClientAndAwaitFirstSync();

const ev = await sendEventAndAwaitDecryption({
unsigned: {
[UNSIGNED_MEMBERSHIP_FIELD.altName!]: "invite",
},
});
expect(ev.decryptionFailureReason).toEqual(DecryptionFailureCode.HISTORICAL_MESSAGE_NO_KEY_BACKUP);
},
);

newBackendOnly(
"fails with another error when the server reports user was a member of the room",
async () => {
Expand All @@ -676,6 +721,29 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("crypto (%s)", (backend: string,
expect(ev.decryptionFailureReason).toEqual(DecryptionFailureCode.HISTORICAL_MESSAGE_NO_KEY_BACKUP);
},
);

newBackendOnly(
"fails with another error when the server reports user was a member of the room (MSC4115 unstable prefix)",
async () => {
// This tests that when the server reports the user's
// membership, and reports that the user was joined, then we
// don't get a HISTORICAL_MESSAGE_USER_NOT_JOINED error, and
// instead get some other error.
fetchMock.get("path:/_matrix/client/v3/room_keys/version", {
status: 404,
body: { errcode: "M_NOT_FOUND", error: "No current backup version." },
});
expectAliceKeyQuery({ device_keys: { "@alice:localhost": {} }, failures: {} });
await startClientAndAwaitFirstSync();

const ev = await sendEventAndAwaitDecryption({
unsigned: {
[UNSIGNED_MEMBERSHIP_FIELD.altName!]: "join",
},
});
expect(ev.decryptionFailureReason).toEqual(DecryptionFailureCode.HISTORICAL_MESSAGE_NO_KEY_BACKUP);
},
);
});

it("Decryption fails with Unable to decrypt for other errors", async () => {
Expand Down
Loading

0 comments on commit 9289989

Please sign in to comment.