diff --git a/lib/src/e2ee.worker/e2ee.cryptor.dart b/lib/src/e2ee.worker/e2ee.cryptor.dart index e871317..576389b 100644 --- a/lib/src/e2ee.worker/e2ee.cryptor.dart +++ b/lib/src/e2ee.worker/e2ee.cryptor.dart @@ -5,9 +5,9 @@ import 'dart:js_util' as jsutil; import 'dart:math'; import 'dart:typed_data'; -import 'package:dart_webrtc/src/rtc_transform_stream.dart'; import 'package:web/web.dart' as web; +import 'package:dart_webrtc/src/rtc_transform_stream.dart'; import 'crypto.dart' as crypto; import 'e2ee.keyhandler.dart'; import 'e2ee.logger.dart'; diff --git a/lib/src/e2ee.worker/e2ee.worker.dart b/lib/src/e2ee.worker/e2ee.worker.dart index fac64b0..fce7f33 100644 --- a/lib/src/e2ee.worker/e2ee.worker.dart +++ b/lib/src/e2ee.worker/e2ee.worker.dart @@ -4,10 +4,10 @@ import 'dart:js_util' as js_util; import 'dart:typed_data'; import 'package:collection/collection.dart'; -import 'package:dart_webrtc/src/rtc_transform_stream.dart'; import 'package:logging/logging.dart'; import 'package:web/web.dart' as web; +import 'package:dart_webrtc/src/rtc_transform_stream.dart'; import 'e2ee.cryptor.dart'; import 'e2ee.keyhandler.dart'; import 'e2ee.logger.dart'; diff --git a/lib/src/factory_impl.dart b/lib/src/factory_impl.dart index 833f7a5..20bd9c2 100644 --- a/lib/src/factory_impl.dart +++ b/lib/src/factory_impl.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'dart:convert'; + import 'package:js/js.dart'; import 'package:js/js_util.dart'; import 'package:web/web.dart' as web; diff --git a/lib/src/frame_cryptor_impl.dart b/lib/src/frame_cryptor_impl.dart index db66d52..30b0e4c 100644 --- a/lib/src/frame_cryptor_impl.dart +++ b/lib/src/frame_cryptor_impl.dart @@ -6,11 +6,12 @@ import 'dart:js_util' as jsutil; import 'dart:typed_data'; import 'package:collection/collection.dart'; -import 'package:dart_webrtc/src/event.dart'; import 'package:js/js_util.dart'; import 'package:web/web.dart' as web; import 'package:webrtc_interface/webrtc_interface.dart'; +import 'package:dart_webrtc/src/e2ee.worker/e2ee.logger.dart'; +import 'package:dart_webrtc/src/event.dart'; import 'rtc_rtp_receiver_impl.dart'; import 'rtc_rtp_sender_impl.dart'; import 'rtc_transform_stream.dart'; @@ -191,6 +192,7 @@ class KeyProviderImpl implements KeyProvider { 'sharedKey': options.sharedKey, 'ratchetSalt': base64Encode(options.ratchetSalt), 'ratchetWindowSize': options.ratchetWindowSize, + 'failureTolerance': options.failureTolerance, if (options.uncryptedMagicBytes != null) 'uncryptedMagicBytes': base64Encode(options.uncryptedMagicBytes!), 'keyRingSize': options.keyRingSize, @@ -201,8 +203,11 @@ class KeyProviderImpl implements KeyProvider { ]); await events.waitFor( - filter: (event) => event.msgId == msgId, - duration: Duration(seconds: 5)); + filter: (event) { + logger.fine('waiting for init on msg: $msgId'); + return event.msgId == msgId; + }, + duration: Duration(seconds: 15)); } @override @@ -217,8 +222,11 @@ class KeyProviderImpl implements KeyProvider { ]); await events.waitFor( - filter: (event) => event.msgId == msgId, - duration: Duration(seconds: 5)); + filter: (event) { + logger.fine('waiting for dispose on msg: $msgId'); + return event.msgId == msgId; + }, + duration: Duration(seconds: 15)); _keys.clear(); } @@ -241,8 +249,12 @@ class KeyProviderImpl implements KeyProvider { ]); await events.waitFor( - filter: (event) => event.msgId == msgId, - duration: Duration(seconds: 5)); + filter: (event) { + logger.fine('waiting for setKey on msg: $msgId'); + return event.msgId == msgId; + }, + duration: Duration(minutes: 15), + ); _keys[participantId] ??= []; if (_keys[participantId]!.length <= index) { @@ -268,8 +280,11 @@ class KeyProviderImpl implements KeyProvider { ]); var res = await events.waitFor( - filter: (event) => event.msgId == msgId, - duration: Duration(seconds: 5)); + filter: (event) { + logger.fine('waiting for ratchetKey on msg: $msgId'); + return event.msgId == msgId; + }, + duration: Duration(seconds: 15)); return base64Decode(res.data['newKey']); } @@ -289,8 +304,11 @@ class KeyProviderImpl implements KeyProvider { ]); var res = await events.waitFor( - filter: (event) => event.msgId == msgId, - duration: Duration(seconds: 5)); + filter: (event) { + logger.fine('waiting for exportKey on msg: $msgId'); + return event.msgId == msgId; + }, + duration: Duration(seconds: 15)); return base64Decode(res.data['exportedKey']); } @@ -308,8 +326,11 @@ class KeyProviderImpl implements KeyProvider { ]); var res = await events.waitFor( - filter: (event) => event.msgId == msgId, - duration: Duration(seconds: 5)); + filter: (event) { + logger.fine('waiting for exportSharedKey on msg: $msgId'); + return event.msgId == msgId; + }, + duration: Duration(seconds: 15)); return base64Decode(res.data['exportedKey']); } @@ -326,8 +347,11 @@ class KeyProviderImpl implements KeyProvider { }) ]); var res = await events.waitFor( - filter: (event) => event.msgId == msgId, - duration: Duration(seconds: 5)); + filter: (event) { + logger.fine('waiting for ratchetSharedKey on msg: $msgId'); + return event.msgId == msgId; + }, + duration: Duration(seconds: 15)); return base64Decode(res.data['newKey']); } @@ -346,8 +370,11 @@ class KeyProviderImpl implements KeyProvider { ]); await events.waitFor( - filter: (event) => event.msgId == msgId, - duration: Duration(seconds: 5)); + filter: (event) { + logger.fine('waiting for setSharedKey on msg: $msgId'); + return event.msgId == msgId; + }, + duration: Duration(seconds: 15)); } @override @@ -363,8 +390,11 @@ class KeyProviderImpl implements KeyProvider { ]); await events.waitFor( - filter: (event) => event.msgId == msgId, - duration: Duration(seconds: 5)); + filter: (event) { + logger.fine('waiting for setSifTrailer on msg: $msgId'); + return event.msgId == msgId; + }, + duration: Duration(seconds: 15)); } } diff --git a/lib/src/media_recorder_impl.dart b/lib/src/media_recorder_impl.dart index 3a3c206..12decec 100644 --- a/lib/src/media_recorder_impl.dart +++ b/lib/src/media_recorder_impl.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'dart:js' as js; import 'dart:js_interop'; + import 'package:web/web.dart' as web; import 'package:webrtc_interface/webrtc_interface.dart'; diff --git a/lib/src/media_stream_impl.dart b/lib/src/media_stream_impl.dart index 55b15af..4f312d2 100644 --- a/lib/src/media_stream_impl.dart +++ b/lib/src/media_stream_impl.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'dart:js_interop'; + import 'package:web/web.dart' as web; import 'package:webrtc_interface/webrtc_interface.dart'; diff --git a/lib/src/mediadevices_impl.dart b/lib/src/mediadevices_impl.dart index a7d9192..f8511d2 100644 --- a/lib/src/mediadevices_impl.dart +++ b/lib/src/mediadevices_impl.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:js' as js; import 'dart:js_interop'; import 'dart:js_util' as jsutil; + import 'package:web/web.dart' as web; import 'package:webrtc_interface/webrtc_interface.dart'; diff --git a/lib/src/rtc_data_channel_impl.dart b/lib/src/rtc_data_channel_impl.dart index 08855f7..697d75c 100644 --- a/lib/src/rtc_data_channel_impl.dart +++ b/lib/src/rtc_data_channel_impl.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'dart:js_interop'; + import 'package:js/js_util.dart' as jsutil; import 'package:web/web.dart' as web; import 'package:webrtc_interface/webrtc_interface.dart'; diff --git a/lib/src/rtc_peerconnection_impl.dart b/lib/src/rtc_peerconnection_impl.dart index e4da6cf..6e41dbb 100644 --- a/lib/src/rtc_peerconnection_impl.dart +++ b/lib/src/rtc_peerconnection_impl.dart @@ -4,11 +4,11 @@ import 'dart:js_interop'; import 'dart:js_interop_unsafe'; import 'dart:js_util' as jsutil; -import 'package:dart_webrtc/dart_webrtc.dart'; import 'package:js/js_util.dart'; import 'package:platform_detect/platform_detect.dart'; import 'package:web/web.dart' as web; +import 'package:dart_webrtc/dart_webrtc.dart'; import 'media_stream_track_impl.dart'; import 'rtc_data_channel_impl.dart'; import 'rtc_dtmf_sender_impl.dart'; diff --git a/lib/src/rtc_rtp_capailities_imp.dart b/lib/src/rtc_rtp_capailities_imp.dart index 4174d70..9a21314 100644 --- a/lib/src/rtc_rtp_capailities_imp.dart +++ b/lib/src/rtc_rtp_capailities_imp.dart @@ -1,4 +1,5 @@ import 'dart:js_util' as jsutil; + import 'package:webrtc_interface/webrtc_interface.dart'; class RTCRtpCapabilitiesWeb { diff --git a/lib/src/rtc_rtp_parameters_impl.dart b/lib/src/rtc_rtp_parameters_impl.dart index 94405b5..e9ed0c2 100644 --- a/lib/src/rtc_rtp_parameters_impl.dart +++ b/lib/src/rtc_rtp_parameters_impl.dart @@ -1,4 +1,5 @@ import 'dart:js_util' as jsutil; + import 'package:webrtc_interface/webrtc_interface.dart'; class RTCRtpParametersWeb { diff --git a/lib/src/rtc_rtp_receiver_impl.dart b/lib/src/rtc_rtp_receiver_impl.dart index e3cc1a8..d2c8c64 100644 --- a/lib/src/rtc_rtp_receiver_impl.dart +++ b/lib/src/rtc_rtp_receiver_impl.dart @@ -1,4 +1,5 @@ import 'dart:js_util' as jsutil; + import 'package:web/web.dart' as web; import 'package:webrtc_interface/webrtc_interface.dart'; diff --git a/lib/src/rtc_rtp_sender_impl.dart b/lib/src/rtc_rtp_sender_impl.dart index b7d3b9c..643020e 100644 --- a/lib/src/rtc_rtp_sender_impl.dart +++ b/lib/src/rtc_rtp_sender_impl.dart @@ -1,10 +1,10 @@ import 'dart:async'; import 'dart:js_util' as jsutil; -import 'package:dart_webrtc/src/media_stream_impl.dart'; import 'package:web/web.dart' as web; import 'package:webrtc_interface/webrtc_interface.dart'; +import 'package:dart_webrtc/src/media_stream_impl.dart'; import 'media_stream_track_impl.dart'; import 'rtc_dtmf_sender_impl.dart'; import 'rtc_rtp_parameters_impl.dart'; diff --git a/lib/src/rtc_transform_stream.dart b/lib/src/rtc_transform_stream.dart index d2b1952..f185a4f 100644 --- a/lib/src/rtc_transform_stream.dart +++ b/lib/src/rtc_transform_stream.dart @@ -1,5 +1,6 @@ import 'dart:js_util' as js_util; import 'dart:typed_data'; + import 'package:js/js.dart'; import 'package:web/web.dart'; diff --git a/lib/src/rtc_video_element.dart b/lib/src/rtc_video_element.dart index 6901a97..04d7416 100644 --- a/lib/src/rtc_video_element.dart +++ b/lib/src/rtc_video_element.dart @@ -1,5 +1,7 @@ import 'dart:js_interop'; + import 'package:web/web.dart' as web; + import '../dart_webrtc.dart'; class RTCVideoElement {