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
Use ciphertext instead of body in megolm events
Apparently `body` is going to be special.
This commit is contained in:
@@ -182,7 +182,7 @@ MegolmEncryption.prototype.encryptMessage = function(room, eventType, content) {
|
|||||||
var encryptedContent = {
|
var encryptedContent = {
|
||||||
algorithm: olmlib.MEGOLM_ALGORITHM,
|
algorithm: olmlib.MEGOLM_ALGORITHM,
|
||||||
sender_key: self._olmDevice.deviceCurve25519Key,
|
sender_key: self._olmDevice.deviceCurve25519Key,
|
||||||
body: ciphertext,
|
ciphertext: ciphertext,
|
||||||
session_id: session_id,
|
session_id: session_id,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -251,14 +251,14 @@ MegolmDecryption.prototype.decryptEvent = function(event) {
|
|||||||
content.session_id);
|
content.session_id);
|
||||||
|
|
||||||
if (!content.sender_key || !content.session_id ||
|
if (!content.sender_key || !content.session_id ||
|
||||||
!content.body
|
!content.ciphertext
|
||||||
) {
|
) {
|
||||||
throw new base.DecryptionError("Missing fields in input");
|
throw new base.DecryptionError("Missing fields in input");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var res = this._olmDevice.decryptGroupMessage(
|
var res = this._olmDevice.decryptGroupMessage(
|
||||||
event.room_id, content.sender_key, content.session_id, content.body
|
event.room_id, content.sender_key, content.session_id, content.ciphertext
|
||||||
);
|
);
|
||||||
return JSON.parse(res);
|
return JSON.parse(res);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user