Skip to content

Commit 85b34b4

Browse files
authored
Remove brokenheaded encryption test (#3070)
This test seemed to be testing the behaviour of decrypting redacted events, but that seems... strange. A redaction event cannot be encrypted (at least, there is no spec for it), and it should be impossible to decrypt a (correctly) redacted event, because such an event will lack a `ciphertext` property. This test is just sticking a "redacted_because" property into a regular event, which is a bit of a nonsense.
1 parent a34d06c commit 85b34b4

File tree

1 file changed

+0
-65
lines changed

1 file changed

+0
-65
lines changed

spec/integ/megolm-integ.spec.ts

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,71 +1160,6 @@ describe("megolm", () => {
11601160
expect(decryptedEvent.getClearContent()).toBeUndefined();
11611161
});
11621162

1163-
it("should successfully decrypt bundled redaction events that don't include a room_id in their /sync data", async () => {
1164-
await aliceTestClient.start();
1165-
aliceTestClient.client.crypto!.deviceList.downloadKeys = () => Promise.resolve({});
1166-
const p2pSession = await createOlmSession(testOlmAccount, aliceTestClient);
1167-
const groupSession = new Olm.OutboundGroupSession();
1168-
groupSession.create();
1169-
1170-
aliceTestClient.client.crypto!.deviceList.getUserByIdentityKey = () => "@bob:xyz";
1171-
1172-
// make the room_key event
1173-
const roomKeyEncrypted = encryptGroupSessionKey({
1174-
recipient: aliceTestClient,
1175-
olmAccount: testOlmAccount,
1176-
p2pSession: p2pSession,
1177-
groupSession: groupSession,
1178-
room_id: ROOM_ID,
1179-
});
1180-
1181-
// encrypt a message with the group session
1182-
const messageEncrypted = encryptMegolmEvent({
1183-
senderKey: testSenderKey,
1184-
groupSession: groupSession,
1185-
room_id: ROOM_ID,
1186-
});
1187-
1188-
const redactionEncrypted = encryptMegolmEvent({
1189-
senderKey: testSenderKey,
1190-
groupSession: groupSession,
1191-
plaintext: {
1192-
room_id: ROOM_ID,
1193-
type: "m.room.redaction",
1194-
redacts: messageEncrypted.event_id,
1195-
content: { reason: "redaction test" },
1196-
},
1197-
});
1198-
1199-
const messageEncryptedWithRedaction = {
1200-
...messageEncrypted,
1201-
unsigned: { redacted_because: redactionEncrypted },
1202-
};
1203-
1204-
const syncResponse = {
1205-
next_batch: 1,
1206-
to_device: {
1207-
events: [roomKeyEncrypted],
1208-
},
1209-
rooms: {
1210-
join: {
1211-
[ROOM_ID]: { timeline: { events: [messageEncryptedWithRedaction] } },
1212-
},
1213-
},
1214-
};
1215-
1216-
aliceTestClient.httpBackend.when("GET", "/sync").respond(200, syncResponse);
1217-
await aliceTestClient.flushSync();
1218-
1219-
const room = aliceTestClient.client.getRoom(ROOM_ID)!;
1220-
const event = room.getLiveTimeline().getEvents()[0];
1221-
expect(event.isEncrypted()).toBe(true);
1222-
await event.attemptDecryption(aliceTestClient.client.crypto!);
1223-
expect(event.getContent()).toEqual({});
1224-
const redactionEvent: any = event.getRedactionEvent();
1225-
expect(redactionEvent.content.reason).toEqual("redaction test");
1226-
});
1227-
12281163
it("Alice receives shared history before being invited to a room by the sharer", async () => {
12291164
const beccaTestClient = new TestClient("@becca:localhost", "foobar", "bazquux");
12301165
await beccaTestClient.client.initCrypto();

0 commit comments

Comments
 (0)