mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
add key rotation debug information
This commit is contained in:
@@ -69,6 +69,23 @@ import { Slider } from "../Slider";
|
|||||||
import { useUrlParams } from "../UrlParams";
|
import { useUrlParams } from "../UrlParams";
|
||||||
import { type CallViewModel } from "../state/CallViewModel/CallViewModel.ts";
|
import { type CallViewModel } from "../state/CallViewModel/CallViewModel.ts";
|
||||||
import { getSFUConfigWithOpenID } from "../livekit/openIDSFU";
|
import { getSFUConfigWithOpenID } from "../livekit/openIDSFU";
|
||||||
|
import { useBehavior } from "../useBehavior";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows whether the call is large enough that MatrixRTC has stopped rotating the media key.
|
||||||
|
*/
|
||||||
|
const KeyRotationStatus: FC<{ vm: CallViewModel }> = ({ vm }) => {
|
||||||
|
const suppressed = useBehavior(vm.keyRotationSuppressed$);
|
||||||
|
const participantCount = useBehavior(vm.participantCount$);
|
||||||
|
return (
|
||||||
|
<p>
|
||||||
|
Media key rotation:{" "}
|
||||||
|
{suppressed
|
||||||
|
? `suppressed, participant limit reached (${participantCount} participants)`
|
||||||
|
: `active (${participantCount} participants)`}
|
||||||
|
</p>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
client: MatrixClient;
|
client: MatrixClient;
|
||||||
@@ -368,6 +385,7 @@ export const DeveloperSettingsTab: FC<Props> = ({
|
|||||||
id: client.getDeviceId() || "unknown",
|
id: client.getDeviceId() || "unknown",
|
||||||
})}
|
})}
|
||||||
</p>
|
</p>
|
||||||
|
{vm && <KeyRotationStatus vm={vm} />}
|
||||||
<Separator />
|
<Separator />
|
||||||
<FieldRow>
|
<FieldRow>
|
||||||
<InputField
|
<InputField
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ import {
|
|||||||
type LocalTransport,
|
type LocalTransport,
|
||||||
} from "./localMember/LocalTransport.ts";
|
} from "./localMember/LocalTransport.ts";
|
||||||
import {
|
import {
|
||||||
|
createKeyRotationSuppressed$,
|
||||||
createMemberships$,
|
createMemberships$,
|
||||||
membershipsAndTransports$,
|
membershipsAndTransports$,
|
||||||
} from "../SessionBehaviors.ts";
|
} from "../SessionBehaviors.ts";
|
||||||
@@ -301,6 +302,12 @@ export interface CallViewModel {
|
|||||||
* multiple devices.
|
* multiple devices.
|
||||||
*/
|
*/
|
||||||
participantCount$: Behavior<number>;
|
participantCount$: Behavior<number>;
|
||||||
|
/**
|
||||||
|
* Whether the call has grown large enough that MatrixRTC has stopped rotating the media
|
||||||
|
* encryption key. While this is true the key in use is still shared with new joiners, but no new
|
||||||
|
* key is generated when someone joins or leaves.
|
||||||
|
*/
|
||||||
|
keyRotationSuppressed$: Behavior<boolean>;
|
||||||
allConnections$: Behavior<ConnectionManagerData>;
|
allConnections$: Behavior<ConnectionManagerData>;
|
||||||
/** Participants sorted by livekit room so they can be used in the audio rendering */
|
/** Participants sorted by livekit room so they can be used in the audio rendering */
|
||||||
livekitRoomItems$: Behavior<LivekitRoomItem[]>;
|
livekitRoomItems$: Behavior<LivekitRoomItem[]>;
|
||||||
@@ -856,6 +863,11 @@ export function createCallViewModel$(
|
|||||||
matrixLivekitMembers$.pipe(map((ms) => ms.length)),
|
matrixLivekitMembers$.pipe(map((ms) => ms.length)),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const keyRotationSuppressed$ = createKeyRotationSuppressed$(
|
||||||
|
scope,
|
||||||
|
matrixRTCSession,
|
||||||
|
);
|
||||||
|
|
||||||
const leaveSoundEffect$ = userMedia$.pipe(
|
const leaveSoundEffect$ = userMedia$.pipe(
|
||||||
pairwise(),
|
pairwise(),
|
||||||
filter(
|
filter(
|
||||||
@@ -1782,6 +1794,7 @@ export function createCallViewModel$(
|
|||||||
),
|
),
|
||||||
allConnections$,
|
allConnections$,
|
||||||
participantCount$: participantCount$,
|
participantCount$: participantCount$,
|
||||||
|
keyRotationSuppressed$: keyRotationSuppressed$,
|
||||||
handsRaised$: handsRaised$,
|
handsRaised$: handsRaised$,
|
||||||
reactions$: reactions$,
|
reactions$: reactions$,
|
||||||
joinSoundEffect$: joinSoundEffect$,
|
joinSoundEffect$: joinSoundEffect$,
|
||||||
|
|||||||
@@ -88,3 +88,22 @@ export const createMemberships$ = (
|
|||||||
new Epoch(matrixRTCSession.memberships),
|
new Epoch(matrixRTCSession.memberships),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the session has grown large enough that MatrixRTC has stopped rotating the media
|
||||||
|
* encryption key. While this is true the key in use is still shared with new joiners, but no new
|
||||||
|
* key is generated when someone joins or leaves.
|
||||||
|
*/
|
||||||
|
export const createKeyRotationSuppressed$ = (
|
||||||
|
scope: ObservableScope,
|
||||||
|
matrixRTCSession: MatrixRTCSession,
|
||||||
|
): Behavior<boolean> => {
|
||||||
|
return scope.behavior(
|
||||||
|
fromEvent(
|
||||||
|
matrixRTCSession,
|
||||||
|
MatrixRTCSessionEvent.KeyRotationSuppressedChanged,
|
||||||
|
(suppressed: boolean) => suppressed,
|
||||||
|
),
|
||||||
|
matrixRTCSession.isKeyRotationSuppressed,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -490,6 +490,8 @@ export class MockRTCSession extends TypedEventEmitter<
|
|||||||
return this.joined;
|
return this.joined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public isKeyRotationSuppressed = false;
|
||||||
|
|
||||||
public withMemberships(
|
public withMemberships(
|
||||||
rtcMembers$: Behavior<Partial<CallMembership>[]>,
|
rtcMembers$: Behavior<Partial<CallMembership>[]>,
|
||||||
): MockRTCSession {
|
): MockRTCSession {
|
||||||
|
|||||||
Reference in New Issue
Block a user