@stream-io/video-react-native-sdk 2.0.0-beta.0 → 2.0.0-beta.2
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/CHANGELOG.md +95 -0
- package/README.md +15 -0
- package/android/build.gradle +7 -1
- package/android/src/main/java/com/streamvideo/reactnative/audio/AudioDeviceManager.kt +110 -58
- package/android/src/main/java/com/streamvideo/reactnative/audio/CommunicationModeKeepAlive.kt +247 -0
- package/android/src/main/java/com/streamvideo/reactnative/callmanager/StreamInCallManagerModule.kt +16 -5
- package/dist/commonjs/components/Call/CallContent/CallContent.js +1 -1
- package/dist/commonjs/components/Call/CallContent/CallContent.js.map +1 -1
- package/dist/commonjs/components/Call/CallContent/RTCViewPipIOS.js +78 -7
- package/dist/commonjs/components/Call/CallContent/RTCViewPipIOS.js.map +1 -1
- package/dist/commonjs/components/Call/CallContent/RTCViewPipNative.js +3 -0
- package/dist/commonjs/components/Call/CallContent/RTCViewPipNative.js.map +1 -1
- package/dist/commonjs/components/Call/Lobby/JoinCallButton.js +3 -2
- package/dist/commonjs/components/Call/Lobby/JoinCallButton.js.map +1 -1
- package/dist/commonjs/components/Call/Lobby/Lobby.js +4 -3
- package/dist/commonjs/components/Call/Lobby/Lobby.js.map +1 -1
- package/dist/commonjs/components/Call/Lobby/LobbyFooter.js +10 -10
- package/dist/commonjs/components/Call/Lobby/LobbyFooter.js.map +1 -1
- package/dist/commonjs/components/Call/RingingCallContent/CallLeftIndicator.js +3 -3
- package/dist/commonjs/components/Call/RingingCallContent/CallLeftIndicator.js.map +1 -1
- package/dist/commonjs/components/Call/RingingCallContent/CallPreparingIndicator.js +3 -3
- package/dist/commonjs/components/Call/RingingCallContent/CallPreparingIndicator.js.map +1 -1
- package/dist/commonjs/components/Call/RingingCallContent/IncomingCall.js +3 -2
- package/dist/commonjs/components/Call/RingingCallContent/IncomingCall.js.map +1 -1
- package/dist/commonjs/components/Call/RingingCallContent/OutgoingCall.js +7 -14
- package/dist/commonjs/components/Call/RingingCallContent/OutgoingCall.js.map +1 -1
- package/dist/commonjs/components/Livestream/LivestreamControls/HostStartStreamButton.js +3 -2
- package/dist/commonjs/components/Livestream/LivestreamControls/HostStartStreamButton.js.map +1 -1
- package/dist/commonjs/components/Livestream/LivestreamPlayer/LivestreamEnded.js +4 -3
- package/dist/commonjs/components/Livestream/LivestreamPlayer/LivestreamEnded.js.map +1 -1
- package/dist/commonjs/components/Livestream/LivestreamTopView/LiveIndicator.js +3 -3
- package/dist/commonjs/components/Livestream/LivestreamTopView/LiveIndicator.js.map +1 -1
- package/dist/commonjs/components/Livestream/ViewerLivestream/ViewerLobby.js +9 -4
- package/dist/commonjs/components/Livestream/ViewerLivestream/ViewerLobby.js.map +1 -1
- package/dist/commonjs/components/Participant/ParticipantView/ParticipantLabel.js +4 -3
- package/dist/commonjs/components/Participant/ParticipantView/ParticipantLabel.js.map +1 -1
- package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js +27 -4
- package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js.map +1 -1
- package/dist/commonjs/components/utility/ScreenShareOverlay.js +4 -3
- package/dist/commonjs/components/utility/ScreenShareOverlay.js.map +1 -1
- package/dist/commonjs/i18n/Streami18n.js +77 -0
- package/dist/commonjs/i18n/Streami18n.js.map +1 -0
- package/dist/commonjs/i18n/TranslationContext.js +52 -0
- package/dist/commonjs/i18n/TranslationContext.js.map +1 -0
- package/dist/commonjs/i18n/index.js +85 -0
- package/dist/commonjs/i18n/index.js.map +1 -0
- package/dist/commonjs/i18n/keys.js +2 -0
- package/dist/commonjs/i18n/keys.js.map +1 -0
- package/dist/commonjs/i18n/runtimeDefaults.js +24 -0
- package/dist/commonjs/i18n/runtimeDefaults.js.map +1 -0
- package/dist/commonjs/i18n/types.js +6 -0
- package/dist/commonjs/i18n/types.js.map +1 -0
- package/dist/commonjs/i18n/useStreami18n.js +61 -0
- package/dist/commonjs/i18n/useStreami18n.js.map +1 -0
- package/dist/commonjs/index.js +18 -5
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/modules/encryption/EncryptionManager.js +305 -0
- package/dist/commonjs/modules/encryption/EncryptionManager.js.map +1 -0
- package/dist/commonjs/modules/encryption/eventMapping.js +143 -0
- package/dist/commonjs/modules/encryption/eventMapping.js.map +1 -0
- package/dist/commonjs/modules/encryption/index.js +13 -0
- package/dist/commonjs/modules/encryption/index.js.map +1 -0
- package/dist/commonjs/modules/encryption/parity.js +6 -0
- package/dist/commonjs/modules/encryption/parity.js.map +1 -0
- package/dist/commonjs/providers/NoiseCancellation/NoiseCancellationProvider.js +6 -2
- package/dist/commonjs/providers/NoiseCancellation/NoiseCancellationProvider.js.map +1 -1
- package/dist/commonjs/providers/StreamVideo.js +28 -12
- package/dist/commonjs/providers/StreamVideo.js.map +1 -1
- package/dist/commonjs/utils/StreamVideoRN/index.js +46 -0
- package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
- package/dist/commonjs/utils/internal/callingx/callingx.js +29 -4
- package/dist/commonjs/utils/internal/callingx/callingx.js.map +1 -1
- package/dist/commonjs/utils/internal/iosPipTrack.js +41 -0
- package/dist/commonjs/utils/internal/iosPipTrack.js.map +1 -0
- package/dist/commonjs/utils/internal/registerSDKGlobals.js +6 -0
- package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
- package/dist/commonjs/utils/internal/ringingCallLifecycle.js +142 -0
- package/dist/commonjs/utils/internal/ringingCallLifecycle.js.map +1 -0
- package/dist/commonjs/utils/push/internal/utils.js +4 -0
- package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/module/components/Call/CallContent/CallContent.js +1 -1
- package/dist/module/components/Call/CallContent/CallContent.js.map +1 -1
- package/dist/module/components/Call/CallContent/RTCViewPipIOS.js +80 -9
- package/dist/module/components/Call/CallContent/RTCViewPipIOS.js.map +1 -1
- package/dist/module/components/Call/CallContent/RTCViewPipNative.js +3 -0
- package/dist/module/components/Call/CallContent/RTCViewPipNative.js.map +1 -1
- package/dist/module/components/Call/Lobby/JoinCallButton.js +3 -2
- package/dist/module/components/Call/Lobby/JoinCallButton.js.map +1 -1
- package/dist/module/components/Call/Lobby/Lobby.js +4 -3
- package/dist/module/components/Call/Lobby/Lobby.js.map +1 -1
- package/dist/module/components/Call/Lobby/LobbyFooter.js +10 -10
- package/dist/module/components/Call/Lobby/LobbyFooter.js.map +1 -1
- package/dist/module/components/Call/RingingCallContent/CallLeftIndicator.js +2 -2
- package/dist/module/components/Call/RingingCallContent/CallLeftIndicator.js.map +1 -1
- package/dist/module/components/Call/RingingCallContent/CallPreparingIndicator.js +2 -2
- package/dist/module/components/Call/RingingCallContent/CallPreparingIndicator.js.map +1 -1
- package/dist/module/components/Call/RingingCallContent/IncomingCall.js +3 -2
- package/dist/module/components/Call/RingingCallContent/IncomingCall.js.map +1 -1
- package/dist/module/components/Call/RingingCallContent/OutgoingCall.js +7 -14
- package/dist/module/components/Call/RingingCallContent/OutgoingCall.js.map +1 -1
- package/dist/module/components/Livestream/LivestreamControls/HostStartStreamButton.js +3 -2
- package/dist/module/components/Livestream/LivestreamControls/HostStartStreamButton.js.map +1 -1
- package/dist/module/components/Livestream/LivestreamPlayer/LivestreamEnded.js +4 -3
- package/dist/module/components/Livestream/LivestreamPlayer/LivestreamEnded.js.map +1 -1
- package/dist/module/components/Livestream/LivestreamTopView/LiveIndicator.js +2 -2
- package/dist/module/components/Livestream/LivestreamTopView/LiveIndicator.js.map +1 -1
- package/dist/module/components/Livestream/ViewerLivestream/ViewerLobby.js +9 -4
- package/dist/module/components/Livestream/ViewerLivestream/ViewerLobby.js.map +1 -1
- package/dist/module/components/Participant/ParticipantView/ParticipantLabel.js +4 -3
- package/dist/module/components/Participant/ParticipantView/ParticipantLabel.js.map +1 -1
- package/dist/module/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js +28 -5
- package/dist/module/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js.map +1 -1
- package/dist/module/components/utility/ScreenShareOverlay.js +4 -3
- package/dist/module/components/utility/ScreenShareOverlay.js.map +1 -1
- package/dist/module/i18n/Streami18n.js +73 -0
- package/dist/module/i18n/Streami18n.js.map +1 -0
- package/dist/module/i18n/TranslationContext.js +48 -0
- package/dist/module/i18n/TranslationContext.js.map +1 -0
- package/dist/module/i18n/index.js +20 -0
- package/dist/module/i18n/index.js.map +1 -0
- package/dist/module/i18n/keys.js +2 -0
- package/dist/module/i18n/keys.js.map +1 -0
- package/dist/module/i18n/runtimeDefaults.js +20 -0
- package/dist/module/i18n/runtimeDefaults.js.map +1 -0
- package/dist/module/i18n/types.js +4 -0
- package/dist/module/i18n/types.js.map +1 -0
- package/dist/module/i18n/useStreami18n.js +56 -0
- package/dist/module/i18n/useStreami18n.js.map +1 -0
- package/dist/module/index.js +6 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/modules/encryption/EncryptionManager.js +301 -0
- package/dist/module/modules/encryption/EncryptionManager.js.map +1 -0
- package/dist/module/modules/encryption/eventMapping.js +135 -0
- package/dist/module/modules/encryption/eventMapping.js.map +1 -0
- package/dist/module/modules/encryption/index.js +4 -0
- package/dist/module/modules/encryption/index.js.map +1 -0
- package/dist/module/modules/encryption/parity.js +4 -0
- package/dist/module/modules/encryption/parity.js.map +1 -0
- package/dist/module/providers/NoiseCancellation/NoiseCancellationProvider.js +6 -2
- package/dist/module/providers/NoiseCancellation/NoiseCancellationProvider.js.map +1 -1
- package/dist/module/providers/StreamVideo.js +29 -14
- package/dist/module/providers/StreamVideo.js.map +1 -1
- package/dist/module/utils/StreamVideoRN/index.js +46 -0
- package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
- package/dist/module/utils/internal/callingx/callingx.js +29 -4
- package/dist/module/utils/internal/callingx/callingx.js.map +1 -1
- package/dist/module/utils/internal/iosPipTrack.js +35 -0
- package/dist/module/utils/internal/iosPipTrack.js.map +1 -0
- package/dist/module/utils/internal/registerSDKGlobals.js +6 -0
- package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
- package/dist/module/utils/internal/ringingCallLifecycle.js +134 -0
- package/dist/module/utils/internal/ringingCallLifecycle.js.map +1 -0
- package/dist/module/utils/push/internal/utils.js +4 -0
- package/dist/module/utils/push/internal/utils.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/typescript/components/Call/CallContent/RTCViewPipIOS.d.ts.map +1 -1
- package/dist/typescript/components/Call/CallContent/RTCViewPipNative.d.ts +12 -0
- package/dist/typescript/components/Call/CallContent/RTCViewPipNative.d.ts.map +1 -1
- package/dist/typescript/components/Call/Lobby/JoinCallButton.d.ts.map +1 -1
- package/dist/typescript/components/Call/Lobby/Lobby.d.ts.map +1 -1
- package/dist/typescript/components/Call/Lobby/LobbyFooter.d.ts.map +1 -1
- package/dist/typescript/components/Call/RingingCallContent/OutgoingCall.d.ts.map +1 -1
- package/dist/typescript/components/Livestream/LivestreamControls/HostStartStreamButton.d.ts.map +1 -1
- package/dist/typescript/components/Livestream/LivestreamPlayer/LivestreamEnded.d.ts.map +1 -1
- package/dist/typescript/components/Livestream/ViewerLivestream/ViewerLobby.d.ts.map +1 -1
- package/dist/typescript/components/Participant/ParticipantView/ParticipantLabel.d.ts.map +1 -1
- package/dist/typescript/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.d.ts +11 -0
- package/dist/typescript/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.d.ts.map +1 -1
- package/dist/typescript/components/utility/ScreenShareOverlay.d.ts.map +1 -1
- package/dist/typescript/i18n/Streami18n.d.ts +61 -0
- package/dist/typescript/i18n/Streami18n.d.ts.map +1 -0
- package/dist/typescript/i18n/TranslationContext.d.ts +31 -0
- package/dist/typescript/i18n/TranslationContext.d.ts.map +1 -0
- package/dist/typescript/i18n/index.d.ts +17 -0
- package/dist/typescript/i18n/index.d.ts.map +1 -0
- package/dist/typescript/i18n/keys.d.ts +38 -0
- package/dist/typescript/i18n/keys.d.ts.map +1 -0
- package/dist/typescript/i18n/runtimeDefaults.d.ts +18 -0
- package/dist/typescript/i18n/runtimeDefaults.d.ts.map +1 -0
- package/dist/typescript/i18n/types.d.ts +46 -0
- package/dist/typescript/i18n/types.d.ts.map +1 -0
- package/dist/typescript/i18n/useStreami18n.d.ts +20 -0
- package/dist/typescript/i18n/useStreami18n.d.ts.map +1 -0
- package/dist/typescript/index.d.ts +2 -1
- package/dist/typescript/index.d.ts.map +1 -1
- package/dist/typescript/modules/encryption/EncryptionManager.d.ts +190 -0
- package/dist/typescript/modules/encryption/EncryptionManager.d.ts.map +1 -0
- package/dist/typescript/modules/encryption/eventMapping.d.ts +38 -0
- package/dist/typescript/modules/encryption/eventMapping.d.ts.map +1 -0
- package/dist/typescript/modules/encryption/index.d.ts +2 -0
- package/dist/typescript/modules/encryption/index.d.ts.map +1 -0
- package/dist/typescript/modules/encryption/parity.d.ts +55 -0
- package/dist/typescript/modules/encryption/parity.d.ts.map +1 -0
- package/dist/typescript/providers/NoiseCancellation/NoiseCancellationProvider.d.ts.map +1 -1
- package/dist/typescript/providers/StreamVideo.d.ts +17 -4
- package/dist/typescript/providers/StreamVideo.d.ts.map +1 -1
- package/dist/typescript/utils/StreamVideoRN/index.d.ts +33 -1
- package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
- package/dist/typescript/utils/StreamVideoRN/types.d.ts +67 -0
- package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
- package/dist/typescript/utils/internal/callingx/callingx.d.ts +1 -1
- package/dist/typescript/utils/internal/callingx/callingx.d.ts.map +1 -1
- package/dist/typescript/utils/internal/iosPipTrack.d.ts +9 -0
- package/dist/typescript/utils/internal/iosPipTrack.d.ts.map +1 -0
- package/dist/typescript/utils/internal/registerSDKGlobals.d.ts.map +1 -1
- package/dist/typescript/utils/internal/ringingCallLifecycle.d.ts +27 -0
- package/dist/typescript/utils/internal/ringingCallLifecycle.d.ts.map +1 -0
- package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
- package/dist/typescript/version.d.ts +1 -1
- package/ios/RTCViewPip.swift +33 -8
- package/ios/RTCViewPipManager.mm +1 -0
- package/package.json +17 -13
- package/src/components/Call/CallContent/CallContent.tsx +1 -1
- package/src/components/Call/CallContent/RTCViewPipIOS.tsx +92 -10
- package/src/components/Call/CallContent/RTCViewPipNative.tsx +13 -0
- package/src/components/Call/Lobby/JoinCallButton.tsx +5 -2
- package/src/components/Call/Lobby/Lobby.tsx +6 -3
- package/src/components/Call/Lobby/LobbyFooter.tsx +15 -10
- package/src/components/Call/RingingCallContent/CallLeftIndicator.tsx +2 -2
- package/src/components/Call/RingingCallContent/CallPreparingIndicator.tsx +2 -2
- package/src/components/Call/RingingCallContent/IncomingCall.tsx +2 -2
- package/src/components/Call/RingingCallContent/OutgoingCall.tsx +7 -14
- package/src/components/Livestream/LivestreamControls/HostStartStreamButton.tsx +5 -8
- package/src/components/Livestream/LivestreamPlayer/LivestreamEnded.tsx +11 -3
- package/src/components/Livestream/LivestreamTopView/LiveIndicator.tsx +2 -2
- package/src/components/Livestream/ViewerLivestream/ViewerLobby.tsx +23 -10
- package/src/components/Participant/ParticipantView/ParticipantLabel.tsx +15 -6
- package/src/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.tsx +58 -5
- package/src/components/utility/ScreenShareOverlay.tsx +7 -3
- package/src/i18n/Streami18n.ts +71 -0
- package/src/i18n/TranslationContext.tsx +55 -0
- package/src/i18n/index.ts +22 -0
- package/src/i18n/keys.ts +42 -0
- package/src/i18n/runtimeDefaults.ts +17 -0
- package/src/i18n/types.ts +78 -0
- package/src/i18n/useStreami18n.ts +66 -0
- package/src/index.ts +6 -1
- package/src/modules/call-manager/native-module.d.ts +14 -0
- package/src/modules/encryption/EncryptionManager.ts +360 -0
- package/src/modules/encryption/eventMapping.ts +151 -0
- package/src/modules/encryption/index.ts +1 -0
- package/src/modules/encryption/parity.ts +83 -0
- package/src/providers/NoiseCancellation/NoiseCancellationProvider.tsx +8 -4
- package/src/providers/StreamVideo.tsx +39 -28
- package/src/utils/StreamVideoRN/index.ts +51 -1
- package/src/utils/StreamVideoRN/types.ts +68 -0
- package/src/utils/internal/callingx/callingx.ts +37 -2
- package/src/utils/internal/iosPipTrack.ts +39 -0
- package/src/utils/internal/registerSDKGlobals.ts +2 -0
- package/src/utils/internal/ringingCallLifecycle.ts +148 -0
- package/src/utils/push/internal/utils.ts +4 -0
- package/src/version.ts +1 -1
- package/dist/commonjs/translations/en.json +0 -32
- package/dist/commonjs/translations/index.js +0 -12
- package/dist/commonjs/translations/index.js.map +0 -1
- package/dist/module/translations/en.json +0 -32
- package/dist/module/translations/index.js +0 -7
- package/dist/module/translations/index.js.map +0 -1
- package/dist/typescript/translations/index.d.ts +0 -35
- package/dist/typescript/translations/index.d.ts.map +0 -1
- package/src/translations/en.json +0 -32
- package/src/translations/index.ts +0 -3
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { useStreami18nState } from '@stream-io/i18n/react';
|
|
5
|
+
import { Streami18n } from './Streami18n';
|
|
6
|
+
/**
|
|
7
|
+
* Resolves the translation context value: creates or adopts a {@link Streami18n} instance,
|
|
8
|
+
* registers the supplied dictionaries, initializes it and keeps `t` fresh across language changes.
|
|
9
|
+
*
|
|
10
|
+
* `init()` and the store subscription belong to `useStreami18nState` in `@stream-io/i18n/react`,
|
|
11
|
+
* shared with the web SDK.
|
|
12
|
+
*/
|
|
13
|
+
export const useStreami18n = ({
|
|
14
|
+
i18nInstance,
|
|
15
|
+
language,
|
|
16
|
+
translations
|
|
17
|
+
}) => {
|
|
18
|
+
// Lazy `useState`, not `useMemo`: `new Streami18n()` is a real allocation with identity that must
|
|
19
|
+
// survive a re-render, and this repo lints `react-hooks/purity` as an error — `useMemo` is a
|
|
20
|
+
// cache React is free to drop, so constructing there is a purity violation. A later change to
|
|
21
|
+
// `i18nInstance` is ignored on purpose; swapping the instance mid-tree is not a supported move.
|
|
22
|
+
const [i18n] = useState(() => {
|
|
23
|
+
const instance = i18nInstance ?? new Streami18n({
|
|
24
|
+
language
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Registered here rather than in an effect. `useStreami18nState` calls `init()` from its own
|
|
28
|
+
// effect, which runs *before* any effect declared below it in this hook — so a dictionary
|
|
29
|
+
// registered in an effect would arrive after i18next was already initialized, and the first
|
|
30
|
+
// `init()` would warn that the language has no dictionary.
|
|
31
|
+
if (translations) {
|
|
32
|
+
for (const [code, dictionary] of Object.entries(translations)) {
|
|
33
|
+
instance.registerTranslation(code, dictionary);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return instance;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// No `onInitError` handler: core already logs a warning and leaves the instance usable, with `t`
|
|
40
|
+
// still rendering each call site's inline English. Pass one only to surface init failures
|
|
41
|
+
// somewhere other than the console.
|
|
42
|
+
const translators = useStreami18nState(i18n);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
// Guarded on the current value: `setLanguage` re-runs the formatter factories and a full
|
|
45
|
+
// i18next `changeLanguage`, and the first render already constructed the instance with
|
|
46
|
+
// `language`. Undefined means "leave whatever the instance was configured with".
|
|
47
|
+
if (!language || i18n.currentLanguage === language) return;
|
|
48
|
+
i18n.setLanguage(language);
|
|
49
|
+
}, [i18n, language]);
|
|
50
|
+
|
|
51
|
+
// Returned as-is: `useStreami18nState` already caches this object and only produces a new one
|
|
52
|
+
// when `t` or `tDateTimeParser` actually changes, so wrapping it in a `useMemo` would add a
|
|
53
|
+
// second cache over a stable value.
|
|
54
|
+
return translators;
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=useStreami18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useState","useStreami18nState","Streami18n","useStreami18n","i18nInstance","language","translations","i18n","instance","code","dictionary","Object","entries","registerTranslation","translators","currentLanguage","setLanguage"],"sourceRoot":"../../../src","sources":["i18n/useStreami18n.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,SAASC,UAAU,QAAQ,cAAc;AAazC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAGA,CAAC;EAC5BC,YAAY;EACZC,QAAQ;EACRC;AACmB,CAAC,KAA8B;EAClD;EACA;EACA;EACA;EACA,MAAM,CAACC,IAAI,CAAC,GAAGP,QAAQ,CAAC,MAAM;IAC5B,MAAMQ,QAAQ,GAAGJ,YAAY,IAAI,IAAIF,UAAU,CAAC;MAAEG;IAAS,CAAC,CAAC;;IAE7D;IACA;IACA;IACA;IACA,IAAIC,YAAY,EAAE;MAChB,KAAK,MAAM,CAACG,IAAI,EAAEC,UAAU,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACN,YAAY,CAAC,EAAE;QAC7DE,QAAQ,CAACK,mBAAmB,CAACJ,IAAI,EAAEC,UAAU,CAAC;MAChD;IACF;IAEA,OAAOF,QAAQ;EACjB,CAAC,CAAC;;EAEF;EACA;EACA;EACA,MAAMM,WAAW,GAAGb,kBAAkB,CAACM,IAAI,CAAC;EAE5CR,SAAS,CAAC,MAAM;IACd;IACA;IACA;IACA,IAAI,CAACM,QAAQ,IAAIE,IAAI,CAACQ,eAAe,KAAKV,QAAQ,EAAE;IACpDE,IAAI,CAACS,WAAW,CAACX,QAAQ,CAAC;EAC5B,CAAC,EAAE,CAACE,IAAI,EAAEF,QAAQ,CAAC,CAAC;;EAEpB;EACA;EACA;EACA,OAAOS,WAAW;AACpB,CAAC","ignoreList":[]}
|
package/dist/module/index.js
CHANGED
|
@@ -30,13 +30,18 @@ export * from './contexts';
|
|
|
30
30
|
export * from './hooks';
|
|
31
31
|
export * from './theme';
|
|
32
32
|
export * from './utils';
|
|
33
|
-
export * from './
|
|
33
|
+
export * from './i18n';
|
|
34
34
|
export * from './modules/call-manager';
|
|
35
35
|
|
|
36
36
|
// Overriding 'StreamVideo' and 'StreamCall' from '@stream-io/video-react-bindings'
|
|
37
37
|
// Explicitly re-exporting to resolve ambiguity.
|
|
38
38
|
export { StreamVideo } from './providers/StreamVideo';
|
|
39
39
|
export { StreamCall } from './providers/StreamCall';
|
|
40
|
+
// Overriding 'EncryptionManager' from '@stream-io/video-client' with the React
|
|
41
|
+
// Native implementation, which is backed by the native WebRTC transform. React
|
|
42
|
+
// Native Web is not supported: `isSupported()` returns false there rather than
|
|
43
|
+
// falling back to the web manager.
|
|
44
|
+
export { EncryptionManager } from './modules/encryption';
|
|
40
45
|
export * from './providers/NoiseCancellation';
|
|
41
46
|
setClientDetails();
|
|
42
47
|
//# sourceMappingURL=index.js.map
|
package/dist/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["setClientDetails","registerGlobals","Logger","Platform","registerSDKGlobals","OS","enable","ROOT_PREFIX","StreamVideo","StreamCall"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,0BAA0B;AAC3D;AACA,OAAO,wBAAwB;AAC/B;AACA,OAAO,gCAAgC;AACvC;AACA,OAAO,kBAAkB;AACzB,SAASC,eAAe,QAAQ,gCAAgC;AAChE,OAAOC,MAAM,MAAM,2CAA2C;AAC9D,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,kBAAkB,QAAQ,qCAAqC;AACxE,OAAO,mCAAmC;;AAE1C;AACA;AACA;AACA,IAAID,QAAQ,CAACE,EAAE,KAAK,KAAK,EAAE;EACzBJ,eAAe,CAAC,CAAC;EACjBG,kBAAkB,CAAC,CAAC;AACtB;;AAEA;AACAF,MAAM,CAACI,MAAM,CAAC,GAAGJ,MAAM,CAACK,WAAW,eAAe,CAAC;AAEnD,cAAc,yBAAyB;AACvC,cAAc,iCAAiC;AAC/C,cAAc,cAAc;AAC5B,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,
|
|
1
|
+
{"version":3,"names":["setClientDetails","registerGlobals","Logger","Platform","registerSDKGlobals","OS","enable","ROOT_PREFIX","StreamVideo","StreamCall","EncryptionManager"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,0BAA0B;AAC3D;AACA,OAAO,wBAAwB;AAC/B;AACA,OAAO,gCAAgC;AACvC;AACA,OAAO,kBAAkB;AACzB,SAASC,eAAe,QAAQ,gCAAgC;AAChE,OAAOC,MAAM,MAAM,2CAA2C;AAC9D,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,kBAAkB,QAAQ,qCAAqC;AACxE,OAAO,mCAAmC;;AAE1C;AACA;AACA;AACA,IAAID,QAAQ,CAACE,EAAE,KAAK,KAAK,EAAE;EACzBJ,eAAe,CAAC,CAAC;EACjBG,kBAAkB,CAAC,CAAC;AACtB;;AAEA;AACAF,MAAM,CAACI,MAAM,CAAC,GAAGJ,MAAM,CAACK,WAAW,eAAe,CAAC;AAEnD,cAAc,yBAAyB;AACvC,cAAc,iCAAiC;AAC/C,cAAc,cAAc;AAC5B,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,wBAAwB;;AAEtC;AACA;AACA,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,UAAU,QAAQ,wBAAwB;AACnD;AACA;AACA;AACA;AACA,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,cAAc,+BAA+B;AAE7CV,gBAAgB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { RTCEncryptionManager } from '@stream-io/react-native-webrtc';
|
|
4
|
+
import { TypedEventEmitter, videoLoggerSystem } from '@stream-io/video-client';
|
|
5
|
+
import { algorithmToNative, E2EE_EVENT_TYPES, mapNativeEvent, trackTypeToNative } from './eventMapping';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Distributes keys to the native encryption manager and attaches
|
|
9
|
+
* encrypt/decrypt transforms to RTCRtpSenders and RTCRtpReceivers.
|
|
10
|
+
*
|
|
11
|
+
* The public surface matches the web
|
|
12
|
+
* {@link https://github.com/GetStream/stream-video-js/blob/main/packages/client/src/rtc/e2ee/EncryptionManager.ts | EncryptionManager}
|
|
13
|
+
* method for method, so host code is portable between the two SDKs.
|
|
14
|
+
*
|
|
15
|
+
* The crypto itself lives in the WebRTC binary, not here: frames never cross
|
|
16
|
+
* the React Native bridge. This class carries key and attach commands over it,
|
|
17
|
+
* and diagnostic events back.
|
|
18
|
+
*
|
|
19
|
+
* Like the keys it installs, the manager is application-owned: create one per
|
|
20
|
+
* call, attach it before {@link https://github.com/GetStream/stream-video-js/blob/main/packages/client/src/Call.ts | Call}`.join()`,
|
|
21
|
+
* and {@link EncryptionManager.dispose | dispose} it when that call is done.
|
|
22
|
+
* Nothing in the SDK will do it for you, and on React Native the leak is native
|
|
23
|
+
* rather than collectable.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* if (EncryptionManager.isSupported()) {
|
|
28
|
+
* const e2ee = await EncryptionManager.create(call.currentUserId);
|
|
29
|
+
* e2ee.setSharedKey(0, keyBytes);
|
|
30
|
+
* call.setE2EEManager(e2ee); // must happen before call.join()
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export class EncryptionManager {
|
|
35
|
+
bridged = [];
|
|
36
|
+
disposed = false;
|
|
37
|
+
constructor(native, algorithm) {
|
|
38
|
+
this.native = native;
|
|
39
|
+
this.algorithm = algorithm;
|
|
40
|
+
this.logger = videoLoggerSystem.getLogger('EncryptionManager');
|
|
41
|
+
this.events = new TypedEventEmitter(this.logger);
|
|
42
|
+
// Native dispatches per event name, so the one handler is registered under
|
|
43
|
+
// each of them, and each registration has to be undone on dispose.
|
|
44
|
+
for (const type of E2EE_EVENT_TYPES) {
|
|
45
|
+
this.native.on(type, this.handleNativeEvent);
|
|
46
|
+
this.bridged.push([type, this.handleNativeEvent]);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
handleNativeEvent = data => {
|
|
50
|
+
const event = mapNativeEvent(data);
|
|
51
|
+
if (!event) return;
|
|
52
|
+
this.events.emit(event.type, event.payload);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Whether E2EE can run here. Use it to guard UI, or to avoid calling
|
|
57
|
+
* {@link create} where it would throw.
|
|
58
|
+
*
|
|
59
|
+
* `false` means the installed `@stream-io/react-native-webrtc` predates E2EE
|
|
60
|
+
* support.
|
|
61
|
+
*/
|
|
62
|
+
static isSupported = () => RTCEncryptionManager?.isSupported() ?? false;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Create an EncryptionManager and initialize the underlying native manager.
|
|
66
|
+
*
|
|
67
|
+
* Attach it with `call.setE2EEManager()` **before** `call.join()`: the join
|
|
68
|
+
* request carries the E2EE flag, and the peer connections are built with the
|
|
69
|
+
* transforms in place.
|
|
70
|
+
*
|
|
71
|
+
* Resolves rather than returning directly because every Stream SDK exposes
|
|
72
|
+
* this as a promise; nothing here is actually asynchronous, since a blocking
|
|
73
|
+
* native create is what keeps a sender from ever existing unencrypted.
|
|
74
|
+
*
|
|
75
|
+
* @param userId - The local user's ID, normally `call.currentUserId`.
|
|
76
|
+
* @param options - the create options.
|
|
77
|
+
* @throws {Error} If E2EE is unavailable. It never degrades to plaintext.
|
|
78
|
+
*/
|
|
79
|
+
static create = async (userId, options) => {
|
|
80
|
+
if (!RTCEncryptionManager) {
|
|
81
|
+
throw new Error('E2EE requires a version of @stream-io/react-native-webrtc that supports RTCEncryptionManager');
|
|
82
|
+
}
|
|
83
|
+
if (!RTCEncryptionManager.isSupported()) {
|
|
84
|
+
throw new Error('E2EE is not supported on this device');
|
|
85
|
+
}
|
|
86
|
+
const algorithm = options?.algorithm ?? 'AES-128-GCM';
|
|
87
|
+
const native = RTCEncryptionManager.create(userId, {
|
|
88
|
+
algorithm: algorithmToNative(algorithm)
|
|
89
|
+
});
|
|
90
|
+
return new EncryptionManager(native, algorithm);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Subscribe to an E2EE event.
|
|
95
|
+
*
|
|
96
|
+
* @returns a function that unsubscribes the listener.
|
|
97
|
+
*/
|
|
98
|
+
on = (event, fn) => this.events.on(event, fn);
|
|
99
|
+
|
|
100
|
+
/** Unsubscribe a listener registered with {@link on}. */
|
|
101
|
+
off = (event, fn) => this.events.off(event, fn);
|
|
102
|
+
|
|
103
|
+
/** Drop every listener, or every listener of one event. */
|
|
104
|
+
removeAllListeners = event => this.events.removeAllListeners(event);
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Set a per-user AES-GCM encryption key in the native key store.
|
|
108
|
+
*
|
|
109
|
+
* Use it when each participant has their own key from a central authority.
|
|
110
|
+
* The receiver picks the right one by the `keyIndex` in the frame trailer.
|
|
111
|
+
*
|
|
112
|
+
* @param userId - The key owner.
|
|
113
|
+
* @param keyIndex - Increases with each rotation.
|
|
114
|
+
* @param rawKey - 16 bytes for AES-128-GCM, 32 for AES-256-GCM.
|
|
115
|
+
*/
|
|
116
|
+
setKey = (userId, keyIndex, rawKey) => {
|
|
117
|
+
this.assertUsable();
|
|
118
|
+
this.validateKeyIndex(keyIndex);
|
|
119
|
+
this.validateKeyLength(rawKey);
|
|
120
|
+
this.native.setKey(userId, keyIndex, this.copyKey(rawKey));
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Fallback key for any user without a per-user key. The simplest E2EE mode:
|
|
125
|
+
* one key for everyone, usually passphrase-derived, no distribution needed.
|
|
126
|
+
* Setting an epoch makes it active for encryption while older epochs remain
|
|
127
|
+
* available to decrypt in-flight frames until {@link removeSharedKey}.
|
|
128
|
+
*
|
|
129
|
+
* @param keyIndex - An integer 0-255, since one trailer byte carries it.
|
|
130
|
+
* @param rawKey - 16 bytes for AES-128-GCM, 32 for AES-256-GCM.
|
|
131
|
+
*/
|
|
132
|
+
setSharedKey = (keyIndex, rawKey) => {
|
|
133
|
+
this.assertUsable();
|
|
134
|
+
this.validateKeyIndex(keyIndex);
|
|
135
|
+
this.validateKeyLength(rawKey);
|
|
136
|
+
this.native.setSharedKey(keyIndex, this.copyKey(rawKey));
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Retire one of a user's key epochs, leaving their other epochs usable.
|
|
141
|
+
*
|
|
142
|
+
* @param userId - The key owner.
|
|
143
|
+
* @param keyIndex - The exact epoch to remove. Absent epochs are a no-op.
|
|
144
|
+
*/
|
|
145
|
+
removeKey = (userId, keyIndex) => {
|
|
146
|
+
this.assertUsable();
|
|
147
|
+
this.validateKeyIndex(keyIndex);
|
|
148
|
+
this.native.removeKey(userId, keyIndex);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Drop every key a user holds from the local key store, so later frames of
|
|
153
|
+
* theirs no longer decrypt.
|
|
154
|
+
*
|
|
155
|
+
* This is local cleanup, not remote revocation: it cannot stop that
|
|
156
|
+
* participant from decrypting anything, and a shared key still decrypts them.
|
|
157
|
+
* Revoking access means withholding future keys, which the application owns.
|
|
158
|
+
*
|
|
159
|
+
* To retire one rotated epoch instead, use {@link removeKey}.
|
|
160
|
+
*/
|
|
161
|
+
removeAllKeys = userId => {
|
|
162
|
+
this.assertUsable();
|
|
163
|
+
this.native.removeAllKeys(userId);
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Remove one shared-key epoch from the native receive key ring.
|
|
168
|
+
*
|
|
169
|
+
* If this is the active epoch, shared-key encryption stops until
|
|
170
|
+
* {@link setSharedKey} succeeds again. An older epoch is not reactivated.
|
|
171
|
+
*
|
|
172
|
+
* @param keyIndex - The exact shared-key epoch to remove.
|
|
173
|
+
*/
|
|
174
|
+
removeSharedKey = keyIndex => {
|
|
175
|
+
this.assertUsable();
|
|
176
|
+
this.validateKeyIndex(keyIndex);
|
|
177
|
+
this.native.removeSharedKey(keyIndex);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Called by the Publisher when it adds a transceiver.
|
|
182
|
+
*
|
|
183
|
+
* Synchronous all the way to the native `SetFrameTransformer` call: were it
|
|
184
|
+
* async, the sender would exist before its transform did, which is a
|
|
185
|
+
* plaintext window. A failure throws instead of publishing cleartext.
|
|
186
|
+
*
|
|
187
|
+
* @param sender - The sender to encrypt.
|
|
188
|
+
* @param codec - Codec name, e.g. 'vp8', selecting the clear-byte rules.
|
|
189
|
+
* @param trackType - `TrackType` enum name, e.g. 'SCREEN_SHARE_AUDIO'.
|
|
190
|
+
* @internal
|
|
191
|
+
*/
|
|
192
|
+
encrypt = (sender, codec, trackType) => {
|
|
193
|
+
this.assertUsable();
|
|
194
|
+
this.native.encrypt(sender, codec, trackTypeToNative(trackType));
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Called by the Subscriber when a remote track arrives.
|
|
199
|
+
*
|
|
200
|
+
* @param receiver - The receiver to decrypt.
|
|
201
|
+
* @param userId - The remote user, for key lookup.
|
|
202
|
+
* @param trackType - `TrackType` enum name, e.g. 'SCREEN_SHARE_AUDIO'.
|
|
203
|
+
* @internal
|
|
204
|
+
*/
|
|
205
|
+
decrypt = (receiver, userId, trackType) => {
|
|
206
|
+
this.assertUsable();
|
|
207
|
+
this.native.decrypt(receiver, userId, trackTypeToNative(trackType));
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Toggle periodic performance reporting.
|
|
212
|
+
*
|
|
213
|
+
* While on, `e2ee.perf_report` is emitted once per second with per-track FPS
|
|
214
|
+
* and crypto timings. Useful for debugging throughput.
|
|
215
|
+
*/
|
|
216
|
+
enablePerformanceReporting = enabled => {
|
|
217
|
+
this.assertUsable();
|
|
218
|
+
// Observational, so it is the one native call that need not block. Kept
|
|
219
|
+
// void-returning to match the web manager.
|
|
220
|
+
this.native.enablePerformanceReporting(enabled).catch(err => this.logger.warn('Failed to toggle performance reporting', err));
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Request a snapshot of the installed keys. It arrives later as the
|
|
225
|
+
* `e2ee.key_state` event, listing fingerprints only, never key material.
|
|
226
|
+
*/
|
|
227
|
+
requestKeyState = () => {
|
|
228
|
+
this.assertUsable();
|
|
229
|
+
this.native.requestKeyState().catch(err => this.logger.warn('Failed to request key state', err));
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Release the native manager and all resources.
|
|
234
|
+
*
|
|
235
|
+
* **The application owns this object's lifetime — the SDK never disposes it.**
|
|
236
|
+
* Nothing releases the native manager when a peer connection closes, and there
|
|
237
|
+
* is no detach API, so an undisposed manager keeps its transforms and its key
|
|
238
|
+
* material alive for the lifetime of the process. Dispose it together with the
|
|
239
|
+
* call instance whose flow has ended; a later flow gets a fresh call and a
|
|
240
|
+
* fresh manager (see `Call.setE2EEManager`).
|
|
241
|
+
*
|
|
242
|
+
* In-flight frames are dropped rather than drained.
|
|
243
|
+
*
|
|
244
|
+
* The manager is unusable afterwards and every key or attach method throws.
|
|
245
|
+
* Call {@link create} for a new one. Safe to call more than once.
|
|
246
|
+
*/
|
|
247
|
+
dispose = () => {
|
|
248
|
+
if (this.disposed) return;
|
|
249
|
+
this.disposed = true;
|
|
250
|
+
for (const [type, handler] of this.bridged) {
|
|
251
|
+
this.native.off(type, handler);
|
|
252
|
+
}
|
|
253
|
+
this.bridged.length = 0;
|
|
254
|
+
try {
|
|
255
|
+
this.native.dispose();
|
|
256
|
+
} catch (err) {
|
|
257
|
+
// Local cleanup still has to finish, or listeners outlive the manager.
|
|
258
|
+
this.logger.warn('Failed to dispose the native encryption manager', err);
|
|
259
|
+
}
|
|
260
|
+
this.events.removeAllListeners();
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* {@link dispose} releases the native manager, so an attached transform would
|
|
265
|
+
* point at nothing: frames would stall with no error and no event. Throwing
|
|
266
|
+
* is also fail-closed, since a caller that swallows it still publishes
|
|
267
|
+
* nothing rather than cleartext.
|
|
268
|
+
*/
|
|
269
|
+
assertUsable = () => {
|
|
270
|
+
if (this.disposed) throw new Error(`EncryptionManager is disposed`);
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* The caller keeps ownership of its buffer and may re-import the same bytes,
|
|
275
|
+
* so hand native a copy rather than a view onto memory that can change.
|
|
276
|
+
*/
|
|
277
|
+
copyKey = rawKey => {
|
|
278
|
+
const copy = new Uint8Array(rawKey.byteLength);
|
|
279
|
+
copy.set(new Uint8Array(rawKey));
|
|
280
|
+
return copy;
|
|
281
|
+
};
|
|
282
|
+
validateKeyLength = rawKey => {
|
|
283
|
+
const is256 = this.algorithm === 'AES-256-GCM';
|
|
284
|
+
const expected = is256 ? 32 : 16;
|
|
285
|
+
if (rawKey.byteLength !== expected) {
|
|
286
|
+
throw new Error(`Key must be exactly ${expected} bytes (${is256 ? 'AES-256' : 'AES-128'})`);
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* One trailer byte carries the keyIndex. A larger value would truncate to
|
|
292
|
+
* `keyIndex & 0xFF`, so the receiver would look up the wrong key and fail
|
|
293
|
+
* every decrypt. Reject it rather than ship a silently broken key epoch.
|
|
294
|
+
*/
|
|
295
|
+
validateKeyIndex = keyIndex => {
|
|
296
|
+
if (!Number.isInteger(keyIndex) || keyIndex < 0 || keyIndex > 255) {
|
|
297
|
+
throw new Error(`keyIndex must be an integer between 0 and 255, got ${keyIndex}`);
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
//# sourceMappingURL=EncryptionManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["RTCEncryptionManager","TypedEventEmitter","videoLoggerSystem","algorithmToNative","E2EE_EVENT_TYPES","mapNativeEvent","trackTypeToNative","EncryptionManager","bridged","disposed","constructor","native","algorithm","logger","getLogger","events","type","on","handleNativeEvent","push","data","event","emit","payload","isSupported","create","userId","options","Error","fn","off","removeAllListeners","setKey","keyIndex","rawKey","assertUsable","validateKeyIndex","validateKeyLength","copyKey","setSharedKey","removeKey","removeAllKeys","removeSharedKey","encrypt","sender","codec","trackType","decrypt","receiver","enablePerformanceReporting","enabled","catch","err","warn","requestKeyState","dispose","handler","length","copy","Uint8Array","byteLength","set","is256","expected","Number","isInteger"],"sourceRoot":"../../../../src","sources":["modules/encryption/EncryptionManager.ts"],"mappings":";;AAAA,SACEA,oBAAoB,QAGf,gCAAgC;AACvC,SACEC,iBAAiB,EACjBC,iBAAiB,QAOZ,yBAAyB;AAChC,SACEC,iBAAiB,EACjBC,gBAAgB,EAChBC,cAAc,EACdC,iBAAiB,QACZ,gBAAgB;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,CAAwB;EAKnCC,OAAO,GAEpB,EAAE;EACEC,QAAQ,GAAG,KAAK;EAEhBC,WAAWA,CAACC,MAA4B,EAAEC,SAAwB,EAAE;IAC1E,IAAI,CAACD,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,MAAM,GAAGX,iBAAiB,CAACY,SAAS,CAAC,mBAAmB,CAAC;IAC9D,IAAI,CAACC,MAAM,GAAG,IAAId,iBAAiB,CAAe,IAAI,CAACY,MAAM,CAAC;IAC9D;IACA;IACA,KAAK,MAAMG,IAAI,IAAIZ,gBAAgB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;IAChC,OAAOwB,IAAI;EACb,CAAC;EAEOrB,iBAAiB,GAAIH,MAAmB,IAAK;IACnD,MAAM4B,KAAK,GAAG,IAAI,CAAClD,SAAS,KAAK,aAAa;IAC9C,MAAMmD,QAAQ,GAAGD,KAAK,GAAG,EAAE,GAAG,EAAE;IAChC,IAAI5B,MAAM,CAAC0B,UAAU,KAAKG,QAAQ,EAAE;MAClC,MAAM,IAAInC,KAAK,CACb,uBAAuBmC,QAAQ,WAAWD,KAAK,GAAG,SAAS,GAAG,SAAS,GACzE,CAAC;IACH;EACF,CAAC;;EAED;AACF;AACA;AACA;AACA;EACU1B,gBAAgB,GAAIH,QAAgB,IAAK;IAC/C,IAAI,CAAC+B,MAAM,CAACC,SAAS,CAAChC,QAAQ,CAAC,IAAIA,QAAQ,GAAG,CAAC,IAAIA,QAAQ,GAAG,GAAG,EAAE;MACjE,MAAM,IAAIL,KAAK,CACb,sDAAsDK,QAAQ,EAChE,CAAC;IACH;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { RTCEncryptionAlgorithm, RTCEncryptionTrackType } from '@stream-io/react-native-webrtc';
|
|
4
|
+
/**
|
|
5
|
+
* The core RTC layer labels tracks with the `TrackType` enum *name*
|
|
6
|
+
* (`SfuModels.TrackType[trackType]`), while the native manager takes a numeric
|
|
7
|
+
* enum. Screen-share audio is deliberately its own value: native keeps replay
|
|
8
|
+
* state per (userId, trackType), so folding it into `AUDIO` mis-groups it.
|
|
9
|
+
*
|
|
10
|
+
* These read the native enums inside the function body on purpose. This module
|
|
11
|
+
* is reachable from the SDK's public entry point, so an app whose
|
|
12
|
+
* `@stream-io/react-native-webrtc` predates E2EE would crash on import if the
|
|
13
|
+
* enums were dereferenced at module scope - even if it never touches E2EE.
|
|
14
|
+
*/
|
|
15
|
+
export const trackTypeToNative = trackType => {
|
|
16
|
+
switch (trackType) {
|
|
17
|
+
case 'AUDIO':
|
|
18
|
+
return RTCEncryptionTrackType.AUDIO;
|
|
19
|
+
case 'VIDEO':
|
|
20
|
+
return RTCEncryptionTrackType.VIDEO;
|
|
21
|
+
case 'SCREEN_SHARE':
|
|
22
|
+
return RTCEncryptionTrackType.SCREEN_SHARE;
|
|
23
|
+
case 'SCREEN_SHARE_AUDIO':
|
|
24
|
+
return RTCEncryptionTrackType.SCREEN_SHARE_AUDIO;
|
|
25
|
+
default:
|
|
26
|
+
// Native infers audio vs video from the sender rather than pinning a
|
|
27
|
+
// wrong value.
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** Map a native track type back to the name the web events carry. */
|
|
33
|
+
export const trackTypeFromNative = trackType => {
|
|
34
|
+
switch (trackType) {
|
|
35
|
+
case RTCEncryptionTrackType.AUDIO:
|
|
36
|
+
return 'AUDIO';
|
|
37
|
+
case RTCEncryptionTrackType.VIDEO:
|
|
38
|
+
return 'VIDEO';
|
|
39
|
+
case RTCEncryptionTrackType.SCREEN_SHARE:
|
|
40
|
+
return 'SCREEN_SHARE';
|
|
41
|
+
case RTCEncryptionTrackType.SCREEN_SHARE_AUDIO:
|
|
42
|
+
return 'SCREEN_SHARE_AUDIO';
|
|
43
|
+
default:
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** Map the public algorithm name to the native enum. */
|
|
49
|
+
export const algorithmToNative = algorithm => algorithm === 'AES-256-GCM' ? RTCEncryptionAlgorithm.AES_256_GCM : RTCEncryptionAlgorithm.AES_128_GCM;
|
|
50
|
+
const toTrackPerf = row => ({
|
|
51
|
+
userId: row.userId,
|
|
52
|
+
trackType: trackTypeFromNative(row.trackType) ?? '',
|
|
53
|
+
fps: row.fps,
|
|
54
|
+
maxCryptoMs: row.maxCryptoMs
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Translate a native event into the payload the web manager emits, so a host
|
|
59
|
+
* can write one set of handlers for both platforms.
|
|
60
|
+
*
|
|
61
|
+
* Two things have to be reshaped rather than passed through: native track types
|
|
62
|
+
* are numeric, and native flattens `managerId`/`type`/`userId` alongside the
|
|
63
|
+
* payload of every event, including the two (`perf_report`, `key_state`) that
|
|
64
|
+
* are not about a single user. Fields the web types require but native leaves
|
|
65
|
+
* optional get an explicit default, so a handler never reads `undefined` where
|
|
66
|
+
* its type promises a value.
|
|
67
|
+
*
|
|
68
|
+
* @returns the mapped event, or `undefined` for an unrecognized event name.
|
|
69
|
+
*/
|
|
70
|
+
export const mapNativeEvent = event => {
|
|
71
|
+
const {
|
|
72
|
+
type,
|
|
73
|
+
userId,
|
|
74
|
+
trackType,
|
|
75
|
+
keyIndex,
|
|
76
|
+
version,
|
|
77
|
+
reason
|
|
78
|
+
} = event;
|
|
79
|
+
const mapped = payload => ({
|
|
80
|
+
type,
|
|
81
|
+
payload
|
|
82
|
+
});
|
|
83
|
+
switch (type) {
|
|
84
|
+
case 'e2ee.decryption_failed':
|
|
85
|
+
case 'e2ee.decryption_resumed':
|
|
86
|
+
case 'e2ee.unencrypted_frame':
|
|
87
|
+
return mapped({
|
|
88
|
+
userId,
|
|
89
|
+
trackType: trackTypeFromNative(trackType)
|
|
90
|
+
});
|
|
91
|
+
case 'e2ee.missing_key':
|
|
92
|
+
return mapped({
|
|
93
|
+
userId,
|
|
94
|
+
keyIndex,
|
|
95
|
+
trackType: trackTypeFromNative(trackType)
|
|
96
|
+
});
|
|
97
|
+
case 'e2ee.decryption_stalled':
|
|
98
|
+
return mapped({
|
|
99
|
+
userId,
|
|
100
|
+
keyIndex: keyIndex ?? 0,
|
|
101
|
+
trackType: trackTypeFromNative(trackType)
|
|
102
|
+
});
|
|
103
|
+
case 'e2ee.encryption_failed':
|
|
104
|
+
return mapped({
|
|
105
|
+
userId,
|
|
106
|
+
trackType: trackTypeFromNative(trackType),
|
|
107
|
+
reason: reason ?? ''
|
|
108
|
+
});
|
|
109
|
+
case 'e2ee.unsupported_version':
|
|
110
|
+
return mapped({
|
|
111
|
+
userId,
|
|
112
|
+
trackType: trackTypeFromNative(trackType),
|
|
113
|
+
version: version ?? 0
|
|
114
|
+
});
|
|
115
|
+
case 'e2ee.perf_report':
|
|
116
|
+
return mapped({
|
|
117
|
+
encode: (event.encode ?? []).map(row => ({
|
|
118
|
+
...toTrackPerf(row),
|
|
119
|
+
codec: row.codec ?? ''
|
|
120
|
+
})),
|
|
121
|
+
decode: (event.decode ?? []).map(toTrackPerf)
|
|
122
|
+
});
|
|
123
|
+
case 'e2ee.key_state':
|
|
124
|
+
return mapped(event.keyState ?? {
|
|
125
|
+
perUserKeys: [],
|
|
126
|
+
sharedKeys: []
|
|
127
|
+
});
|
|
128
|
+
default:
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/** Every event the native manager emits, i.e. what the bridge subscribes to. */
|
|
134
|
+
export const E2EE_EVENT_TYPES = ['e2ee.decryption_failed', 'e2ee.decryption_resumed', 'e2ee.decryption_stalled', 'e2ee.encryption_failed', 'e2ee.missing_key', 'e2ee.unencrypted_frame', 'e2ee.unsupported_version', 'e2ee.perf_report', 'e2ee.key_state'];
|
|
135
|
+
//# sourceMappingURL=eventMapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["RTCEncryptionAlgorithm","RTCEncryptionTrackType","trackTypeToNative","trackType","AUDIO","VIDEO","SCREEN_SHARE","SCREEN_SHARE_AUDIO","undefined","trackTypeFromNative","algorithmToNative","algorithm","AES_256_GCM","AES_128_GCM","toTrackPerf","row","userId","fps","maxCryptoMs","mapNativeEvent","event","type","keyIndex","version","reason","mapped","payload","encode","map","codec","decode","keyState","perUserKeys","sharedKeys","E2EE_EVENT_TYPES"],"sourceRoot":"../../../../src","sources":["modules/encryption/eventMapping.ts"],"mappings":";;AAAA,SACEA,sBAAsB,EACtBC,sBAAsB,QAGjB,gCAAgC;AAOvC;A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F,GAAG,CAACd,WAAW;MAC9C,CAAC,CAAC;IACJ,KAAK,gBAAgB;MACnB,OAAOW,MAAM,CAACL,KAAK,CAACW,QAAQ,IAAI;QAAEC,WAAW,EAAE,EAAE;QAAEC,UAAU,EAAE;MAAG,CAAC,CAAC;IACtE;MACE,OAAOzB,SAAS;EACpB;AACF,CAAC;;AAED;AACA,OAAO,MAAM0B,gBAAgB,GAAG,CAC9B,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,wBAAwB,EACxB,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,CACR","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["EncryptionManager"],"sourceRoot":"../../../../src","sources":["modules/encryption/index.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["modules/encryption/parity.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -35,8 +35,12 @@ export const NoiseCancellationProvider = props => {
|
|
|
35
35
|
const [isEnabled, setIsEnabled] = useState(false);
|
|
36
36
|
useEffect(() => {
|
|
37
37
|
const noiseCancellationNativeLib = getNoiseCancellationLibThrowIfNotInstalled();
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
try {
|
|
39
|
+
setDeviceSupportsAdvancedAudioProcessing(noiseCancellationNativeLib.deviceSupportsAdvancedAudioProcessing());
|
|
40
|
+
setIsEnabled(noiseCancellationNativeLib.isEnabled());
|
|
41
|
+
} catch (err) {
|
|
42
|
+
console.error('Failed to read noise cancellation state', err);
|
|
43
|
+
}
|
|
40
44
|
}, []);
|
|
41
45
|
const isSupported = hasCapability && noiseCancellationAllowed;
|
|
42
46
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","createContext","useContext","useEffect","useState","NoiseCancellationSettingsModeEnum","OwnCapability","videoLoggerSystem","useCall","useCallStateHooks","getNoiseCancellationLibThrowIfNotInstalled","NoiseCancellationWrapper","jsx","_jsx","NoiseCancellationContext","useNoiseCancellation","context","Error","NoiseCancellationProvider","props","call","deviceSupportsAdvancedAudioProcessing","setDeviceSupportsAdvancedAudioProcessing","useCallSettings","useHasPermissions","settings","noiseCancellationAllowed","audio","noise_cancellation","mode","DISABLED","hasCapability","ENABLE_NOISE_CANCELLATION","isEnabled","setIsEnabled","noiseCancellationNativeLib","
|
|
1
|
+
{"version":3,"names":["React","createContext","useContext","useEffect","useState","NoiseCancellationSettingsModeEnum","OwnCapability","videoLoggerSystem","useCall","useCallStateHooks","getNoiseCancellationLibThrowIfNotInstalled","NoiseCancellationWrapper","jsx","_jsx","NoiseCancellationContext","useNoiseCancellation","context","Error","NoiseCancellationProvider","props","call","deviceSupportsAdvancedAudioProcessing","setDeviceSupportsAdvancedAudioProcessing","useCallSettings","useHasPermissions","settings","noiseCancellationAllowed","audio","noise_cancellation","mode","DISABLED","hasCapability","ENABLE_NOISE_CANCELLATION","isEnabled","setIsEnabled","noiseCancellationNativeLib","err","console","error","isSupported","ncInstance","getInstance","unsubscribe","on","v","microphone","enableNoiseCancellation","catch","getLogger","disableNoiseCancellation","Provider","value","setEnabled","enabledOrSetter","enable","disable","children"],"sourceRoot":"../../../../src","sources":["providers/NoiseCancellation/NoiseCancellationProvider.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IACVC,aAAa,EAEbC,UAAU,EACVC,SAAS,EACTC,QAAQ,QACH,OAAO;AACd,SACEC,iCAAiC,EACjCC,aAAa,EACbC,iBAAiB,QACZ,yBAAyB;AAEhC,SAASC,OAAO,EAAEC,iBAAiB,QAAQ,iCAAiC;AAC5E,SACEC,0CAA0C,EAC1CC,wBAAwB,QACnB,OAAO;;AAEd;AACA;AACA;AAFA,SAAAC,GAAA,IAAAC,IAAA;AA2BA,MAAMC,wBAAwB,gBAAGb,aAAa,CAC5C,IAC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