Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

external_api: add command to set E2EE key

Saúl Ibarra Corretgé33ebd241a993
diff --git a/modules/API/API.js b/modules/API/API.js
index cd7b87f9ee..a37199b3cc 100644
--- a/modules/API/API.js
+++ b/modules/API/API.js
@@ -11,6 +11,7 @@ import {
setSubject
} from '../../react/features/base/conference';
import { parseJWTFromURLParams } from '../../react/features/base/jwt';
+import { setE2EEKey } from '../../react/features/e2ee';
import { invite } from '../../react/features/invite';
import { toggleTileView } from '../../react/features/video-layout';
import { getJitsiMeetTransport } from '../transport';
@@ -166,6 +167,10 @@ function initCommands() {
} catch (err) {
logger.error('Failed sending endpoint text message', err);
}
+ },
+ 'e2ee-key': key => {
+ logger.debug('Set E2EE key command received');
+ APP.store.dispatch(setE2EEKey(key));
}
};
transport.on('event', ({ data, name }) => {
diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.js
index c0c956627d..c0d3a8cdb9 100644
--- a/modules/API/external/external_api.js
+++ b/modules/API/external/external_api.js
@@ -29,6 +29,7 @@ const ALWAYS_ON_TOP_FILENAMES = [
const commands = {
avatarUrl: 'avatar-url',
displayName: 'display-name',
+ e2eeKey: 'e2ee-key',
email: 'email',
hangup: 'video-hangup',
password: 'password',
@@ -236,6 +237,8 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
* information about the initial devices that will be used in the call.
* @param {Object} [options.userInfo] - Object containing information about
* the participant opening the meeting.
+ * @param {string} [options.e2eeKey] - The key used for End-to-End encryption.
+ * THIS IS EXPERIMENTAL.
*/
constructor(domain, ...args) {
super();
@@ -251,7 +254,8 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
onload = undefined,
invitees,
devices,
- userInfo
+ userInfo,
+ e2eeKey
} = parseArguments(args);
this._parentNode = parentNode;
@@ -276,6 +280,7 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
if (Array.isArray(invitees) && invitees.length > 0) {
this.invite(invitees);
}
+ this._tmpE2EEKey = e2eeKey;
this._isLargeVideoVisible = true;
this._numberOfParticipants = 0;
this._participants = {};
@@ -429,11 +434,17 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
const userID = data.id;
switch (name) {
- case 'video-conference-joined':
+ case 'video-conference-joined': {
+ if (typeof this._tmpE2EEKey !== 'undefined') {
+ this.executeCommand(commands.e2eeKey, this._tmpE2EEKey);
+ this._tmpE2EEKey = undefined;
+ }
+
this._myUserID = userID;
this._participants[userID] = {
avatarURL: data.avatarURL
};
+ }
// eslint-disable-next-line no-fallthrough
case 'participant-joined': {