external_api: add command to set E2EE key

This commit is contained in:
Saúl Ibarra Corretgé
2020-04-16 20:25:56 +02:00
committed by Saúl Ibarra Corretgé
parent cb6fbb0f03
commit 33ebd241a9
2 changed files with 18 additions and 2 deletions
+13 -2
View File
@@ -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': {