diff --git a/static/js/mediastream/api.js b/static/js/mediastream/api.js index 945a8fcf..dac6ff2b 100644 --- a/static/js/mediastream/api.js +++ b/static/js/mediastream/api.js @@ -29,13 +29,7 @@ define(['jquery', 'underscore', 'ua-parser'], function($, _, uaparser) { this.sid = null; this.session = {}; this.connector = connector; - if (!endToEndEncryption.initialize(this)) { - console.warn("Encryption services failed to initialize"); - this.endToEndEncryption = null; - } else { - console.log("Encryption services initialized"); - this.endToEndEncryption = endToEndEncryption; - } + this.endToEndEncryption = endToEndEncryption.initialize(this); this.iids= 0; var ua = uaparser(); diff --git a/static/js/services/endtoendencryption.js b/static/js/services/endtoendencryption.js index b0d2a479..cb11e638 100644 --- a/static/js/services/endtoendencryption.js +++ b/static/js/services/endtoendencryption.js @@ -668,14 +668,16 @@ define([ var endToEndEncryptionApi = { "initialize": function(api) { if (endToEndEncryption) { - return true; + return endToEndEncryption; } endToEndEncryption = new EndToEndEncryption(api); if (!endToEndEncryption.isSupported()) { + console.warn("EndToEnd encryption services not supported"); endToEndEncryption = null; - return false; + return null; } - return true; + console.log("EndToEnd encryption services initialized"); + return endToEndEncryption; }, "encrypt": function(peer, type, message, callback) { if (!endToEndEncryption) {