Handle indices

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner
2023-09-10 12:10:13 +02:00
parent a0f1184c40
commit 645b123bea
2 changed files with 16 additions and 13 deletions

View File

@@ -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()
);
};
}

View File

@@ -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);