mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-08 20:09:19 +00:00
Extra logging
This commit is contained in:
@@ -15,12 +15,15 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { BaseKeyProvider, createKeyMaterialFromBuffer } from "livekit-client";
|
import { BaseKeyProvider, createKeyMaterialFromBuffer } from "livekit-client";
|
||||||
import { logger } from "matrix-js-sdk/src/logger";
|
import { encodeUnpaddedBase64 } from "matrix-js-sdk";
|
||||||
|
import { logger as parentLogger } from "matrix-js-sdk/src/logger";
|
||||||
import {
|
import {
|
||||||
MatrixRTCSession,
|
MatrixRTCSession,
|
||||||
MatrixRTCSessionEvent,
|
MatrixRTCSessionEvent,
|
||||||
} from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession";
|
} from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession";
|
||||||
|
|
||||||
|
const logger = parentLogger.getChild("MatrixKeyProvider");
|
||||||
|
|
||||||
export class MatrixKeyProvider extends BaseKeyProvider {
|
export class MatrixKeyProvider extends BaseKeyProvider {
|
||||||
private rtcSession?: MatrixRTCSession;
|
private rtcSession?: MatrixRTCSession;
|
||||||
|
|
||||||
@@ -29,6 +32,9 @@ export class MatrixKeyProvider extends BaseKeyProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public setRTCSession(rtcSession: MatrixRTCSession): void {
|
public setRTCSession(rtcSession: MatrixRTCSession): void {
|
||||||
|
logger.debug(
|
||||||
|
`Setting new RTC session for key provider: this.rtcSession=${!!this.rtcSession}`,
|
||||||
|
);
|
||||||
if (this.rtcSession) {
|
if (this.rtcSession) {
|
||||||
this.rtcSession.off(
|
this.rtcSession.off(
|
||||||
MatrixRTCSessionEvent.EncryptionKeyChanged,
|
MatrixRTCSessionEvent.EncryptionKeyChanged,
|
||||||
@@ -60,6 +66,10 @@ export class MatrixKeyProvider extends BaseKeyProvider {
|
|||||||
encryptionKeyIndex: number,
|
encryptionKeyIndex: number,
|
||||||
participantId: string,
|
participantId: string,
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
|
logger.debug(
|
||||||
|
`Will send key to livekit room=${this.rtcSession?.room.roomId} participantId=${participantId} encryptionKeyIndex=${encryptionKeyIndex}: ${encodeUnpaddedBase64(encryptionKey)}`,
|
||||||
|
);
|
||||||
|
|
||||||
this.onSetEncryptionKey(
|
this.onSetEncryptionKey(
|
||||||
await createKeyMaterialFromBuffer(encryptionKey),
|
await createKeyMaterialFromBuffer(encryptionKey),
|
||||||
participantId,
|
participantId,
|
||||||
@@ -67,7 +77,7 @@ export class MatrixKeyProvider extends BaseKeyProvider {
|
|||||||
);
|
);
|
||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
`Sent new key to livekit room=${this.rtcSession?.room.roomId} participantId=${participantId} encryptionKeyIndex=${encryptionKeyIndex}`,
|
`Sent new key to livekit room=${this.rtcSession?.room.roomId} participantId=${participantId} encryptionKeyIndex=${encryptionKeyIndex}: ${encodeUnpaddedBase64(encryptionKey)}`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user