1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-07 05:22:15 +03:00

Add function to cancel and resend key request (#624)

This commit is contained in:
Luke Barnard
2018-03-08 15:01:01 +00:00
committed by GitHub
parent 0eb72122ce
commit 68b230a78f
4 changed files with 92 additions and 21 deletions

View File

@@ -378,6 +378,21 @@ utils.extend(module.exports.MatrixEvent.prototype, {
return this._decryptionPromise;
},
/**
* Cancel any room key request for this event and resend another.
*
* @param {module:crypto} crypto crypto module
*/
cancelAndResendKeyRequest: function(crypto) {
const wireContent = this.getWireContent();
crypto.cancelRoomKeyRequest({
algorithm: wireContent.algorithm,
room_id: this.getRoomId(),
session_id: wireContent.session_id,
sender_key: wireContent.sender_key,
}, true);
},
_decryptionLoop: async function(crypto) {
// make sure that this method never runs completely synchronously.
// (doing so would mean that we would clear _decryptionPromise *before*