Explorar el Código

Project HPS, first pass

master
Saúl Ibarra Corretgé hace 5 años
padre
commit
eef0f5ed97
Se han modificado 1 ficheros con 32 adiciones y 0 borrados
  1. 32
    0
      conference.js

+ 32
- 0
conference.js Ver fichero

@@ -470,6 +470,11 @@ export default {
470 470
      */
471 471
     localVideo: null,
472 472
 
473
+    /**
474
+     * The key used for End-To-End Encryption.
475
+     */
476
+    e2eeKey: undefined,
477
+
473 478
     /**
474 479
      * Creates local media tracks and connects to a room. Will show error
475 480
      * dialogs in case accessing the local microphone and/or camera failed. Will
@@ -645,6 +650,8 @@ export default {
645 650
     init(options) {
646 651
         this.roomName = options.roomName;
647 652
 
653
+        window.addEventListener('hashchange', this.onHashChange.bind(this), false);
654
+
648 655
         return (
649 656
 
650 657
             // Initialize the device list first. This way, when creating tracks
@@ -1177,6 +1184,31 @@ export default {
1177 1184
         }));
1178 1185
     },
1179 1186
 
1187
+    /**
1188
+     * Handled location hash change events.
1189
+     */
1190
+    onHashChange() {
1191
+        const items = {};
1192
+        const parts = window.location.hash.substr(1).split('&');
1193
+
1194
+        for (const part of parts) {
1195
+            const param = part.split('=');
1196
+            const key = param[0];
1197
+
1198
+            if (!key) {
1199
+                continue; // eslint-disable-line no-continue
1200
+            }
1201
+
1202
+            items[key] = param[1];
1203
+        }
1204
+
1205
+        this.e2eeKey = items.e2eekey;
1206
+
1207
+        logger.debug(`New E2EE key: ${this.e2eeKey}`);
1208
+
1209
+        this._room.setE2EEKey(this.e2eeKey);
1210
+    },
1211
+
1180 1212
     /**
1181 1213
      * Exposes a Command(s) API on this instance. It is necessitated by (1) the
1182 1214
      * desire to keep room private to this instance and (2) the need of other

Loading…
Cancelar
Guardar