You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-29 16:43:09 +03:00
support for unpacking megolm keys
This is incredibly hacky at the moment, pending the arrival of ephemeral events, but it kinda works.
This commit is contained in:
@@ -700,6 +700,26 @@ Crypto.prototype.decryptEvent = function(event) {
|
||||
return alg.decryptEvent(event);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Handle a key event
|
||||
*
|
||||
* @param {module:modules/event~MatrixEvent} event key event
|
||||
*/
|
||||
Crypto.prototype.onRoomKeyEvent = function(event) {
|
||||
var content = event.getContent();
|
||||
var AlgClass = algorithms.DECRYPTION_CLASSES[content.algorithm];
|
||||
if (!AlgClass) {
|
||||
throw new algorithms.DecryptionError(
|
||||
"Unable to handle keys for " + content.algorithm
|
||||
);
|
||||
}
|
||||
var alg = new AlgClass({
|
||||
olmDevice: this._olmDevice,
|
||||
});
|
||||
alg.onRoomKeyEvent(event);
|
||||
};
|
||||
|
||||
/**
|
||||
* @see module:crypto-algorithms/base.DecryptionError
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user