-
-
Notifications
You must be signed in to change notification settings - Fork 589
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Šimon Brandner <[email protected]>
- Loading branch information
1 parent
7cfbd0d
commit 14cd37e
Showing
2 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,7 @@ import {IllegalMethod} from "./verification/IllegalMethod"; | |
import {KeySignatureUploadError} from "../errors"; | ||
import {decryptAES, encryptAES} from './aes'; | ||
import {DehydrationManager} from './dehydration'; | ||
import { MatrixEvent } from "../models/event"; | ||
|
||
const DeviceVerification = DeviceInfo.DeviceVerification; | ||
|
||
|
@@ -3028,19 +3029,28 @@ Crypto.prototype.encryptEvent = async function(event, room) { | |
* finished decrypting. Rejects with an `algorithms.DecryptionError` if there | ||
* is a problem decrypting the event. | ||
*/ | ||
Crypto.prototype.decryptEvent = function(event) { | ||
Crypto.prototype.decryptEvent = async function(event) { | ||
if (event.isRedacted()) { | ||
return Promise.resolve({ | ||
const redactionEvent = new MatrixEvent(event.getUnsigned().redacted_because); | ||
const content = redactionEvent.getWireContent(); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
SimonBrandner
Author
Contributor
|
||
const alg = this._getRoomDecryptor(event.getRoomId(), content.algorithm); | ||
const decryptedEvent = await alg.decryptEvent(redactionEvent); | ||
|
||
return { | ||
clearEvent: { | ||
room_id: event.getRoomId(), | ||
type: "m.room.message", | ||
content: {}, | ||
unsigned: { | ||
redacted_because: decryptedEvent.clearEvent, | ||
}, | ||
}, | ||
}); | ||
}; | ||
} else { | ||
const content = event.getWireContent(); | ||
const alg = this._getRoomDecryptor(event.getRoomId(), content.algorithm); | ||
return await alg.decryptEvent(event); | ||
} | ||
const content = event.getWireContent(); | ||
const alg = this._getRoomDecryptor(event.getRoomId(), content.algorithm); | ||
return alg.decryptEvent(event); | ||
}; | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Is it possible that redacted event is not encrypted at this point?