You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-09 10:22:46 +03:00
Element-R: silence log errors when viewing a decryption failure (#3821)
This commit is contained in:
committed by
GitHub
parent
6e2ac03f7e
commit
12e479a93e
@@ -505,6 +505,26 @@ describe("RustCrypto", () => {
|
||||
expect(olmMachine.getRoomEventEncryptionInfo).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should handle decryption failures", async () => {
|
||||
const event = mkEvent({
|
||||
event: true,
|
||||
type: "m.room.encrypted",
|
||||
content: { algorithm: "fake_alg" },
|
||||
room: "!room:id",
|
||||
});
|
||||
event.event.event_id = "$event:id";
|
||||
const mockCryptoBackend = {
|
||||
decryptEvent: () => {
|
||||
throw new Error("UISI");
|
||||
},
|
||||
};
|
||||
await event.attemptDecryption(mockCryptoBackend as unknown as CryptoBackend);
|
||||
|
||||
const res = await rustCrypto.getEncryptionInfoForEvent(event);
|
||||
expect(res).toBe(null);
|
||||
expect(olmMachine.getRoomEventEncryptionInfo).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("passes the event into the OlmMachine", async () => {
|
||||
const encryptedEvent = await makeEncryptedEvent();
|
||||
const res = await rustCrypto.getEncryptionInfoForEvent(encryptedEvent);
|
||||
|
Reference in New Issue
Block a user