diff --git a/package.json b/package.json index f1168c0e..59864d80 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", 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(); 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"