Add option to enable to-device-encryption (#3167)

* enable to-device-encryption

* add logging for key provider

* make rooms encrypted

* add dev setting to choose to-device or room encryption

* add indicator when to-device is used.
This commit is contained in:
Timo
2025-04-11 10:07:50 +02:00
committed by GitHub
parent 1702b15abe
commit 3c0d81844f
10 changed files with 74 additions and 42 deletions

View File

@@ -10,6 +10,7 @@ import {
RoomContext,
useLocalParticipant,
} from "@livekit/components-react";
import { Text } from "@vector-im/compound-web";
import { ConnectionState, type Room } from "livekit-client";
import { type MatrixClient } from "matrix-js-sdk";
import {
@@ -94,11 +95,11 @@ import { ReactionsOverlay } from "./ReactionsOverlay";
import { CallEventAudioRenderer } from "./CallEventAudioRenderer";
import {
debugTileLayout as debugTileLayoutSetting,
useExperimentalToDeviceTransportSetting,
useSetting,
} from "../settings/settings";
import { ReactionsReader } from "../reactions/ReactionsReader";
import { ConnectionLostError } from "../utils/errors.ts";
const canScreenshare = "getDisplayMedia" in (navigator.mediaDevices ?? {});
const maxTapDurationMs = 400;
@@ -216,6 +217,10 @@ export const InCallView: FC<InCallViewProps> = ({
room: livekitRoom,
});
const [toDeviceEncryption] = useSetting(
useExperimentalToDeviceTransportSetting,
);
const toggleMicrophone = useCallback(
() => muteStates.audio.setEnabled?.((e) => !e),
[muteStates],
@@ -662,6 +667,18 @@ export const InCallView: FC<InCallViewProps> = ({
</RightNav>
</Header>
))}
{
// TODO: remove this once we remove the developer flag
// and find a better way to device what key transport to use.
toDeviceEncryption && (
<Text
style={{ height: 0, zIndex: 1, alignSelf: "center", margin: 0 }}
size="sm"
>
using to Device key transport
</Text>
)
}
<RoomAudioRenderer />
{renderContent()}
<CallEventAudioRenderer vm={vm} />