瀏覽代碼

external_api: add command to set E2EE key

efficient_tiling
Saúl Ibarra Corretgé 5 年之前
父節點
當前提交
33ebd241a9
共有 2 個檔案被更改,包括 18 行新增2 行删除
  1. 5
    0
      modules/API/API.js
  2. 13
    2
      modules/API/external/external_api.js

+ 5
- 0
modules/API/API.js 查看文件

11
     setSubject
11
     setSubject
12
 } from '../../react/features/base/conference';
12
 } from '../../react/features/base/conference';
13
 import { parseJWTFromURLParams } from '../../react/features/base/jwt';
13
 import { parseJWTFromURLParams } from '../../react/features/base/jwt';
14
+import { setE2EEKey } from '../../react/features/e2ee';
14
 import { invite } from '../../react/features/invite';
15
 import { invite } from '../../react/features/invite';
15
 import { toggleTileView } from '../../react/features/video-layout';
16
 import { toggleTileView } from '../../react/features/video-layout';
16
 import { getJitsiMeetTransport } from '../transport';
17
 import { getJitsiMeetTransport } from '../transport';
166
             } catch (err) {
167
             } catch (err) {
167
                 logger.error('Failed sending endpoint text message', err);
168
                 logger.error('Failed sending endpoint text message', err);
168
             }
169
             }
170
+        },
171
+        'e2ee-key': key => {
172
+            logger.debug('Set E2EE key command received');
173
+            APP.store.dispatch(setE2EEKey(key));
169
         }
174
         }
170
     };
175
     };
171
     transport.on('event', ({ data, name }) => {
176
     transport.on('event', ({ data, name }) => {

+ 13
- 2
modules/API/external/external_api.js 查看文件

29
 const commands = {
29
 const commands = {
30
     avatarUrl: 'avatar-url',
30
     avatarUrl: 'avatar-url',
31
     displayName: 'display-name',
31
     displayName: 'display-name',
32
+    e2eeKey: 'e2ee-key',
32
     email: 'email',
33
     email: 'email',
33
     hangup: 'video-hangup',
34
     hangup: 'video-hangup',
34
     password: 'password',
35
     password: 'password',
236
      * information about the initial devices that will be used in the call.
237
      * information about the initial devices that will be used in the call.
237
      * @param {Object} [options.userInfo] - Object containing information about
238
      * @param {Object} [options.userInfo] - Object containing information about
238
      * the participant opening the meeting.
239
      * the participant opening the meeting.
240
+     * @param {string}  [options.e2eeKey] - The key used for End-to-End encryption.
241
+     * THIS IS EXPERIMENTAL.
239
      */
242
      */
240
     constructor(domain, ...args) {
243
     constructor(domain, ...args) {
241
         super();
244
         super();
251
             onload = undefined,
254
             onload = undefined,
252
             invitees,
255
             invitees,
253
             devices,
256
             devices,
254
-            userInfo
257
+            userInfo,
258
+            e2eeKey
255
         } = parseArguments(args);
259
         } = parseArguments(args);
256
 
260
 
257
         this._parentNode = parentNode;
261
         this._parentNode = parentNode;
276
         if (Array.isArray(invitees) && invitees.length > 0) {
280
         if (Array.isArray(invitees) && invitees.length > 0) {
277
             this.invite(invitees);
281
             this.invite(invitees);
278
         }
282
         }
283
+        this._tmpE2EEKey = e2eeKey;
279
         this._isLargeVideoVisible = true;
284
         this._isLargeVideoVisible = true;
280
         this._numberOfParticipants = 0;
285
         this._numberOfParticipants = 0;
281
         this._participants = {};
286
         this._participants = {};
429
             const userID = data.id;
434
             const userID = data.id;
430
 
435
 
431
             switch (name) {
436
             switch (name) {
432
-            case 'video-conference-joined':
437
+            case 'video-conference-joined': {
438
+                if (typeof this._tmpE2EEKey !== 'undefined') {
439
+                    this.executeCommand(commands.e2eeKey, this._tmpE2EEKey);
440
+                    this._tmpE2EEKey = undefined;
441
+                }
442
+
433
                 this._myUserID = userID;
443
                 this._myUserID = userID;
434
                 this._participants[userID] = {
444
                 this._participants[userID] = {
435
                     avatarURL: data.avatarURL
445
                     avatarURL: data.avatarURL
436
                 };
446
                 };
447
+            }
437
 
448
 
438
             // eslint-disable-next-line no-fallthrough
449
             // eslint-disable-next-line no-fallthrough
439
             case 'participant-joined': {
450
             case 'participant-joined': {

Loading…
取消
儲存