diff --git a/src/e2ee/matrixKeyProvider.ts b/src/e2ee/matrixKeyProvider.ts index 0b810e01..abf1236e 100644 --- a/src/e2ee/matrixKeyProvider.ts +++ b/src/e2ee/matrixKeyProvider.ts @@ -38,27 +38,32 @@ export class MatrixKeyProvider extends BaseKeyProvider { this.onEncryptionKeyChanged ); + // The new session could be aware of keys of which the old session wasn't, + // so emit a key changed event. for (const [ participant, - encryptionKey, + encryptionKeys, ] of this.rtcSession.getEncryptionKeys()) { - // The new session could be aware of keys of which the old session wasn't, - // so emit a key changed event. - this.onEncryptionKeyChanged(encryptionKey, participant); + for (const [index, encryptionKey] of encryptionKeys.entries()) { + this.onEncryptionKeyChanged(encryptionKey, index, participant); + } } } private onEncryptionKeyChanged = async ( encryptionKey: string, + encryptionKeyIndex: number, participantId: string ) => { - console.log( - `Embedded-E2EE-LOG onEncryptionKeyChanged participantId=${participantId} encryptionKey=${encryptionKey}` - ); - this.onSetEncryptionKey( await createKeyMaterialFromString(encryptionKey), - participantId + participantId, + encryptionKeyIndex + ); + + console.log( + `Embedded-E2EE-LOG onEncryptionKeyChanged participantId=${participantId} encryptionKeyIndex=${encryptionKeyIndex} encryptionKey=${encryptionKey}`, + this.getKeys() ); }; } diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index c1fb0911..3b2100e3 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -176,12 +176,10 @@ export function InCallView({ const toggleMicrophone = useCallback(() => { muteStates.audio.setEnabled?.((e) => !e); - rtcSession.updateEncryptionKeyEvent(); - }, [muteStates, rtcSession]); + }, [muteStates]); const toggleCamera = useCallback(() => { muteStates.video.setEnabled?.((e) => !e); - rtcSession.updateEncryptionKeyEvent(); - }, [muteStates, rtcSession]); + }, [muteStates]); const joinRule = useJoinRule(rtcSession.room);