1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Fix decryption of events whose key arrives later

Re-fixes https://github.com/vector-im/riot-web/issues/2273.

And test it this time.
This commit is contained in:
Richard van der Hoff
2017-02-09 16:12:43 +00:00
parent d471277031
commit e13ed6436e
2 changed files with 68 additions and 3 deletions

View File

@@ -595,22 +595,24 @@ MegolmDecryption.prototype._addEventToPendingList = function(event) {
MegolmDecryption.prototype.onRoomKeyEvent = function(event) {
console.log("Adding key from ", event);
const content = event.getContent();
const senderKey = event.getSenderKey();
if (!content.room_id ||
!content.session_id ||
!content.session_key
!content.session_key ||
!senderKey
) {
console.error("key event is missing fields");
return;
}
this._olmDevice.addInboundGroupSession(
content.room_id, event.getSenderKey(), content.session_id,
content.room_id, senderKey, content.session_id,
content.session_key, event.getKeysClaimed(),
);
// have another go at decrypting events sent with this session.
this._retryDecryption(event.getSenderKey, content.session_id);
this._retryDecryption(senderKey, content.session_id);
};