Update RTCSession configuration to non deprecated names. (#3267)

* Update RTCSession configuration to non deprecated names.

* bump js-sdk

* es2024 and array buffer adaptions

* Alternative without `createKeyMaterialFromBuffer`
This commit is contained in:
Timo
2025-05-19 18:04:07 +02:00
committed by GitHub
parent 0110465b38
commit 28246ef86b
5 changed files with 33 additions and 25 deletions

View File

@@ -102,7 +102,7 @@
"livekit-client": "^2.11.3", "livekit-client": "^2.11.3",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"loglevel": "^1.9.1", "loglevel": "^1.9.1",
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#19b1b901f575755d29d1fe03ca48cbf7c1cae05c", "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#457a300c9594dc24ba2f05cc16180112b9e8d0ac",
"matrix-widget-api": "1.11.0", "matrix-widget-api": "1.11.0",
"normalize.css": "^8.0.1", "normalize.css": "^8.0.1",
"observable-hooks": "^4.2.3", "observable-hooks": "^4.2.3",

View File

@@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details. Please see LICENSE in the repository root for full details.
*/ */
import { BaseKeyProvider, createKeyMaterialFromBuffer } from "livekit-client"; import { BaseKeyProvider } from "livekit-client";
import { logger } from "matrix-js-sdk/lib/logger"; import { logger } from "matrix-js-sdk/lib/logger";
import { import {
type MatrixRTCSession, type MatrixRTCSession,
@@ -44,20 +44,29 @@ export class MatrixKeyProvider extends BaseKeyProvider {
encryptionKeyIndex: number, encryptionKeyIndex: number,
participantId: string, participantId: string,
): void => { ): void => {
createKeyMaterialFromBuffer(encryptionKey).then( crypto.subtle
(keyMaterial) => { .importKey("raw", encryptionKey, "HKDF", false, [
this.onSetEncryptionKey(keyMaterial, participantId, encryptionKeyIndex); "deriveBits",
"deriveKey",
])
.then(
(keyMaterial) => {
this.onSetEncryptionKey(
keyMaterial,
participantId,
encryptionKeyIndex,
);
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}`,
); );
}, },
(e) => { (e) => {
logger.error( logger.error(
`Failed to create key material from buffer for livekit room=${this.rtcSession?.room.roomId} participantId=${participantId} encryptionKeyIndex=${encryptionKeyIndex}`, `Failed to create key material from buffer for livekit room=${this.rtcSession?.room.roomId} participantId=${participantId} encryptionKeyIndex=${encryptionKeyIndex}`,
e, e,
); );
}, },
); );
}; };
} }

View File

@@ -121,10 +121,9 @@ export async function enterRTCSession(
...(useDeviceSessionMemberEvents !== undefined && { ...(useDeviceSessionMemberEvents !== undefined && {
useLegacyMemberEvents: !useDeviceSessionMemberEvents, useLegacyMemberEvents: !useDeviceSessionMemberEvents,
}), }),
membershipServerSideExpiryTimeout: delayedLeaveEventDelayMs:
matrixRtcSessionConfig?.membership_server_side_expiry_timeout, matrixRtcSessionConfig?.membership_server_side_expiry_timeout,
membershipKeepAlivePeriod: networkErrorRetryMs: matrixRtcSessionConfig?.membership_keep_alive_period,
matrixRtcSessionConfig?.membership_keep_alive_period,
makeKeyDelay: matrixRtcSessionConfig?.key_rotation_on_leave_delay, makeKeyDelay: matrixRtcSessionConfig?.key_rotation_on_leave_delay,
useExperimentalToDeviceTransport, useExperimentalToDeviceTransport,
}, },

View File

@@ -3,7 +3,7 @@
"target": "es2022", "target": "es2022",
"module": "es2022", "module": "es2022",
"jsx": "react-jsx", "jsx": "react-jsx",
"lib": ["es2022", "dom", "dom.iterable"], "lib": ["es2024", "dom", "dom.iterable"],
// From Matrix-JS-SDK // From Matrix-JS-SDK
"strict": true, "strict": true,

View File

@@ -7007,7 +7007,7 @@ __metadata:
livekit-client: "npm:^2.11.3" livekit-client: "npm:^2.11.3"
lodash-es: "npm:^4.17.21" lodash-es: "npm:^4.17.21"
loglevel: "npm:^1.9.1" loglevel: "npm:^1.9.1"
matrix-js-sdk: "github:matrix-org/matrix-js-sdk#19b1b901f575755d29d1fe03ca48cbf7c1cae05c" matrix-js-sdk: "github:matrix-org/matrix-js-sdk#457a300c9594dc24ba2f05cc16180112b9e8d0ac"
matrix-widget-api: "npm:1.11.0" matrix-widget-api: "npm:1.11.0"
normalize.css: "npm:^8.0.1" normalize.css: "npm:^8.0.1"
observable-hooks: "npm:^4.2.3" observable-hooks: "npm:^4.2.3"
@@ -9610,9 +9610,9 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"matrix-js-sdk@github:matrix-org/matrix-js-sdk#19b1b901f575755d29d1fe03ca48cbf7c1cae05c": "matrix-js-sdk@github:matrix-org/matrix-js-sdk#457a300c9594dc24ba2f05cc16180112b9e8d0ac":
version: 37.4.0 version: 37.5.0
resolution: "matrix-js-sdk@https://github.com/matrix-org/matrix-js-sdk.git#commit=19b1b901f575755d29d1fe03ca48cbf7c1cae05c" resolution: "matrix-js-sdk@https://github.com/matrix-org/matrix-js-sdk.git#commit=457a300c9594dc24ba2f05cc16180112b9e8d0ac"
dependencies: dependencies:
"@babel/runtime": "npm:^7.12.5" "@babel/runtime": "npm:^7.12.5"
"@matrix-org/matrix-sdk-crypto-wasm": "npm:^14.0.1" "@matrix-org/matrix-sdk-crypto-wasm": "npm:^14.0.1"
@@ -9629,7 +9629,7 @@ __metadata:
sdp-transform: "npm:^2.14.1" sdp-transform: "npm:^2.14.1"
unhomoglyph: "npm:^1.0.6" unhomoglyph: "npm:^1.0.6"
uuid: "npm:11" uuid: "npm:11"
checksum: 10c0/68a30a113059ba052b2e66502abcd9805f9a18a1bfd1d209203d728b36508af257a57e6248fb237c7018c81bfbe1ec78fa17aea8968c8af0729ea935398dcf8b checksum: 10c0/121ecbe4ab6c3ce3fe399ab468958211b0c1c565d6da718903ccc0abc4af7341c764ebee07a553a4222b338bd8665de9fa50bb34a247555b908c4c2b46a97deb
languageName: node languageName: node
linkType: hard linkType: hard