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
Factor out a function for doing olm encryption
Make a library file with some constants and a function to pack olm-encrypted events (which we are going to use from megolm)
This commit is contained in:
@@ -24,10 +24,9 @@ limitations under the License.
|
||||
var q = require("q");
|
||||
|
||||
var utils = require("../utils");
|
||||
var olmlib = require("../olmlib");
|
||||
var base = require("./base");
|
||||
|
||||
var MEGOLM_ALGORITHM = "m.megolm.v1.aes-sha2";
|
||||
|
||||
/**
|
||||
* Megolm encryption implementation
|
||||
*
|
||||
@@ -114,7 +113,7 @@ MegolmEncryption.prototype.encryptMessage = function(room, eventType, content) {
|
||||
);
|
||||
|
||||
var encryptedContent = {
|
||||
algorithm: MEGOLM_ALGORITHM,
|
||||
algorithm: olmlib.MEGOLM_ALGORITHM,
|
||||
sender_key: self._olmDevice.deviceCurve25519Key,
|
||||
body: ciphertext,
|
||||
session_id: self._outboundSessionId,
|
||||
@@ -171,4 +170,6 @@ MegolmDecryption.prototype.decryptEvent = function(event) {
|
||||
}
|
||||
};
|
||||
|
||||
base.registerAlgorithm(MEGOLM_ALGORITHM, MegolmEncryption, MegolmDecryption);
|
||||
base.registerAlgorithm(
|
||||
olmlib.MEGOLM_ALGORITHM, MegolmEncryption, MegolmDecryption
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user