From 5d1df494818f4f785400d17dc3b69e5ee205382e Mon Sep 17 00:00:00 2001 From: Timo Date: Mon, 16 Dec 2024 20:15:04 +0100 Subject: [PATCH] remove code we do not need yet. --- spec/unit/matrixrtc/MatrixRTCSession.spec.ts | 86 -------------------- src/matrixrtc/MatrixRTCSession.ts | 25 ------ 2 files changed, 111 deletions(-) diff --git a/spec/unit/matrixrtc/MatrixRTCSession.spec.ts b/spec/unit/matrixrtc/MatrixRTCSession.spec.ts index 861801a76c..5791e29cdd 100644 --- a/spec/unit/matrixrtc/MatrixRTCSession.spec.ts +++ b/spec/unit/matrixrtc/MatrixRTCSession.spec.ts @@ -950,92 +950,6 @@ describe("MatrixRTCSession", () => { } }); - it("re-sends key if a member changes membership ID", async () => { - return "membershipID is not a thing anymore"; - /* - jest.useFakeTimers(); - try { - const keysSentPromise1 = new Promise((resolve) => { - sendEventMock.mockImplementation(resolve); - }); - - const member1 = membershipTemplate; - const member2 = { - ...membershipTemplate, - device_id: "BBBBBBB", - }; - - const mockRoom = makeMockRoom([member1, member2]); - mockRoom.getLiveTimeline().getState = jest - .fn() - .mockReturnValue(makeMockRoomState([member1, member2], mockRoom.roomId)); - - sess = MatrixRTCSession.roomSessionForRoom(client, mockRoom); - sess.joinRoomSession([mockFocus], mockFocus, { manageMediaKeys: true }); - - await keysSentPromise1; - - // make sure an encryption key was sent - expect(sendEventMock).toHaveBeenCalledWith( - expect.stringMatching(".*"), - "io.element.call.encryption_keys", - { - call_id: "", - device_id: "AAAAAAA", - keys: [ - { - index: 0, - key: expect.stringMatching(".*"), - }, - ], - sent_ts: Date.now(), - }, - ); - expect(sess!.statistics.counters.roomEventEncryptionKeysSent).toEqual(1); - - sendEventMock.mockClear(); - - // this should be a no-op: - sess.onMembershipUpdate(); - expect(sendEventMock).toHaveBeenCalledTimes(0); - - // advance time to avoid key throttling - jest.advanceTimersByTime(10000); - - // update membership ID - member2.membershipID = "newID"; - - const keysSentPromise2 = new Promise((resolve) => { - sendEventMock.mockImplementation(resolve); - }); - - // this should re-send the key - sess.onMembershipUpdate(); - - await keysSentPromise2; - - expect(sendEventMock).toHaveBeenCalledWith( - expect.stringMatching(".*"), - "io.element.call.encryption_keys", - { - call_id: "", - device_id: "AAAAAAA", - keys: [ - { - index: 0, - key: expect.stringMatching(".*"), - }, - ], - sent_ts: Date.now(), - }, - ); - expect(sess!.statistics.counters.roomEventEncryptionKeysSent).toEqual(2); - } finally { - jest.useRealTimers(); - } - */ - }); - it("re-sends key if a member changes created_ts", async () => { jest.useFakeTimers(); jest.setSystemTime(1000); diff --git a/src/matrixrtc/MatrixRTCSession.ts b/src/matrixrtc/MatrixRTCSession.ts index 884860c7c2..525fe50628 100644 --- a/src/matrixrtc/MatrixRTCSession.ts +++ b/src/matrixrtc/MatrixRTCSession.ts @@ -911,31 +911,6 @@ export class MatrixRTCSession extends TypedEventEmitter