Browse Source

fix(e2ee) discards frames that cannot be decrypted

dev1
tmoldovan8x8 2 years ago
parent
commit
c29de010e8
No account linked to committer's email address
1 changed files with 3 additions and 7 deletions
  1. 3
    7
      modules/e2ee/Context.js

+ 3
- 7
modules/e2ee/Context.js View File

@@ -191,10 +191,6 @@ export class Context {
191 191
 
192 192
             return controller.enqueue(decodedFrame);
193 193
         }
194
-
195
-        // TODO: this just passes through to the decoder. Is that ok? If we don't know the key yet
196
-        // we might want to buffer a bit but it is still unclear how to do that (and for how long etc).
197
-        controller.enqueue(encodedFrame);
198 194
     }
199 195
 
200 196
     /**
@@ -253,9 +249,11 @@ export class Context {
253 249
             newUint8.set(new Uint8Array(plainText), frameHeader.byteLength);
254 250
 
255 251
             encodedFrame.data = newData;
252
+
253
+            return encodedFrame;
256 254
         } catch (error) {
257 255
             if (this._sharedKey) {
258
-                return encodedFrame;
256
+                return;
259 257
             }
260 258
 
261 259
             if (ratchetCount < RATCHET_WINDOW_SIZE) {
@@ -284,8 +282,6 @@ export class Context {
284 282
 
285 283
             // TODO: notify the application about error status.
286 284
         }
287
-
288
-        return encodedFrame;
289 285
     }
290 286
 
291 287
 

Loading…
Cancel
Save