From eef0f5ed976cd53c4e4d28e4506c41565c921882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Tue, 7 Apr 2020 14:14:47 +0200 Subject: [PATCH] Project HPS, first pass --- conference.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/conference.js b/conference.js index c45c7d0d6..f453fb233 100644 --- a/conference.js +++ b/conference.js @@ -470,6 +470,11 @@ export default { */ localVideo: null, + /** + * The key used for End-To-End Encryption. + */ + e2eeKey: undefined, + /** * Creates local media tracks and connects to a room. Will show error * dialogs in case accessing the local microphone and/or camera failed. Will @@ -645,6 +650,8 @@ export default { init(options) { this.roomName = options.roomName; + window.addEventListener('hashchange', this.onHashChange.bind(this), false); + return ( // Initialize the device list first. This way, when creating tracks @@ -1177,6 +1184,31 @@ export default { })); }, + /** + * Handled location hash change events. + */ + onHashChange() { + const items = {}; + const parts = window.location.hash.substr(1).split('&'); + + for (const part of parts) { + const param = part.split('='); + const key = param[0]; + + if (!key) { + continue; // eslint-disable-line no-continue + } + + items[key] = param[1]; + } + + this.e2eeKey = items.e2eekey; + + logger.debug(`New E2EE key: ${this.e2eeKey}`); + + this._room.setE2EEKey(this.e2eeKey); + }, + /** * Exposes a Command(s) API on this instance. It is necessitated by (1) the * desire to keep room private to this instance and (2) the need of other