Bladeren bron

bugfix(e2ee): frees olm session and rotates key when remote participant disabled e2ee

dev1
tmoldovan8x8 4 jaren geleden
bovenliggende
commit
49c4e75f37
No account linked to committer's email address
2 gewijzigde bestanden met toevoegingen van 21 en 6 verwijderingen
  1. 7
    0
      modules/e2ee/E2EEncryption.js
  2. 14
    6
      modules/e2ee/OlmAdapter.js

+ 7
- 0
modules/e2ee/E2EEncryption.js Bestand weergeven

@@ -263,6 +263,13 @@ export class E2EEncryption {
263 263
         case 'e2ee.idKey':
264 264
             logger.debug(`Participant ${participant.getId()} updated their id key: ${newValue}`);
265 265
             break;
266
+        case 'e2ee.enabled':
267
+            if (!newValue && this._enabled) {
268
+                this._olmAdapter.clearParticipantSession(participant);
269
+
270
+                this._rotateKey();
271
+            }
272
+            break;
266 273
         }
267 274
     }
268 275
 

+ 14
- 6
modules/e2ee/OlmAdapter.js Bestand weergeven

@@ -185,6 +185,19 @@ export class OlmAdapter extends Listenable {
185 185
         return this._keyIndex;
186 186
     }
187 187
 
188
+    /**
189
+     * Frees the olmData session for the given participant.
190
+     *
191
+     */
192
+    clearParticipantSession(participant) {
193
+        const olmData = this._getParticipantOlmData(participant);
194
+
195
+        if (olmData.session) {
196
+            olmData.session.free();
197
+            olmData.session = undefined;
198
+        }
199
+    }
200
+
188 201
     /**
189 202
      * Internal helper to bootstrap the olm library.
190 203
      *
@@ -440,12 +453,7 @@ export class OlmAdapter extends Listenable {
440 453
     _onParticipantLeft(id, participant) {
441 454
         logger.debug(`Participant ${id} left`);
442 455
 
443
-        const olmData = this._getParticipantOlmData(participant);
444
-
445
-        if (olmData.session) {
446
-            olmData.session.free();
447
-            olmData.session = undefined;
448
-        }
456
+        this.clearParticipantSession(participant);
449 457
     }
450 458
 
451 459
     /**

Laden…
Annuleren
Opslaan