From a98ae4f6ed0285f32ca1175722b43c29a12bdf41 Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Tue, 11 Jun 2024 16:15:58 +0100 Subject: [PATCH 1/3] Update matrix-sdk-crypto-nodejs to 0.2.0-beta.1 --- package.json | 5 +++-- yarn.lock | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index f1168c0e..616c1183 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "tsconfig.json" ], "dependencies": { - "@matrix-org/matrix-sdk-crypto-nodejs": "0.1.0-beta.11", + "@matrix-org/matrix-sdk-crypto-nodejs": "0.2.0-beta.1", "@types/express": "^4.17.21", "another-json": "^0.2.0", "async-lock": "^1.4.0", @@ -110,5 +110,6 @@ "testMatch": [ "/test/**/*Test.ts" ] - } + }, + "packageManager": "yarn@1.22.19+sha512.ff4579ab459bb25aa7c0ff75b62acebe576f6084b36aa842971cf250a5d8c6cd3bc9420b22ce63c7f93a0857bc6ef29291db39c3e7a23aab5adfd5a4dd6c5d71" } diff --git a/yarn.lock b/yarn.lock index 093247ad..ea115257 100644 --- a/yarn.lock +++ b/yarn.lock @@ -654,10 +654,10 @@ dependencies: lodash "^4.17.21" -"@matrix-org/matrix-sdk-crypto-nodejs@0.1.0-beta.11": - version "0.1.0-beta.11" - resolved "https://registry.yarnpkg.com/@matrix-org/matrix-sdk-crypto-nodejs/-/matrix-sdk-crypto-nodejs-0.1.0-beta.11.tgz#537cd7a7bbce1d9745b812a5a7ffa9a5944e146c" - integrity sha512-z5adcQo4o0UAry4zs6JHGxbTDlYTUMKUfpOpigmso65ETBDumbeTSQCWRw8UeUV7aCAyVoHARqDTol9SrauEFA== +"@matrix-org/matrix-sdk-crypto-nodejs@0.2.0-beta.1": + version "0.2.0-beta.1" + resolved "https://registry.yarnpkg.com/@matrix-org/matrix-sdk-crypto-nodejs/-/matrix-sdk-crypto-nodejs-0.2.0-beta.1.tgz#b696707ccfa944cfed3c96cf7e54799b0f1e3329" + integrity sha512-CgbOKORfD6dvYgQTPhfN73H1RbQknrFkMnRRwCIJMt15iL2AF1gEowgbrlGhkbG6gNng4CgPnKs1iHKCRrhvmA== dependencies: https-proxy-agent "^5.0.1" node-downloader-helper "^2.1.5" From 724e2030904a1e69d40654f3bd2b9db2449532d2 Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Tue, 11 Jun 2024 17:17:46 +0100 Subject: [PATCH 2/3] Adjust URLs for backup test and timeouts --- test/TestUtils.ts | 4 ++-- test/encryption/KeyBackupTest.ts | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/TestUtils.ts b/test/TestUtils.ts index e8d2cfa3..df748d64 100644 --- a/test/TestUtils.ts +++ b/test/TestUtils.ts @@ -62,7 +62,7 @@ export async function testCryptoStores(fn: (StoreType) => Promise): Promis } export function bindNullEngine(http: HttpBackend) { - http.when("POST", "/keys/upload").respond(200, (path, obj) => { + http.when("POST", "/_matrix/client/v3/keys/upload").respond(200, (path, obj) => { expect(obj).toMatchObject({ }); @@ -78,7 +78,7 @@ export function bindNullEngine(http: HttpBackend) { } export function bindNullQuery(http: HttpBackend) { - http.when("POST", "/keys/query").respond(200, (path, obj) => { + http.when("POST", "/_matrix/client/v3/keys/query").respond(200, (path, obj) => { return {}; }); } diff --git a/test/encryption/KeyBackupTest.ts b/test/encryption/KeyBackupTest.ts index 100a8d8e..210cb971 100644 --- a/test/encryption/KeyBackupTest.ts +++ b/test/encryption/KeyBackupTest.ts @@ -22,7 +22,7 @@ describe('KeyBackups', () => { bindNullEngine(http); await Promise.all([ client.crypto.prepare(), - http.flushAllExpected(), + http.flushAllExpected({ timeout: 5000 }), ]); }; @@ -81,7 +81,7 @@ describe('KeyBackups', () => { let keyBackupInfoOnServer: IKeyBackupInfoRetrieved|undefined; - http.when("POST", "/room_keys/version").respond(200, (path, obj: IKeyBackupInfo) => { + http.when("POST", "/_matrix/client/v3/room_keys/version").respond(200, (path, obj: IKeyBackupInfo) => { expect(obj.auth_data.signatures[USER_ID]).toHaveProperty(`ed25519:${TEST_DEVICE_ID}`); keyBackupInfoOnServer = { @@ -93,7 +93,7 @@ describe('KeyBackups', () => { return keyBackupInfoOnServer.version; }); - http.when("GET", "/room_keys/version").respond(200, (path, obj) => { + http.when("GET", "/_matrix/client/v3/room_keys/version").respond(200, (path, obj) => { expect(keyBackupInfoOnServer).toBeDefined(); expect(keyBackupInfoOnServer.version).toBe("1"); @@ -110,7 +110,7 @@ describe('KeyBackups', () => { })(), http.flushAllExpected(), ]); - })); + }), 10000); it('should fail to enable backups when the crypto has not been prepared', () => testCryptoStores(async (cryptoStoreType) => { try { @@ -179,7 +179,7 @@ describe('KeyBackups', () => { const encryptRoomEvent = async () => { bindNullQuery(http); - const encryptPromise = client.crypto.encryptRoomEvent(roomId, "m.room.message", "my message"); + const encryptPromise = client.crypto.encryptRoomEvent(roomId, "m.room.message", { body: "my message" }); await http.flushAllExpected({ timeout: 10000 }); // This is because encryptRoomEvent calls "/keys/query" after encrypting too. @@ -224,7 +224,7 @@ describe('KeyBackups', () => { }; const expectToPutRoomKey = () => { - http.when("PUT", "/room_keys/keys").respond(200, onBackupRequest); + http.when("PUT", "/_matrix/client/v3/room_keys/keys").respond(200, onBackupRequest); }; expectToPutRoomKey(); From 34b96a75994d37504a2fca44c15bcbbd08ddb2f0 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Wed, 12 Jun 2024 09:36:27 +0100 Subject: [PATCH 3/3] drop packageManager --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 616c1183..59864d80 100644 --- a/package.json +++ b/package.json @@ -110,6 +110,5 @@ "testMatch": [ "/test/**/*Test.ts" ] - }, - "packageManager": "yarn@1.22.19+sha512.ff4579ab459bb25aa7c0ff75b62acebe576f6084b36aa842971cf250a5d8c6cd3bc9420b22ce63c7f93a0857bc6ef29291db39c3e7a23aab5adfd5a4dd6c5d71" + } }