1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Olm session creation async

This commit is contained in:
Richard van der Hoff
2017-08-10 15:01:56 +01:00
parent 7d2bc12bb7
commit e52985e082
3 changed files with 4 additions and 4 deletions

View File

@@ -305,7 +305,7 @@ OlmDevice.prototype.generateOneTimeKeys = async function(numKeys) {
* @param {string} theirOneTimeKey remote user's one-time Curve25519 key * @param {string} theirOneTimeKey remote user's one-time Curve25519 key
* @return {string} sessionId for the outbound session. * @return {string} sessionId for the outbound session.
*/ */
OlmDevice.prototype.createOutboundSession = function( OlmDevice.prototype.createOutboundSession = async function(
theirIdentityKey, theirOneTimeKey, theirIdentityKey, theirOneTimeKey,
) { ) {
const self = this; const self = this;
@@ -335,7 +335,7 @@ OlmDevice.prototype.createOutboundSession = function(
* @raises {Error} if the received message was not valid (for instance, it * @raises {Error} if the received message was not valid (for instance, it
* didn't use a valid one-time key). * didn't use a valid one-time key).
*/ */
OlmDevice.prototype.createInboundSession = function( OlmDevice.prototype.createInboundSession = async function(
theirDeviceIdentityKey, message_type, ciphertext, theirDeviceIdentityKey, message_type, ciphertext,
) { ) {
if (message_type !== 0) { if (message_type !== 0) {

View File

@@ -298,7 +298,7 @@ OlmDecryption.prototype._decryptMessage = async function(
let res; let res;
try { try {
res = this._olmDevice.createInboundSession( res = await this._olmDevice.createInboundSession(
theirDeviceIdentityKey, message.type, message.body, theirDeviceIdentityKey, message.type, message.body,
); );
} catch (e) { } catch (e) {

View File

@@ -228,7 +228,7 @@ async function _verifyKeyAndStartSession(olmDevice, oneTimeKey, userId, deviceIn
let sid; let sid;
try { try {
sid = olmDevice.createOutboundSession( sid = await olmDevice.createOutboundSession(
deviceInfo.getIdentityKey(), oneTimeKey.key, deviceInfo.getIdentityKey(), oneTimeKey.key,
); );
} catch (e) { } catch (e) {