|
@@ -43,17 +43,20 @@ export class E2EEncryption {
|
43
|
43
|
// Participant join / leave operations. Used for key advancement / rotation.
|
44
|
44
|
//
|
45
|
45
|
|
|
46
|
+ this.conference.on(
|
|
47
|
+ JitsiConferenceEvents.CONFERENCE_JOINED,
|
|
48
|
+ () => {
|
|
49
|
+ this._conferenceJoined = true;
|
|
50
|
+ });
|
|
51
|
+ this.conference.on(
|
|
52
|
+ JitsiConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
|
|
53
|
+ this._onParticipantPropertyChanged.bind(this));
|
46
|
54
|
this.conference.on(
|
47
|
55
|
JitsiConferenceEvents.USER_JOINED,
|
48
|
56
|
this._onParticipantJoined.bind(this));
|
49
|
57
|
this.conference.on(
|
50
|
58
|
JitsiConferenceEvents.USER_LEFT,
|
51
|
59
|
this._onParticipantLeft.bind(this));
|
52
|
|
- this.conference.on(
|
53
|
|
- JitsiConferenceEvents.CONFERENCE_JOINED,
|
54
|
|
- () => {
|
55
|
|
- this._conferenceJoined = true;
|
56
|
|
- });
|
57
|
60
|
|
58
|
61
|
// Conference media events in order to attach the encryptor / decryptor.
|
59
|
62
|
// FIXME add events to TraceablePeerConnection which will allow to see when there's new receiver or sender
|
|
@@ -74,6 +77,9 @@ export class E2EEncryption {
|
74
|
77
|
this._trackMuteChanged.bind(this));
|
75
|
78
|
|
76
|
79
|
// Olm signalling events.
|
|
80
|
+ this._olmAdapter.on(
|
|
81
|
+ OlmAdapter.events.OLM_ID_KEY_READY,
|
|
82
|
+ this._onOlmIdKeyReady.bind(this));
|
77
|
83
|
this._olmAdapter.on(
|
78
|
84
|
OlmAdapter.events.PARTICIPANT_E2EE_CHANNEL_READY,
|
79
|
85
|
this._onParticipantE2EEChannelReady.bind(this));
|
|
@@ -170,6 +176,17 @@ export class E2EEncryption {
|
170
|
176
|
}
|
171
|
177
|
}
|
172
|
178
|
|
|
179
|
+ /**
|
|
180
|
+ * Publushes our own Olmn id key in presence.
|
|
181
|
+ * @private
|
|
182
|
+ */
|
|
183
|
+ _onOlmIdKeyReady(idKey) {
|
|
184
|
+ logger.debug(`Olm id key ready: ${idKey}`);
|
|
185
|
+
|
|
186
|
+ // Publish it in presence.
|
|
187
|
+ this.conference.setLocalParticipantProperty('e2ee.idKey', idKey);
|
|
188
|
+ }
|
|
189
|
+
|
173
|
190
|
/**
|
174
|
191
|
* Advances (using ratcheting) the current key when a new participant joins the conference.
|
175
|
192
|
* @private
|
|
@@ -218,6 +235,23 @@ export class E2EEncryption {
|
218
|
235
|
this._e2eeCtx.setKey(id, key, index);
|
219
|
236
|
}
|
220
|
237
|
|
|
238
|
+ /**
|
|
239
|
+ * Handles an update in a participant's presence property.
|
|
240
|
+ *
|
|
241
|
+ * @param {JitsiParticipant} participant - The participant.
|
|
242
|
+ * @param {string} name - The name of the property that changed.
|
|
243
|
+ * @param {*} oldValue - The property's previous value.
|
|
244
|
+ * @param {*} newValue - The property's new value.
|
|
245
|
+ * @private
|
|
246
|
+ */
|
|
247
|
+ _onParticipantPropertyChanged(participant, name, oldValue, newValue) {
|
|
248
|
+ switch (name) {
|
|
249
|
+ case 'e2ee.idKey':
|
|
250
|
+ logger.debug(`Participant ${participant.getId()} updated their id key: ${newValue}`);
|
|
251
|
+ break;
|
|
252
|
+ }
|
|
253
|
+ }
|
|
254
|
+
|
221
|
255
|
/**
|
222
|
256
|
* Advances the current key by using ratcheting.
|
223
|
257
|
*
|