1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Make encryption asynchronous

We're going to need to send out a load of messages to distribute the megolm
keys; as a first step, deal with the asynchronicity this will require.
This commit is contained in:
Richard van der Hoff
2016-08-17 18:18:20 +01:00
parent e0bd05a8c4
commit 32fa51818b
8 changed files with 105 additions and 63 deletions

View File

@@ -20,6 +20,7 @@ limitations under the License.
*
* @module crypto-algorithms/olm
*/
var q = require('q');
var utils = require("../utils");
@@ -60,7 +61,7 @@ OlmEncryption.prototype.initRoomEncryption = function(roomMembers) {
* @param {string} eventType
* @param {object} plaintext event content
*
* @return {object} new event body
* @return {module:client.Promise} Promise which resolves to the new event body
*/
OlmEncryption.prototype.encryptMessage = function(room, eventType, content) {
if (!room) {
@@ -128,7 +129,7 @@ OlmEncryption.prototype.encryptMessage = function(room, eventType, content) {
sender_key: this._olmDevice.deviceCurve25519Key,
ciphertext: ciphertext
};
return encryptedContent;
return q(encryptedContent);
};
/**