@abrar71/lib-jitsi-meet 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +26 -0
- package/dist/esm/JitsiConference.js +3692 -0
- package/dist/esm/JitsiConference.js.map +1 -0
- package/dist/esm/JitsiConferenceErrors.js +126 -0
- package/dist/esm/JitsiConferenceErrors.js.map +1 -0
- package/dist/esm/JitsiConferenceEventManager.js +424 -0
- package/dist/esm/JitsiConferenceEventManager.js.map +1 -0
- package/dist/esm/JitsiConferenceEvents.js +431 -0
- package/dist/esm/JitsiConferenceEvents.js.map +1 -0
- package/dist/esm/JitsiConnection.js +187 -0
- package/dist/esm/JitsiConnection.js.map +1 -0
- package/dist/esm/JitsiConnectionErrors.js +52 -0
- package/dist/esm/JitsiConnectionErrors.js.map +1 -0
- package/dist/esm/JitsiConnectionEvents.js +57 -0
- package/dist/esm/JitsiConnectionEvents.js.map +1 -0
- package/dist/esm/JitsiMediaDevices.js +221 -0
- package/dist/esm/JitsiMediaDevices.js.map +1 -0
- package/dist/esm/JitsiMediaDevicesEvents.js +29 -0
- package/dist/esm/JitsiMediaDevicesEvents.js.map +1 -0
- package/dist/esm/JitsiMeetJS.js +499 -0
- package/dist/esm/JitsiMeetJS.js.map +1 -0
- package/dist/esm/JitsiParticipant.js +323 -0
- package/dist/esm/JitsiParticipant.js.map +1 -0
- package/dist/esm/JitsiTrackError.js +122 -0
- package/dist/esm/JitsiTrackError.js.map +1 -0
- package/dist/esm/JitsiTrackErrors.js +91 -0
- package/dist/esm/JitsiTrackErrors.js.map +1 -0
- package/dist/esm/JitsiTrackEvents.js +60 -0
- package/dist/esm/JitsiTrackEvents.js.map +1 -0
- package/dist/esm/JitsiTranscriptionStatus.js +15 -0
- package/dist/esm/JitsiTranscriptionStatus.js.map +1 -0
- package/dist/esm/modules/RTC/BridgeChannel.js +398 -0
- package/dist/esm/modules/RTC/BridgeChannel.js.map +1 -0
- package/dist/esm/modules/RTC/JitsiLocalTrack.js +896 -0
- package/dist/esm/modules/RTC/JitsiLocalTrack.js.map +1 -0
- package/dist/esm/modules/RTC/JitsiRemoteTrack.js +427 -0
- package/dist/esm/modules/RTC/JitsiRemoteTrack.js.map +1 -0
- package/dist/esm/modules/RTC/JitsiTrack.js +453 -0
- package/dist/esm/modules/RTC/JitsiTrack.js.map +1 -0
- package/dist/esm/modules/RTC/MockClasses.js +388 -0
- package/dist/esm/modules/RTC/MockClasses.js.map +1 -0
- package/dist/esm/modules/RTC/RTC.js +658 -0
- package/dist/esm/modules/RTC/RTC.js.map +1 -0
- package/dist/esm/modules/RTC/RTCUtils.js +762 -0
- package/dist/esm/modules/RTC/RTCUtils.js.map +1 -0
- package/dist/esm/modules/RTC/ScreenObtainer.js +380 -0
- package/dist/esm/modules/RTC/ScreenObtainer.js.map +1 -0
- package/dist/esm/modules/RTC/TPCUtils.js +803 -0
- package/dist/esm/modules/RTC/TPCUtils.js.map +1 -0
- package/dist/esm/modules/RTC/TraceablePeerConnection.js +2223 -0
- package/dist/esm/modules/RTC/TraceablePeerConnection.js.map +1 -0
- package/dist/esm/modules/RTCStats/DefaulLogStorage.js +35 -0
- package/dist/esm/modules/RTCStats/DefaulLogStorage.js.map +1 -0
- package/dist/esm/modules/RTCStats/RTCStats.js +219 -0
- package/dist/esm/modules/RTCStats/RTCStats.js.map +1 -0
- package/dist/esm/modules/RTCStats/RTCStatsEvents.js +92 -0
- package/dist/esm/modules/RTCStats/RTCStatsEvents.js.map +1 -0
- package/dist/esm/modules/RTCStats/interfaces.js +2 -0
- package/dist/esm/modules/RTCStats/interfaces.js.map +1 -0
- package/dist/esm/modules/browser/BrowserCapabilities.js +345 -0
- package/dist/esm/modules/browser/BrowserCapabilities.js.map +1 -0
- package/dist/esm/modules/browser/index.js +3 -0
- package/dist/esm/modules/browser/index.js.map +1 -0
- package/dist/esm/modules/connectivity/ConnectionQuality.js +389 -0
- package/dist/esm/modules/connectivity/ConnectionQuality.js.map +1 -0
- package/dist/esm/modules/connectivity/IceFailedHandling.js +84 -0
- package/dist/esm/modules/connectivity/IceFailedHandling.js.map +1 -0
- package/dist/esm/modules/connectivity/NetworkInfo.js +49 -0
- package/dist/esm/modules/connectivity/NetworkInfo.js.map +1 -0
- package/dist/esm/modules/connectivity/TrackStreamingStatus.js +453 -0
- package/dist/esm/modules/connectivity/TrackStreamingStatus.js.map +1 -0
- package/dist/esm/modules/detection/ActiveDeviceDetector.js +79 -0
- package/dist/esm/modules/detection/ActiveDeviceDetector.js.map +1 -0
- package/dist/esm/modules/detection/DetectionEvents.js +58 -0
- package/dist/esm/modules/detection/DetectionEvents.js.map +1 -0
- package/dist/esm/modules/detection/NoAudioSignalDetection.js +127 -0
- package/dist/esm/modules/detection/NoAudioSignalDetection.js.map +1 -0
- package/dist/esm/modules/detection/P2PDominantSpeakerDetection.js +47 -0
- package/dist/esm/modules/detection/P2PDominantSpeakerDetection.js.map +1 -0
- package/dist/esm/modules/detection/TrackVADEmitter.js +190 -0
- package/dist/esm/modules/detection/TrackVADEmitter.js.map +1 -0
- package/dist/esm/modules/detection/VADAudioAnalyser.js +199 -0
- package/dist/esm/modules/detection/VADAudioAnalyser.js.map +1 -0
- package/dist/esm/modules/detection/VADNoiseDetection.js +168 -0
- package/dist/esm/modules/detection/VADNoiseDetection.js.map +1 -0
- package/dist/esm/modules/detection/VADReportingService.js +203 -0
- package/dist/esm/modules/detection/VADReportingService.js.map +1 -0
- package/dist/esm/modules/detection/VADTalkMutedDetection.js +131 -0
- package/dist/esm/modules/detection/VADTalkMutedDetection.js.map +1 -0
- package/dist/esm/modules/e2ee/Context.js +274 -0
- package/dist/esm/modules/e2ee/Context.js.map +1 -0
- package/dist/esm/modules/e2ee/E2EEContext.js +158 -0
- package/dist/esm/modules/e2ee/E2EEContext.js.map +1 -0
- package/dist/esm/modules/e2ee/E2EEErrors.js +10 -0
- package/dist/esm/modules/e2ee/E2EEErrors.js.map +1 -0
- package/dist/esm/modules/e2ee/E2EEncryption.js +87 -0
- package/dist/esm/modules/e2ee/E2EEncryption.js.map +1 -0
- package/dist/esm/modules/e2ee/ExternallyManagedKeyHandler.js +24 -0
- package/dist/esm/modules/e2ee/ExternallyManagedKeyHandler.js.map +1 -0
- package/dist/esm/modules/e2ee/KeyHandler.js +137 -0
- package/dist/esm/modules/e2ee/KeyHandler.js.map +1 -0
- package/dist/esm/modules/e2ee/ManagedKeyHandler.js +182 -0
- package/dist/esm/modules/e2ee/ManagedKeyHandler.js.map +1 -0
- package/dist/esm/modules/e2ee/OlmAdapter.js +860 -0
- package/dist/esm/modules/e2ee/OlmAdapter.js.map +1 -0
- package/dist/esm/modules/e2ee/SAS.js +128 -0
- package/dist/esm/modules/e2ee/SAS.js.map +1 -0
- package/dist/esm/modules/e2ee/Worker.js +102 -0
- package/dist/esm/modules/e2ee/Worker.js.map +1 -0
- package/dist/esm/modules/e2ee/crypto-utils.js +53 -0
- package/dist/esm/modules/e2ee/crypto-utils.js.map +1 -0
- package/dist/esm/modules/e2ee/utils.js +15 -0
- package/dist/esm/modules/e2ee/utils.js.map +1 -0
- package/dist/esm/modules/e2eping/e2eping.js +314 -0
- package/dist/esm/modules/e2eping/e2eping.js.map +1 -0
- package/dist/esm/modules/flags/FeatureFlags.js +36 -0
- package/dist/esm/modules/flags/FeatureFlags.js.map +1 -0
- package/dist/esm/modules/litemode/LiteModeContext.js +50 -0
- package/dist/esm/modules/litemode/LiteModeContext.js.map +1 -0
- package/dist/esm/modules/proxyconnection/CustomSignalingLayer.js +98 -0
- package/dist/esm/modules/proxyconnection/CustomSignalingLayer.js.map +1 -0
- package/dist/esm/modules/proxyconnection/ProxyConnectionPC.js +348 -0
- package/dist/esm/modules/proxyconnection/ProxyConnectionPC.js.map +1 -0
- package/dist/esm/modules/proxyconnection/ProxyConnectionService.js +279 -0
- package/dist/esm/modules/proxyconnection/ProxyConnectionService.js.map +1 -0
- package/dist/esm/modules/proxyconnection/constants.js +14 -0
- package/dist/esm/modules/proxyconnection/constants.js.map +1 -0
- package/dist/esm/modules/qualitycontrol/CodecSelection.js +222 -0
- package/dist/esm/modules/qualitycontrol/CodecSelection.js.map +1 -0
- package/dist/esm/modules/qualitycontrol/MockClasses.js +120 -0
- package/dist/esm/modules/qualitycontrol/MockClasses.js.map +1 -0
- package/dist/esm/modules/qualitycontrol/QualityController.js +366 -0
- package/dist/esm/modules/qualitycontrol/QualityController.js.map +1 -0
- package/dist/esm/modules/qualitycontrol/ReceiveAudioController.js +73 -0
- package/dist/esm/modules/qualitycontrol/ReceiveAudioController.js.map +1 -0
- package/dist/esm/modules/qualitycontrol/ReceiveVideoController.js +216 -0
- package/dist/esm/modules/qualitycontrol/ReceiveVideoController.js.map +1 -0
- package/dist/esm/modules/qualitycontrol/SendVideoController.js +133 -0
- package/dist/esm/modules/qualitycontrol/SendVideoController.js.map +1 -0
- package/dist/esm/modules/recording/JibriSession.js +279 -0
- package/dist/esm/modules/recording/JibriSession.js.map +1 -0
- package/dist/esm/modules/recording/RecordingManager.js +257 -0
- package/dist/esm/modules/recording/RecordingManager.js.map +1 -0
- package/dist/esm/modules/recording/recordingConstants.js +21 -0
- package/dist/esm/modules/recording/recordingConstants.js.map +1 -0
- package/dist/esm/modules/recording/recordingXMLUtils.js +69 -0
- package/dist/esm/modules/recording/recordingXMLUtils.js.map +1 -0
- package/dist/esm/modules/red/red.js +108 -0
- package/dist/esm/modules/red/red.js.map +1 -0
- package/dist/esm/modules/sdp/LocalSdpMunger.js +143 -0
- package/dist/esm/modules/sdp/LocalSdpMunger.js.map +1 -0
- package/dist/esm/modules/sdp/RtxModifier.js +179 -0
- package/dist/esm/modules/sdp/RtxModifier.js.map +1 -0
- package/dist/esm/modules/sdp/SDP.js +848 -0
- package/dist/esm/modules/sdp/SDP.js.map +1 -0
- package/dist/esm/modules/sdp/SDPDiffer.js +96 -0
- package/dist/esm/modules/sdp/SDPDiffer.js.map +1 -0
- package/dist/esm/modules/sdp/SDPUtil.js +798 -0
- package/dist/esm/modules/sdp/SDPUtil.js.map +1 -0
- package/dist/esm/modules/sdp/SampleSdpStrings.js +589 -0
- package/dist/esm/modules/sdp/SampleSdpStrings.js.map +1 -0
- package/dist/esm/modules/sdp/SdpSimulcast.js +196 -0
- package/dist/esm/modules/sdp/SdpSimulcast.js.map +1 -0
- package/dist/esm/modules/sdp/SdpTransformUtil.js +337 -0
- package/dist/esm/modules/sdp/SdpTransformUtil.js.map +1 -0
- package/dist/esm/modules/sdp/constants.js +2 -0
- package/dist/esm/modules/sdp/constants.js.map +1 -0
- package/dist/esm/modules/settings/Settings.js +95 -0
- package/dist/esm/modules/settings/Settings.js.map +1 -0
- package/dist/esm/modules/statistics/AnalyticsAdapter.js +277 -0
- package/dist/esm/modules/statistics/AnalyticsAdapter.js.map +1 -0
- package/dist/esm/modules/statistics/AvgRTPStatsReporter.js +817 -0
- package/dist/esm/modules/statistics/AvgRTPStatsReporter.js.map +1 -0
- package/dist/esm/modules/statistics/LocalStatsCollector.js +149 -0
- package/dist/esm/modules/statistics/LocalStatsCollector.js.map +1 -0
- package/dist/esm/modules/statistics/PreCallTest.js +15 -0
- package/dist/esm/modules/statistics/PreCallTest.js.map +1 -0
- package/dist/esm/modules/statistics/RTPStatsCollector.js +601 -0
- package/dist/esm/modules/statistics/RTPStatsCollector.js.map +1 -0
- package/dist/esm/modules/statistics/SpeakerStats.js +163 -0
- package/dist/esm/modules/statistics/SpeakerStats.js.map +1 -0
- package/dist/esm/modules/statistics/SpeakerStatsCollector.js +161 -0
- package/dist/esm/modules/statistics/SpeakerStatsCollector.js.map +1 -0
- package/dist/esm/modules/statistics/constants.js +7 -0
- package/dist/esm/modules/statistics/constants.js.map +1 -0
- package/dist/esm/modules/statistics/statistics.js +362 -0
- package/dist/esm/modules/statistics/statistics.js.map +1 -0
- package/dist/esm/modules/util/AsyncQueue.js +102 -0
- package/dist/esm/modules/util/AsyncQueue.js.map +1 -0
- package/dist/esm/modules/util/Deferred.js +41 -0
- package/dist/esm/modules/util/Deferred.js.map +1 -0
- package/dist/esm/modules/util/EventEmitter.js +17 -0
- package/dist/esm/modules/util/EventEmitter.js.map +1 -0
- package/dist/esm/modules/util/EventEmitterForwarder.js +52 -0
- package/dist/esm/modules/util/EventEmitterForwarder.js.map +1 -0
- package/dist/esm/modules/util/Listenable.js +106 -0
- package/dist/esm/modules/util/Listenable.js.map +1 -0
- package/dist/esm/modules/util/MathUtil.js +103 -0
- package/dist/esm/modules/util/MathUtil.js.map +1 -0
- package/dist/esm/modules/util/RandomUtil.js +66 -0
- package/dist/esm/modules/util/RandomUtil.js.map +1 -0
- package/dist/esm/modules/util/Retry.js +15 -0
- package/dist/esm/modules/util/Retry.js.map +1 -0
- package/dist/esm/modules/util/ScriptUtil.js +58 -0
- package/dist/esm/modules/util/ScriptUtil.js.map +1 -0
- package/dist/esm/modules/util/StringUtils.js +21 -0
- package/dist/esm/modules/util/StringUtils.js.map +1 -0
- package/dist/esm/modules/util/TestUtils.js +14 -0
- package/dist/esm/modules/util/TestUtils.js.map +1 -0
- package/dist/esm/modules/util/UsernameGenerator.js +436 -0
- package/dist/esm/modules/util/UsernameGenerator.js.map +1 -0
- package/dist/esm/modules/util/XMLUtils.js +135 -0
- package/dist/esm/modules/util/XMLUtils.js.map +1 -0
- package/dist/esm/modules/version/ComponentsVersions.js +52 -0
- package/dist/esm/modules/version/ComponentsVersions.js.map +1 -0
- package/dist/esm/modules/videosipgw/JitsiVideoSIPGWSession.js +137 -0
- package/dist/esm/modules/videosipgw/JitsiVideoSIPGWSession.js.map +1 -0
- package/dist/esm/modules/videosipgw/VideoSIPGW.js +102 -0
- package/dist/esm/modules/videosipgw/VideoSIPGW.js.map +1 -0
- package/dist/esm/modules/videosipgw/VideoSIPGWConstants.js +65 -0
- package/dist/esm/modules/videosipgw/VideoSIPGWConstants.js.map +1 -0
- package/dist/esm/modules/watchRTC/WatchRTC.js +69 -0
- package/dist/esm/modules/watchRTC/WatchRTC.js.map +1 -0
- package/dist/esm/modules/watchRTC/functions.js +31 -0
- package/dist/esm/modules/watchRTC/functions.js.map +1 -0
- package/dist/esm/modules/watchRTC/interfaces.js +2 -0
- package/dist/esm/modules/watchRTC/interfaces.js.map +1 -0
- package/dist/esm/modules/webaudio/AudioMixer.js +74 -0
- package/dist/esm/modules/webaudio/AudioMixer.js.map +1 -0
- package/dist/esm/modules/webaudio/WebAudioUtils.js +13 -0
- package/dist/esm/modules/webaudio/WebAudioUtils.js.map +1 -0
- package/dist/esm/modules/xmpp/AVModeration.js +156 -0
- package/dist/esm/modules/xmpp/AVModeration.js.map +1 -0
- package/dist/esm/modules/xmpp/BreakoutRooms.js +230 -0
- package/dist/esm/modules/xmpp/BreakoutRooms.js.map +1 -0
- package/dist/esm/modules/xmpp/Caps.js +223 -0
- package/dist/esm/modules/xmpp/Caps.js.map +1 -0
- package/dist/esm/modules/xmpp/ChatRoom.js +1877 -0
- package/dist/esm/modules/xmpp/ChatRoom.js.map +1 -0
- package/dist/esm/modules/xmpp/ConnectionPlugin.js +37 -0
- package/dist/esm/modules/xmpp/ConnectionPlugin.js.map +1 -0
- package/dist/esm/modules/xmpp/FileSharing.js +95 -0
- package/dist/esm/modules/xmpp/FileSharing.js.map +1 -0
- package/dist/esm/modules/xmpp/JingleHelperFunctions.js +168 -0
- package/dist/esm/modules/xmpp/JingleHelperFunctions.js.map +1 -0
- package/dist/esm/modules/xmpp/JingleSession.js +166 -0
- package/dist/esm/modules/xmpp/JingleSession.js.map +1 -0
- package/dist/esm/modules/xmpp/JingleSessionPC.js +1969 -0
- package/dist/esm/modules/xmpp/JingleSessionPC.js.map +1 -0
- package/dist/esm/modules/xmpp/JingleSessionState.js +23 -0
- package/dist/esm/modules/xmpp/JingleSessionState.js.map +1 -0
- package/dist/esm/modules/xmpp/Lobby.js +384 -0
- package/dist/esm/modules/xmpp/Lobby.js.map +1 -0
- package/dist/esm/modules/xmpp/MediaSessionEvents.js +12 -0
- package/dist/esm/modules/xmpp/MediaSessionEvents.js.map +1 -0
- package/dist/esm/modules/xmpp/MockClasses.js +77 -0
- package/dist/esm/modules/xmpp/MockClasses.js.map +1 -0
- package/dist/esm/modules/xmpp/Polls.js +87 -0
- package/dist/esm/modules/xmpp/Polls.js.map +1 -0
- package/dist/esm/modules/xmpp/ResumeTask.js +149 -0
- package/dist/esm/modules/xmpp/ResumeTask.js.map +1 -0
- package/dist/esm/modules/xmpp/RoomMetadata.js +96 -0
- package/dist/esm/modules/xmpp/RoomMetadata.js.map +1 -0
- package/dist/esm/modules/xmpp/SignalingLayerImpl.js +313 -0
- package/dist/esm/modules/xmpp/SignalingLayerImpl.js.map +1 -0
- package/dist/esm/modules/xmpp/StropheErrorHandler.js +53 -0
- package/dist/esm/modules/xmpp/StropheErrorHandler.js.map +1 -0
- package/dist/esm/modules/xmpp/StropheLastSuccess.js +52 -0
- package/dist/esm/modules/xmpp/StropheLastSuccess.js.map +1 -0
- package/dist/esm/modules/xmpp/XmppConnection.js +579 -0
- package/dist/esm/modules/xmpp/XmppConnection.js.map +1 -0
- package/dist/esm/modules/xmpp/moderator.js +524 -0
- package/dist/esm/modules/xmpp/moderator.js.map +1 -0
- package/dist/esm/modules/xmpp/sha1.js +165 -0
- package/dist/esm/modules/xmpp/sha1.js.map +1 -0
- package/dist/esm/modules/xmpp/strophe.disco.js +222 -0
- package/dist/esm/modules/xmpp/strophe.disco.js.map +1 -0
- package/dist/esm/modules/xmpp/strophe.emuc.js +206 -0
- package/dist/esm/modules/xmpp/strophe.emuc.js.map +1 -0
- package/dist/esm/modules/xmpp/strophe.jingle.js +404 -0
- package/dist/esm/modules/xmpp/strophe.jingle.js.map +1 -0
- package/dist/esm/modules/xmpp/strophe.logger.js +44 -0
- package/dist/esm/modules/xmpp/strophe.logger.js.map +1 -0
- package/dist/esm/modules/xmpp/strophe.ping.js +170 -0
- package/dist/esm/modules/xmpp/strophe.ping.js.map +1 -0
- package/dist/esm/modules/xmpp/strophe.rayo.js +117 -0
- package/dist/esm/modules/xmpp/strophe.rayo.js.map +1 -0
- package/dist/esm/modules/xmpp/strophe.stream-management.js +365 -0
- package/dist/esm/modules/xmpp/strophe.stream-management.js.map +1 -0
- package/dist/esm/modules/xmpp/strophe.util.js +116 -0
- package/dist/esm/modules/xmpp/strophe.util.js.map +1 -0
- package/dist/esm/modules/xmpp/xmpp.js +973 -0
- package/dist/esm/modules/xmpp/xmpp.js.map +1 -0
- package/dist/esm/service/RTC/BridgeVideoType.js +24 -0
- package/dist/esm/service/RTC/BridgeVideoType.js.map +1 -0
- package/dist/esm/service/RTC/CameraFacingMode.js +21 -0
- package/dist/esm/service/RTC/CameraFacingMode.js.map +1 -0
- package/dist/esm/service/RTC/CodecMimeType.js +36 -0
- package/dist/esm/service/RTC/CodecMimeType.js.map +1 -0
- package/dist/esm/service/RTC/MediaDirection.js +23 -0
- package/dist/esm/service/RTC/MediaDirection.js.map +1 -0
- package/dist/esm/service/RTC/MediaType.js +20 -0
- package/dist/esm/service/RTC/MediaType.js.map +1 -0
- package/dist/esm/service/RTC/RTCEvents.js +111 -0
- package/dist/esm/service/RTC/RTCEvents.js.map +1 -0
- package/dist/esm/service/RTC/ReceiverAudioSubscription.js +27 -0
- package/dist/esm/service/RTC/ReceiverAudioSubscription.js.map +1 -0
- package/dist/esm/service/RTC/Resolutions.js +56 -0
- package/dist/esm/service/RTC/Resolutions.js.map +1 -0
- package/dist/esm/service/RTC/SignalingEvents.js +42 -0
- package/dist/esm/service/RTC/SignalingEvents.js.map +1 -0
- package/dist/esm/service/RTC/SignalingLayer.js +153 -0
- package/dist/esm/service/RTC/SignalingLayer.js.map +1 -0
- package/dist/esm/service/RTC/StandardVideoQualitySettings.js +180 -0
- package/dist/esm/service/RTC/StandardVideoQualitySettings.js.map +1 -0
- package/dist/esm/service/RTC/VideoEncoderScalabilityMode.js +36 -0
- package/dist/esm/service/RTC/VideoEncoderScalabilityMode.js.map +1 -0
- package/dist/esm/service/RTC/VideoType.js +19 -0
- package/dist/esm/service/RTC/VideoType.js.map +1 -0
- package/dist/esm/service/authentication/AuthenticationEvents.js +13 -0
- package/dist/esm/service/authentication/AuthenticationEvents.js.map +1 -0
- package/dist/esm/service/connectivity/ConnectionQualityEvents.js +13 -0
- package/dist/esm/service/connectivity/ConnectionQualityEvents.js.map +1 -0
- package/dist/esm/service/connectivity/Constants.js +3 -0
- package/dist/esm/service/connectivity/Constants.js.map +1 -0
- package/dist/esm/service/e2eping/E2ePingEvents.js +8 -0
- package/dist/esm/service/e2eping/E2ePingEvents.js.map +1 -0
- package/dist/esm/service/statistics/AnalyticsEvents.js +521 -0
- package/dist/esm/service/statistics/AnalyticsEvents.js.map +1 -0
- package/dist/esm/service/statistics/Events.js +36 -0
- package/dist/esm/service/statistics/Events.js.map +1 -0
- package/dist/esm/service/statistics/constants.js +2 -0
- package/dist/esm/service/statistics/constants.js.map +1 -0
- package/dist/esm/service/xmpp/XMPPEvents.js +359 -0
- package/dist/esm/service/xmpp/XMPPEvents.js.map +1 -0
- package/dist/esm/service/xmpp/XMPPExtensioProtocols.js +64 -0
- package/dist/esm/service/xmpp/XMPPExtensioProtocols.js.map +1 -0
- package/dist/esm/test-setup-polyfill.js +34 -0
- package/dist/esm/test-setup-polyfill.js.map +1 -0
- package/dist/esm/tools/gen-version.js +15 -0
- package/dist/esm/tools/gen-version.js.map +1 -0
- package/dist/esm/version.js +3 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/umd/lib-jitsi-meet.e2ee-worker.js +484 -0
- package/dist/umd/lib-jitsi-meet.min.js +3 -0
- package/dist/umd/lib-jitsi-meet.min.js.LICENSE.txt +18 -0
- package/dist/umd/lib-jitsi-meet.min.map +1 -0
- package/package.json +93 -0
- package/types/index.d.ts +16180 -0
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
2
|
+
/******/ "use strict";
|
|
3
|
+
|
|
4
|
+
;// ./modules/e2ee/crypto-utils.ts
|
|
5
|
+
/**
|
|
6
|
+
* Derives a set of keys from the master key.
|
|
7
|
+
* @param {CryptoKey} material - master key to derive from
|
|
8
|
+
*
|
|
9
|
+
* See https://tools.ietf.org/html/draft-omara-sframe-00#section-4.3.1
|
|
10
|
+
*/
|
|
11
|
+
async function deriveKeys(material) {
|
|
12
|
+
const info = new ArrayBuffer();
|
|
13
|
+
const textEncoder = new TextEncoder();
|
|
14
|
+
|
|
15
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/deriveKey#HKDF
|
|
16
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/HkdfParams
|
|
17
|
+
const encryptionKey = await crypto.subtle.deriveKey({
|
|
18
|
+
hash: 'SHA-256',
|
|
19
|
+
info,
|
|
20
|
+
name: 'HKDF',
|
|
21
|
+
salt: textEncoder.encode('JFrameEncryptionKey')
|
|
22
|
+
}, material, {
|
|
23
|
+
length: 128,
|
|
24
|
+
name: 'AES-GCM'
|
|
25
|
+
}, false, ['encrypt', 'decrypt']);
|
|
26
|
+
return {
|
|
27
|
+
encryptionKey,
|
|
28
|
+
material
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Ratchets a key. See
|
|
34
|
+
* https://tools.ietf.org/html/draft-omara-sframe-00#section-4.3.5.1
|
|
35
|
+
* @param {CryptoKey} material - base key material
|
|
36
|
+
* @returns {Promise<ArrayBuffer>} - ratcheted key material
|
|
37
|
+
*/
|
|
38
|
+
async function ratchet(material) {
|
|
39
|
+
const textEncoder = new TextEncoder();
|
|
40
|
+
|
|
41
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/deriveBits
|
|
42
|
+
return await crypto.subtle.deriveBits({
|
|
43
|
+
hash: 'SHA-256',
|
|
44
|
+
info: new ArrayBuffer(),
|
|
45
|
+
name: 'HKDF',
|
|
46
|
+
salt: textEncoder.encode('JFrameRatchetKey')
|
|
47
|
+
}, material, 256);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Converts a raw key into a WebCrypto key object with default options
|
|
52
|
+
* suitable for our usage.
|
|
53
|
+
* @param {ArrayBuffer} keyBytes - raw key
|
|
54
|
+
* @param {Array} keyUsages - key usages, see importKey documentation
|
|
55
|
+
* @returns {Promise<CryptoKey>} - the WebCrypto key.
|
|
56
|
+
*/
|
|
57
|
+
async function importKey(keyBytes) {
|
|
58
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey
|
|
59
|
+
return await crypto.subtle.importKey('raw', keyBytes, 'HKDF', false, ['deriveBits', 'deriveKey']);
|
|
60
|
+
}
|
|
61
|
+
;// ./modules/e2ee/Context.ts
|
|
62
|
+
/* eslint-disable no-bitwise */
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
// We use a ringbuffer of keys so we can change them and still decode packets that were
|
|
67
|
+
// encrypted with an old key. We use a size of 16 which corresponds to the four bits
|
|
68
|
+
// in the frame trailer.
|
|
69
|
+
const KEYRING_SIZE = 16;
|
|
70
|
+
|
|
71
|
+
// We copy the first bytes of the VP8 payload unencrypted.
|
|
72
|
+
// For keyframes this is 10 bytes, for non-keyframes (delta) 3. See
|
|
73
|
+
// https://tools.ietf.org/html/rfc6386#section-9.1
|
|
74
|
+
// This allows the bridge to continue detecting keyframes (only one byte needed in the JVB)
|
|
75
|
+
// and is also a bit easier for the VP8 decoder (i.e. it generates funny garbage pictures
|
|
76
|
+
// instead of being unable to decode).
|
|
77
|
+
// This is a bit for show and we might want to reduce to 1 unconditionally in the final version.
|
|
78
|
+
//
|
|
79
|
+
// For audio (where frame.type is not set) we do not encrypt the opus TOC byte:
|
|
80
|
+
// https://tools.ietf.org/html/rfc6716#section-3.1
|
|
81
|
+
const UNENCRYPTED_BYTES = {
|
|
82
|
+
delta: 3,
|
|
83
|
+
key: 10,
|
|
84
|
+
undefined: 1 // frame.type is not set on audio
|
|
85
|
+
};
|
|
86
|
+
const ENCRYPTION_ALGORITHM = 'AES-GCM';
|
|
87
|
+
|
|
88
|
+
/* We use a 96 bit IV for AES GCM. This is signalled in plain together with the
|
|
89
|
+
packet. See https://developer.mozilla.org/en-US/docs/Web/API/AesGcmParams */
|
|
90
|
+
const IV_LENGTH = 12;
|
|
91
|
+
const RATCHET_WINDOW_SIZE = 8;
|
|
92
|
+
/**
|
|
93
|
+
* Per-participant context holding the cryptographic keys and
|
|
94
|
+
* encode/decode functions
|
|
95
|
+
*/
|
|
96
|
+
class Context {
|
|
97
|
+
/**
|
|
98
|
+
* @param {Object} options
|
|
99
|
+
*/
|
|
100
|
+
constructor() {
|
|
101
|
+
let {
|
|
102
|
+
sharedKey = false
|
|
103
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
104
|
+
// An array (ring) of keys that we use for sending and receiving.
|
|
105
|
+
this._cryptoKeyRing = new Array(KEYRING_SIZE);
|
|
106
|
+
// A pointer to the currently used key.
|
|
107
|
+
this._currentKeyIndex = -1;
|
|
108
|
+
this._sendCounts = new Map();
|
|
109
|
+
this._sharedKey = sharedKey;
|
|
110
|
+
this._enabled = false;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Function that will decrypt the given encoded frame. If the decryption fails, it will
|
|
115
|
+
* ratchet the key for up to RATCHET_WINDOW_SIZE times.
|
|
116
|
+
*
|
|
117
|
+
* @param {RTCEncodedVideoFrame|RTCEncodedAudioFrame} encodedFrame - Encoded video frame.
|
|
118
|
+
* @param {number} keyIndex - the index of the decryption data in _cryptoKeyRing array.
|
|
119
|
+
* @param {number} ratchetCount - the number of retries after ratcheting the key.
|
|
120
|
+
* @returns {Promise<RTCEncodedVideoFrame|RTCEncodedAudioFrame>} - The decrypted frame.
|
|
121
|
+
* @private
|
|
122
|
+
*/
|
|
123
|
+
async _decryptFrame(encodedFrame, keyIndex) {
|
|
124
|
+
let initialKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
125
|
+
let ratchetCount = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
126
|
+
const keyData = this._cryptoKeyRing[keyIndex];
|
|
127
|
+
const {
|
|
128
|
+
encryptionKey
|
|
129
|
+
} = keyData;
|
|
130
|
+
let {
|
|
131
|
+
material
|
|
132
|
+
} = keyData;
|
|
133
|
+
|
|
134
|
+
// Construct frame trailer. Similar to the frame header described in
|
|
135
|
+
// https://tools.ietf.org/html/draft-omara-sframe-00#section-4.2
|
|
136
|
+
// but we put it at the end.
|
|
137
|
+
//
|
|
138
|
+
// ---------+-------------------------+-+---------+----
|
|
139
|
+
// payload |IV...(length = IV_LENGTH)|R|IV_LENGTH|KID |
|
|
140
|
+
// ---------+-------------------------+-+---------+----
|
|
141
|
+
|
|
142
|
+
try {
|
|
143
|
+
const frameHeader = new Uint8Array(encodedFrame.data, 0, UNENCRYPTED_BYTES[encodedFrame.type]);
|
|
144
|
+
const frameTrailer = new Uint8Array(encodedFrame.data, encodedFrame.data.byteLength - 2, 2);
|
|
145
|
+
const ivLength = frameTrailer[0];
|
|
146
|
+
const iv = new Uint8Array(encodedFrame.data, encodedFrame.data.byteLength - ivLength - frameTrailer.byteLength, ivLength);
|
|
147
|
+
const cipherTextStart = frameHeader.byteLength;
|
|
148
|
+
const cipherTextLength = encodedFrame.data.byteLength - (frameHeader.byteLength + ivLength + frameTrailer.byteLength);
|
|
149
|
+
const plainText = await crypto.subtle.decrypt({
|
|
150
|
+
additionalData: new Uint8Array(encodedFrame.data, 0, frameHeader.byteLength),
|
|
151
|
+
iv,
|
|
152
|
+
name: 'AES-GCM'
|
|
153
|
+
}, encryptionKey, new Uint8Array(encodedFrame.data, cipherTextStart, cipherTextLength));
|
|
154
|
+
const newData = new ArrayBuffer(frameHeader.byteLength + plainText.byteLength);
|
|
155
|
+
const newUint8 = new Uint8Array(newData);
|
|
156
|
+
newUint8.set(new Uint8Array(encodedFrame.data, 0, frameHeader.byteLength));
|
|
157
|
+
newUint8.set(new Uint8Array(plainText), frameHeader.byteLength);
|
|
158
|
+
encodedFrame.data = newData;
|
|
159
|
+
return encodedFrame;
|
|
160
|
+
} catch (error) {
|
|
161
|
+
if (this._sharedKey) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (ratchetCount < RATCHET_WINDOW_SIZE) {
|
|
165
|
+
const currentKey = this._cryptoKeyRing[this._currentKeyIndex];
|
|
166
|
+
material = await importKey(await ratchet(material));
|
|
167
|
+
const newKey = await deriveKeys(material);
|
|
168
|
+
this._setKeys(newKey);
|
|
169
|
+
return await this._decryptFrame(encodedFrame, keyIndex, initialKey || currentKey, ratchetCount + 1);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Since the key it is first send and only afterwards actually used for encrypting, there were
|
|
174
|
+
* situations when the decrypting failed due to the fact that the received frame was not encrypted
|
|
175
|
+
* yet and ratcheting, of course, did not solve the problem. So if we fail RATCHET_WINDOW_SIZE times,
|
|
176
|
+
* we come back to the initial key.
|
|
177
|
+
*/
|
|
178
|
+
this._setKeys(initialKey);
|
|
179
|
+
|
|
180
|
+
// TODO: notify the application about error status.
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Construct the IV used for AES-GCM and sent (in plain) with the packet similar to
|
|
186
|
+
* https://tools.ietf.org/html/rfc7714#section-8.1
|
|
187
|
+
* It concatenates
|
|
188
|
+
* - the 32 bit synchronization source (SSRC) given on the encoded frame,
|
|
189
|
+
* - the 32 bit rtp timestamp given on the encoded frame,
|
|
190
|
+
* - a send counter that is specific to the SSRC. Starts at a random number.
|
|
191
|
+
* The send counter is essentially the pictureId but we currently have to implement this ourselves.
|
|
192
|
+
* There is no XOR with a salt. Note that this IV leaks the SSRC to the receiver but since this is
|
|
193
|
+
* randomly generated and SFUs may not rewrite this is considered acceptable.
|
|
194
|
+
* The SSRC is used to allow demultiplexing multiple streams with the same key, as described in
|
|
195
|
+
* https://tools.ietf.org/html/rfc3711#section-4.1.1
|
|
196
|
+
* The RTP timestamp is 32 bits and advances by the codec clock rate (90khz for video, 48khz for
|
|
197
|
+
* opus audio) every second. For video it rolls over roughly every 13 hours.
|
|
198
|
+
* The send counter will advance at the frame rate (30fps for video, 50fps for 20ms opus audio)
|
|
199
|
+
* every second. It will take a long time to roll over.
|
|
200
|
+
*
|
|
201
|
+
* See also https://developer.mozilla.org/en-US/docs/Web/API/AesGcmParams
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
_makeIV(synchronizationSource, timestamp) {
|
|
205
|
+
const iv = new ArrayBuffer(IV_LENGTH);
|
|
206
|
+
const ivView = new DataView(iv);
|
|
207
|
+
|
|
208
|
+
// having to keep our own send count (similar to a picture id) is not ideal.
|
|
209
|
+
if (!this._sendCounts.has(synchronizationSource)) {
|
|
210
|
+
// Initialize with a random offset, similar to the RTP sequence number.
|
|
211
|
+
this._sendCounts.set(synchronizationSource, Math.floor(Math.random() * 0xFFFF));
|
|
212
|
+
}
|
|
213
|
+
const sendCount = this._sendCounts.get(synchronizationSource);
|
|
214
|
+
ivView.setUint32(0, synchronizationSource);
|
|
215
|
+
ivView.setUint32(4, timestamp);
|
|
216
|
+
ivView.setUint32(8, sendCount % 0xFFFF);
|
|
217
|
+
this._sendCounts.set(synchronizationSource, sendCount + 1);
|
|
218
|
+
return iv;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Sets a set of keys and resets the sendCount.
|
|
223
|
+
* decryption.
|
|
224
|
+
* @param {Object} keys set of keys.
|
|
225
|
+
* @param {Number} keyIndex optional
|
|
226
|
+
* @private
|
|
227
|
+
*/
|
|
228
|
+
_setKeys(keys) {
|
|
229
|
+
let keyIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
|
|
230
|
+
if (keyIndex >= 0) {
|
|
231
|
+
this._currentKeyIndex = keyIndex % this._cryptoKeyRing.length;
|
|
232
|
+
}
|
|
233
|
+
this._cryptoKeyRing[this._currentKeyIndex] = keys;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Enables or disables the E2EE context. When disabled packets are passed through.
|
|
238
|
+
* @param {boolean} enabled True if E2EE is enabled, false otherwise.
|
|
239
|
+
*/
|
|
240
|
+
setEnabled(enabled) {
|
|
241
|
+
this._enabled = enabled;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Derives the different subkeys and starts using them for encryption or
|
|
246
|
+
* decryption.
|
|
247
|
+
* @param {Uint8Array|ArrayBuffer|false} key bytes. Pass false to disable.
|
|
248
|
+
* @param {Number} keyIndex
|
|
249
|
+
*/
|
|
250
|
+
async setKey(key) {
|
|
251
|
+
let keyIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
|
|
252
|
+
let newKey = false;
|
|
253
|
+
if (key) {
|
|
254
|
+
if (this._sharedKey) {
|
|
255
|
+
newKey = key;
|
|
256
|
+
} else {
|
|
257
|
+
// Handle both Uint8Array and ArrayBuffer
|
|
258
|
+
let keyBuffer;
|
|
259
|
+
if (key instanceof ArrayBuffer) {
|
|
260
|
+
keyBuffer = key;
|
|
261
|
+
} else {
|
|
262
|
+
// Convert Uint8Array to ArrayBuffer properly
|
|
263
|
+
keyBuffer = new ArrayBuffer(key.length);
|
|
264
|
+
new Uint8Array(keyBuffer).set(key);
|
|
265
|
+
}
|
|
266
|
+
const material = await importKey(keyBuffer);
|
|
267
|
+
newKey = await deriveKeys(material);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
this._setKeys(newKey, keyIndex);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Function that will be injected in a stream and will encrypt the given encoded frames.
|
|
275
|
+
*
|
|
276
|
+
* @param {RTCEncodedVideoFrame|RTCEncodedAudioFrame} encodedFrame - Encoded video frame.
|
|
277
|
+
* @param {ITransformStreamDefaultController} controller - TransportStreamController.
|
|
278
|
+
*
|
|
279
|
+
* The VP8 payload descriptor described in
|
|
280
|
+
* https://tools.ietf.org/html/rfc7741#section-4.2
|
|
281
|
+
* is part of the RTP packet and not part of the frame and is not controllable by us.
|
|
282
|
+
* This is fine as the SFU keeps having access to it for routing.
|
|
283
|
+
*
|
|
284
|
+
* The encrypted frame is formed as follows:
|
|
285
|
+
* 1) Leave the first (10, 3, 1) bytes unencrypted, depending on the frame type and kind.
|
|
286
|
+
* 2) Form the GCM IV for the frame as described above.
|
|
287
|
+
* 3) Encrypt the rest of the frame using AES-GCM.
|
|
288
|
+
* 4) Allocate space for the encrypted frame.
|
|
289
|
+
* 5) Copy the unencrypted bytes to the start of the encrypted frame.
|
|
290
|
+
* 6) Append the ciphertext to the encrypted frame.
|
|
291
|
+
* 7) Append the IV.
|
|
292
|
+
* 8) Append a single byte for the key identifier.
|
|
293
|
+
* 9) Enqueue the encrypted frame for sending.
|
|
294
|
+
*/
|
|
295
|
+
encodeFunction(encodedFrame, controller) {
|
|
296
|
+
if (!this._enabled) {
|
|
297
|
+
return controller.enqueue(encodedFrame);
|
|
298
|
+
}
|
|
299
|
+
const keyIndex = this._currentKeyIndex;
|
|
300
|
+
const currentKey = this._cryptoKeyRing[keyIndex];
|
|
301
|
+
if (currentKey) {
|
|
302
|
+
const iv = this._makeIV(encodedFrame.getMetadata().synchronizationSource, encodedFrame.timestamp);
|
|
303
|
+
|
|
304
|
+
// This is not encrypted and contains the VP8 payload descriptor or the Opus TOC byte.
|
|
305
|
+
const frameHeader = new Uint8Array(encodedFrame.data, 0, UNENCRYPTED_BYTES[encodedFrame.type]);
|
|
306
|
+
|
|
307
|
+
// Frame trailer contains the R|IV_LENGTH and key index
|
|
308
|
+
const frameTrailer = new Uint8Array(2);
|
|
309
|
+
frameTrailer[0] = IV_LENGTH;
|
|
310
|
+
frameTrailer[1] = keyIndex;
|
|
311
|
+
|
|
312
|
+
// Construct frame trailer. Similar to the frame header described in
|
|
313
|
+
// https://tools.ietf.org/html/draft-omara-sframe-00#section-4.2
|
|
314
|
+
// but we put it at the end.
|
|
315
|
+
//
|
|
316
|
+
// ---------+-------------------------+-+---------+----
|
|
317
|
+
// payload |IV...(length = IV_LENGTH)|R|IV_LENGTH|KID |
|
|
318
|
+
// ---------+-------------------------+-+---------+----
|
|
319
|
+
|
|
320
|
+
return crypto.subtle.encrypt({
|
|
321
|
+
additionalData: new Uint8Array(encodedFrame.data, 0, frameHeader.byteLength),
|
|
322
|
+
iv,
|
|
323
|
+
name: ENCRYPTION_ALGORITHM
|
|
324
|
+
}, currentKey.encryptionKey, new Uint8Array(encodedFrame.data, UNENCRYPTED_BYTES[encodedFrame.type])).then(cipherText => {
|
|
325
|
+
const newData = new ArrayBuffer(frameHeader.byteLength + cipherText.byteLength + iv.byteLength + frameTrailer.byteLength);
|
|
326
|
+
const newUint8 = new Uint8Array(newData);
|
|
327
|
+
newUint8.set(frameHeader); // copy first bytes.
|
|
328
|
+
newUint8.set(new Uint8Array(cipherText), frameHeader.byteLength); // add ciphertext.
|
|
329
|
+
newUint8.set(new Uint8Array(iv), frameHeader.byteLength + cipherText.byteLength); // append IV.
|
|
330
|
+
newUint8.set(frameTrailer, frameHeader.byteLength + cipherText.byteLength + iv.byteLength); // append frame trailer.
|
|
331
|
+
|
|
332
|
+
encodedFrame.data = newData;
|
|
333
|
+
return controller.enqueue(encodedFrame);
|
|
334
|
+
}, e => {
|
|
335
|
+
// TODO: surface this to the app.
|
|
336
|
+
console.error(e);
|
|
337
|
+
|
|
338
|
+
// We are not enqueuing the frame here on purpose.
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Function that will be injected in a stream and will decrypt the given encoded frames.
|
|
345
|
+
*
|
|
346
|
+
* @param {RTCEncodedVideoFrame|RTCEncodedAudioFrame} encodedFrame - Encoded video frame.
|
|
347
|
+
* @param {ITransformStreamDefaultController} controller - TransportStreamController.
|
|
348
|
+
*/
|
|
349
|
+
async decodeFunction(encodedFrame, controller) {
|
|
350
|
+
if (!this._enabled) {
|
|
351
|
+
return controller.enqueue(encodedFrame);
|
|
352
|
+
}
|
|
353
|
+
const data = new Uint8Array(encodedFrame.data);
|
|
354
|
+
const keyIndex = data[encodedFrame.data.byteLength - 1];
|
|
355
|
+
if (this._cryptoKeyRing[keyIndex]) {
|
|
356
|
+
const decodedFrame = await this._decryptFrame(encodedFrame, keyIndex);
|
|
357
|
+
if (decodedFrame) {
|
|
358
|
+
controller.enqueue(decodedFrame);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
;// ./modules/e2ee/Worker.ts
|
|
364
|
+
/* eslint-disable no-bitwise */
|
|
365
|
+
|
|
366
|
+
// Worker for E2EE/Insertable streams.
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
const contexts = new Map(); // Map participant id => context
|
|
370
|
+
|
|
371
|
+
let sharedContext;
|
|
372
|
+
let enabled = false;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Retrieves the participant {@code Context}, creating it if necessary.
|
|
376
|
+
*
|
|
377
|
+
* @param {string} participantId - The participant whose context we need.
|
|
378
|
+
* @returns {Object} The context.
|
|
379
|
+
*/
|
|
380
|
+
function getParticipantContext(participantId) {
|
|
381
|
+
if (sharedContext) {
|
|
382
|
+
return sharedContext;
|
|
383
|
+
}
|
|
384
|
+
if (!contexts.has(participantId)) {
|
|
385
|
+
const context = new Context();
|
|
386
|
+
context.setEnabled(enabled);
|
|
387
|
+
contexts.set(participantId, context);
|
|
388
|
+
}
|
|
389
|
+
return contexts.get(participantId);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Sets an encode / decode transform.
|
|
394
|
+
*
|
|
395
|
+
* @param {Object} context - The participant context where the transform will be applied.
|
|
396
|
+
* @param {string} operation - Encode / decode.
|
|
397
|
+
* @param {Object} readableStream - Readable stream part.
|
|
398
|
+
* @param {Object} writableStream - Writable stream part.
|
|
399
|
+
*/
|
|
400
|
+
function handleTransform(context, operation, readableStream, writableStream) {
|
|
401
|
+
if (operation === 'encode' || operation === 'decode') {
|
|
402
|
+
const transformFn = operation === 'encode' ? context.encodeFunction : context.decodeFunction;
|
|
403
|
+
const transformStream = new TransformStream({
|
|
404
|
+
transform: transformFn.bind(context)
|
|
405
|
+
});
|
|
406
|
+
readableStream.pipeThrough(transformStream).pipeTo(writableStream);
|
|
407
|
+
} else {
|
|
408
|
+
console.error(`Invalid operation: ${operation}`);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// Declare worker scope types
|
|
413
|
+
|
|
414
|
+
onmessage = event => {
|
|
415
|
+
const {
|
|
416
|
+
operation
|
|
417
|
+
} = event.data;
|
|
418
|
+
if (operation === 'initialize') {
|
|
419
|
+
const {
|
|
420
|
+
sharedKey
|
|
421
|
+
} = event.data;
|
|
422
|
+
if (sharedKey) {
|
|
423
|
+
sharedContext = new Context({
|
|
424
|
+
sharedKey
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
} else if (operation === 'encode' || operation === 'decode') {
|
|
428
|
+
const {
|
|
429
|
+
readableStream,
|
|
430
|
+
writableStream,
|
|
431
|
+
participantId
|
|
432
|
+
} = event.data;
|
|
433
|
+
if (!readableStream || !writableStream || !participantId) {
|
|
434
|
+
throw new Error('Missing required data: readableStream, writableStream, or participantId');
|
|
435
|
+
}
|
|
436
|
+
const context = getParticipantContext(participantId);
|
|
437
|
+
handleTransform(context, operation, readableStream, writableStream);
|
|
438
|
+
} else if (operation === 'setEnabled') {
|
|
439
|
+
enabled = event.data.enabled;
|
|
440
|
+
contexts.forEach(context => context.setEnabled(enabled));
|
|
441
|
+
} else if (operation === 'setKey') {
|
|
442
|
+
const {
|
|
443
|
+
participantId,
|
|
444
|
+
key,
|
|
445
|
+
keyIndex
|
|
446
|
+
} = event.data;
|
|
447
|
+
if (!participantId || keyIndex === undefined) {
|
|
448
|
+
throw new Error('Missing required data: participantId or keyIndex');
|
|
449
|
+
}
|
|
450
|
+
const context = getParticipantContext(participantId);
|
|
451
|
+
if (key) {
|
|
452
|
+
context.setKey(new Uint8Array(key), keyIndex);
|
|
453
|
+
} else {
|
|
454
|
+
context.setKey(false, keyIndex);
|
|
455
|
+
}
|
|
456
|
+
} else if (operation === 'cleanup') {
|
|
457
|
+
const {
|
|
458
|
+
participantId
|
|
459
|
+
} = event.data;
|
|
460
|
+
if (!participantId) {
|
|
461
|
+
throw new Error('Missing required data: participantId');
|
|
462
|
+
}
|
|
463
|
+
contexts.delete(participantId);
|
|
464
|
+
} else if (operation === 'cleanupAll') {
|
|
465
|
+
contexts.clear();
|
|
466
|
+
} else {
|
|
467
|
+
console.error('e2ee worker', operation);
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
// Operations using RTCRtpScriptTransform.
|
|
472
|
+
if (self.RTCTransformEvent) {
|
|
473
|
+
self.onrtctransform = event => {
|
|
474
|
+
const transformer = event.transformer;
|
|
475
|
+
const {
|
|
476
|
+
operation,
|
|
477
|
+
participantId
|
|
478
|
+
} = transformer.options;
|
|
479
|
+
const context = getParticipantContext(participantId);
|
|
480
|
+
handleTransform(context, operation, transformer.readable, transformer.writable);
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
/******/ })()
|
|
484
|
+
;
|