1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-09-01 21:21:58 +03:00

Enable crypto if olm is present

This commit is contained in:
Mark Haines
2015-07-23 10:03:20 +01:00
parent 58e44a2fc3
commit ea1c315aa8
2 changed files with 6 additions and 3 deletions

View File

@@ -20,8 +20,11 @@ var utils = require("./utils");
var CRYPTO_ENABLED = false; var CRYPTO_ENABLED = false;
if (CRYPTO_ENABLED) { try {
var Olm = require("olm"); var Olm = require("olm");
CRYPTO_ENABLED = true;
} catch (e) {
// Olm not installed.
} }
// TODO: // TODO:
@@ -1799,7 +1802,7 @@ MatrixClient.prototype.startClient = function(historyLen) {
return; return;
} }
if (this.sessionStore !== null) { if (CRYPTO_ENABLED && this.sessionStore !== null) {
this.uploadKeys(5); this.uploadKeys(5);
} }

View File

@@ -28,7 +28,7 @@ module.exports.MatrixScheduler = require("./scheduler");
* ebStorageSessionStore} class */ * ebStorageSessionStore} class */
module.exports.WebStorageSessionStore = require("./store/session/webstorage"); module.exports.WebStorageSessionStore = require("./store/session/webstorage");
/** */ /** */
module.exports.CRYPTO_ENABLED = require("./client").ENABLE_CRYPTO; module.exports.CRYPTO_ENABLED = require("./client").CRYPTO_ENABLED;
/** /**
* Create a new Matrix Call. * Create a new Matrix Call.