1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-01 04:43:29 +03:00

Support for exporting megolm session data

This commit is contained in:
Richard van der Hoff
2017-01-14 00:12:21 +00:00
parent 0fa9f7c609
commit 766d8f0ba4
5 changed files with 108 additions and 1 deletions

View File

@@ -897,6 +897,28 @@ Crypto.prototype.isRoomEncrypted = function(roomId) {
return Boolean(this._roomEncryptors[roomId]);
};
/**
* Get a list containing all of the room keys
*
* @return {module:client.Promise} a promise which resolves to a list of
* session export objects
*/
Crypto.prototype.exportRoomKeys = function() {
return q(
this._sessionStore.getAllEndToEndInboundGroupSessionKeys().map(
(s) => {
const sess = this._olmDevice.exportInboundGroupSession(
s.senderKey, s.sessionId
);
sess.algorithm = olmlib.MEGOLM_ALGORITHM;
return sess;
}
)
);
};
/**
* Encrypt an event according to the configuration of the room, if necessary.
*