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

Client: add some logging to help understand what is going on

This commit is contained in:
Richard van der Hoff
2016-06-08 16:44:43 +01:00
parent 23a38ae8f2
commit 4bf24f0fe4

View File

@@ -692,9 +692,11 @@ MatrixClient.prototype.setRoomEncryption = function(roomId, config) {
} }
} }
if (oneTimeKey) { if (oneTimeKey) {
self._olmDevice.createOutboundSession( var sid = self._olmDevice.createOutboundSession(
device[2], oneTimeKey device[2], oneTimeKey
); );
console.log("Started new sessionid " + sid +
" for device " + device[2]);
} else { } else {
missing[device[0]] = missing[device[0]] || []; missing[device[0]] = missing[device[0]] || [];
missing[device[0]].push([device[1]]); missing[device[0]].push([device[1]]);
@@ -1182,6 +1184,7 @@ function _encryptMessage(client, roomId, e2eRoomInfo, eventType, content,
continue; continue;
} }
var sessionId = sessionIds[0]; var sessionId = sessionIds[0];
console.log("Using sessionid " + sessionId + " for device " + deviceKey);
ciphertext[deviceKey] = client._olmDevice.encryptMessage( ciphertext[deviceKey] = client._olmDevice.encryptMessage(
deviceKey, sessionId, payloadString deviceKey, sessionId, payloadString
); );
@@ -1226,6 +1229,7 @@ function _decryptMessage(client, event) {
); );
payloadString = res.payload; payloadString = res.payload;
if (payloadString) { if (payloadString) {
console.log("decrypted with sessionId " + sessionId);
break; break;
} }
@@ -1242,6 +1246,7 @@ function _decryptMessage(client, event) {
payloadString = client._olmDevice.createInboundSession( payloadString = client._olmDevice.createInboundSession(
deviceKey, message.type, message.body deviceKey, message.type, message.body
); );
console.log("created new inbound sesion");
} catch (e) { } catch (e) {
// Failed to decrypt with a new session. // Failed to decrypt with a new session.
} }