Skip to content

Commit

Permalink
Project HPS, first pass
Browse files Browse the repository at this point in the history
  • Loading branch information
saghul committed Apr 10, 2020
1 parent 1751fc7 commit eef0f5e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions conference.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit eef0f5e

Please sign in to comment.