@@ -6,11 +6,12 @@ import 'dart:js_util' as jsutil;
6
6
import 'dart:typed_data' ;
7
7
8
8
import 'package:collection/collection.dart' ;
9
- import 'package:dart_webrtc/src/event.dart' ;
10
9
import 'package:js/js_util.dart' ;
11
10
import 'package:web/web.dart' as web;
12
11
import 'package:webrtc_interface/webrtc_interface.dart' ;
13
12
13
+ import 'package:dart_webrtc/src/e2ee.worker/e2ee.logger.dart' ;
14
+ import 'package:dart_webrtc/src/event.dart' ;
14
15
import 'rtc_rtp_receiver_impl.dart' ;
15
16
import 'rtc_rtp_sender_impl.dart' ;
16
17
import 'rtc_transform_stream.dart' ;
@@ -191,6 +192,7 @@ class KeyProviderImpl implements KeyProvider {
191
192
'sharedKey' : options.sharedKey,
192
193
'ratchetSalt' : base64Encode (options.ratchetSalt),
193
194
'ratchetWindowSize' : options.ratchetWindowSize,
195
+ 'failureTolerance' : options.failureTolerance,
194
196
if (options.uncryptedMagicBytes != null )
195
197
'uncryptedMagicBytes' : base64Encode (options.uncryptedMagicBytes! ),
196
198
'keyRingSize' : options.keyRingSize,
@@ -201,8 +203,11 @@ class KeyProviderImpl implements KeyProvider {
201
203
]);
202
204
203
205
await events.waitFor <WorkerResponse >(
204
- filter: (event) => event.msgId == msgId,
205
- duration: Duration (seconds: 5 ));
206
+ filter: (event) {
207
+ logger.fine ('waiting for init on msg: $msgId ' );
208
+ return event.msgId == msgId;
209
+ },
210
+ duration: Duration (seconds: 15 ));
206
211
}
207
212
208
213
@override
@@ -217,8 +222,11 @@ class KeyProviderImpl implements KeyProvider {
217
222
]);
218
223
219
224
await events.waitFor <WorkerResponse >(
220
- filter: (event) => event.msgId == msgId,
221
- duration: Duration (seconds: 5 ));
225
+ filter: (event) {
226
+ logger.fine ('waiting for dispose on msg: $msgId ' );
227
+ return event.msgId == msgId;
228
+ },
229
+ duration: Duration (seconds: 15 ));
222
230
223
231
_keys.clear ();
224
232
}
@@ -241,8 +249,12 @@ class KeyProviderImpl implements KeyProvider {
241
249
]);
242
250
243
251
await events.waitFor <WorkerResponse >(
244
- filter: (event) => event.msgId == msgId,
245
- duration: Duration (seconds: 5 ));
252
+ filter: (event) {
253
+ logger.fine ('waiting for setKey on msg: $msgId ' );
254
+ return event.msgId == msgId;
255
+ },
256
+ duration: Duration (minutes: 15 ),
257
+ );
246
258
247
259
_keys[participantId] ?? = [];
248
260
if (_keys[participantId]! .length <= index) {
@@ -268,8 +280,11 @@ class KeyProviderImpl implements KeyProvider {
268
280
]);
269
281
270
282
var res = await events.waitFor <WorkerResponse >(
271
- filter: (event) => event.msgId == msgId,
272
- duration: Duration (seconds: 5 ));
283
+ filter: (event) {
284
+ logger.fine ('waiting for ratchetKey on msg: $msgId ' );
285
+ return event.msgId == msgId;
286
+ },
287
+ duration: Duration (seconds: 15 ));
273
288
274
289
return base64Decode (res.data['newKey' ]);
275
290
}
@@ -289,8 +304,11 @@ class KeyProviderImpl implements KeyProvider {
289
304
]);
290
305
291
306
var res = await events.waitFor <WorkerResponse >(
292
- filter: (event) => event.msgId == msgId,
293
- duration: Duration (seconds: 5 ));
307
+ filter: (event) {
308
+ logger.fine ('waiting for exportKey on msg: $msgId ' );
309
+ return event.msgId == msgId;
310
+ },
311
+ duration: Duration (seconds: 15 ));
294
312
295
313
return base64Decode (res.data['exportedKey' ]);
296
314
}
@@ -308,8 +326,11 @@ class KeyProviderImpl implements KeyProvider {
308
326
]);
309
327
310
328
var res = await events.waitFor <WorkerResponse >(
311
- filter: (event) => event.msgId == msgId,
312
- duration: Duration (seconds: 5 ));
329
+ filter: (event) {
330
+ logger.fine ('waiting for exportSharedKey on msg: $msgId ' );
331
+ return event.msgId == msgId;
332
+ },
333
+ duration: Duration (seconds: 15 ));
313
334
314
335
return base64Decode (res.data['exportedKey' ]);
315
336
}
@@ -326,8 +347,11 @@ class KeyProviderImpl implements KeyProvider {
326
347
})
327
348
]);
328
349
var res = await events.waitFor <WorkerResponse >(
329
- filter: (event) => event.msgId == msgId,
330
- duration: Duration (seconds: 5 ));
350
+ filter: (event) {
351
+ logger.fine ('waiting for ratchetSharedKey on msg: $msgId ' );
352
+ return event.msgId == msgId;
353
+ },
354
+ duration: Duration (seconds: 15 ));
331
355
332
356
return base64Decode (res.data['newKey' ]);
333
357
}
@@ -346,8 +370,11 @@ class KeyProviderImpl implements KeyProvider {
346
370
]);
347
371
348
372
await events.waitFor <WorkerResponse >(
349
- filter: (event) => event.msgId == msgId,
350
- duration: Duration (seconds: 5 ));
373
+ filter: (event) {
374
+ logger.fine ('waiting for setSharedKey on msg: $msgId ' );
375
+ return event.msgId == msgId;
376
+ },
377
+ duration: Duration (seconds: 15 ));
351
378
}
352
379
353
380
@override
@@ -363,8 +390,11 @@ class KeyProviderImpl implements KeyProvider {
363
390
]);
364
391
365
392
await events.waitFor <WorkerResponse >(
366
- filter: (event) => event.msgId == msgId,
367
- duration: Duration (seconds: 5 ));
393
+ filter: (event) {
394
+ logger.fine ('waiting for setSifTrailer on msg: $msgId ' );
395
+ return event.msgId == msgId;
396
+ },
397
+ duration: Duration (seconds: 15 ));
368
398
}
369
399
}
370
400
0 commit comments