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