matrix-js-sdk 42.3.0 → 42.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/lib/@types/json.d.ts.map +1 -1
- package/lib/@types/json.js.map +1 -1
- package/lib/client.d.ts +74 -5
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +83 -7
- package/lib/client.js.map +1 -1
- package/lib/common-crypto/CryptoBackend.d.ts +42 -23
- package/lib/common-crypto/CryptoBackend.d.ts.map +1 -1
- package/lib/common-crypto/CryptoBackend.js +7 -0
- package/lib/common-crypto/CryptoBackend.js.map +1 -1
- package/lib/embedded.d.ts +35 -1
- package/lib/embedded.d.ts.map +1 -1
- package/lib/embedded.js +49 -1
- package/lib/embedded.js.map +1 -1
- package/lib/http-api/fetch.d.ts +0 -1
- package/lib/http-api/fetch.d.ts.map +1 -1
- package/lib/http-api/fetch.js +3 -22
- package/lib/http-api/fetch.js.map +1 -1
- package/lib/http-api/logging.d.ts +10 -0
- package/lib/http-api/logging.d.ts.map +1 -0
- package/lib/http-api/logging.js +46 -0
- package/lib/http-api/logging.js.map +1 -0
- package/lib/matrixrtc/EncryptionManager.d.ts +5 -0
- package/lib/matrixrtc/EncryptionManager.d.ts.map +1 -1
- package/lib/matrixrtc/EncryptionManager.js.map +1 -1
- package/lib/matrixrtc/LivekitTransport.d.ts +82 -0
- package/lib/matrixrtc/LivekitTransport.d.ts.map +1 -1
- package/lib/matrixrtc/LivekitTransport.js +25 -0
- package/lib/matrixrtc/LivekitTransport.js.map +1 -1
- package/lib/matrixrtc/MatrixRTCSession.d.ts +41 -2
- package/lib/matrixrtc/MatrixRTCSession.d.ts.map +1 -1
- package/lib/matrixrtc/MatrixRTCSession.js +59 -1
- package/lib/matrixrtc/MatrixRTCSession.js.map +1 -1
- package/lib/matrixrtc/MembershipManager.js +7 -4
- package/lib/matrixrtc/MembershipManager.js.map +1 -1
- package/lib/matrixrtc/RTCEncryptionManager.d.ts +17 -0
- package/lib/matrixrtc/RTCEncryptionManager.d.ts.map +1 -1
- package/lib/matrixrtc/RTCEncryptionManager.js +68 -29
- package/lib/matrixrtc/RTCEncryptionManager.js.map +1 -1
- package/lib/models/room-receipts.d.ts +9 -3
- package/lib/models/room-receipts.d.ts.map +1 -1
- package/lib/models/room-receipts.js +51 -11
- package/lib/models/room-receipts.js.map +1 -1
- package/lib/oauth/authorize.d.ts +7 -2
- package/lib/oauth/authorize.d.ts.map +1 -1
- package/lib/oauth/authorize.js +10 -4
- package/lib/oauth/authorize.js.map +1 -1
- package/lib/oauth/fetch.d.ts +17 -0
- package/lib/oauth/fetch.d.ts.map +1 -0
- package/lib/oauth/fetch.js +47 -0
- package/lib/oauth/fetch.js.map +1 -0
- package/lib/oauth/index.d.ts +15 -2
- package/lib/oauth/index.d.ts.map +1 -1
- package/lib/oauth/index.js +33 -12
- package/lib/oauth/index.js.map +1 -1
- package/lib/rust-crypto/index.d.ts +17 -0
- package/lib/rust-crypto/index.d.ts.map +1 -1
- package/lib/rust-crypto/index.js +4 -2
- package/lib/rust-crypto/index.js.map +1 -1
- package/lib/rust-crypto/rust-crypto.d.ts +6 -26
- package/lib/rust-crypto/rust-crypto.d.ts.map +1 -1
- package/lib/rust-crypto/rust-crypto.js +19 -54
- package/lib/rust-crypto/rust-crypto.js.map +1 -1
- package/lib/sliding-sync-sdk.d.ts.map +1 -1
- package/lib/sliding-sync-sdk.js +65 -27
- package/lib/sliding-sync-sdk.js.map +1 -1
- package/lib/sliding-sync.d.ts +17 -0
- package/lib/sliding-sync.d.ts.map +1 -1
- package/lib/sliding-sync.js +21 -9
- package/lib/sliding-sync.js.map +1 -1
- package/lib/sync.d.ts +9 -1
- package/lib/sync.d.ts.map +1 -1
- package/lib/sync.js +54 -29
- package/lib/sync.js.map +1 -1
- package/package.json +5 -5
- package/src/@types/json.ts +11 -2
- package/src/client.ts +126 -11
- package/src/common-crypto/CryptoBackend.ts +45 -23
- package/src/embedded.ts +67 -4
- package/src/http-api/fetch.ts +2 -23
- package/src/http-api/logging.ts +46 -0
- package/src/matrixrtc/EncryptionManager.ts +6 -0
- package/src/matrixrtc/LivekitTransport.ts +86 -0
- package/src/matrixrtc/MatrixRTCSession.ts +81 -1
- package/src/matrixrtc/MembershipManager.ts +7 -7
- package/src/matrixrtc/RTCEncryptionManager.ts +80 -31
- package/src/models/room-receipts.ts +54 -10
- package/src/oauth/authorize.ts +10 -2
- package/src/oauth/fetch.ts +54 -0
- package/src/oauth/index.ts +29 -10
- package/src/rust-crypto/index.ts +23 -0
- package/src/rust-crypto/rust-crypto.ts +25 -67
- package/src/sliding-sync-sdk.ts +73 -33
- package/src/sliding-sync.ts +31 -14
- package/src/sync.ts +58 -35
|
@@ -20,4 +20,86 @@ export interface LivekitFocusSelection extends Transport {
|
|
|
20
20
|
* @deprecated see LivekitFocusSelection
|
|
21
21
|
*/
|
|
22
22
|
export declare const isLivekitFocusSelection: (object: any) => object is LivekitFocusSelection;
|
|
23
|
+
/**
|
|
24
|
+
* Identifies the MatrixRTC membership that a LiveKit request is made for (MSC4195).
|
|
25
|
+
*
|
|
26
|
+
* Note that this is *not* the `member` field of an `m.rtc.member` event verbatim: the homeserver knows
|
|
27
|
+
* the user ID from the access token, and the device ID is only ever claimed, never verified.
|
|
28
|
+
*/
|
|
29
|
+
export interface LivekitRtcMember {
|
|
30
|
+
/**
|
|
31
|
+
* The ID of the member within the MatrixRTC session, i.e. the `member.id` of the `m.rtc.member` event.
|
|
32
|
+
*/
|
|
33
|
+
id: string;
|
|
34
|
+
/**
|
|
35
|
+
* The device ID the member claims to be using, i.e. the `member.device_id` of the `m.rtc.member` event.
|
|
36
|
+
*/
|
|
37
|
+
claimed_device_id?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The body of a request to the LiveKit `get_token` endpoint (MSC4195).
|
|
41
|
+
*
|
|
42
|
+
* Declared as a type alias rather than an interface so that it can be passed to the widget API
|
|
43
|
+
* (MSC4533), which expects request data to be assignable to an index signature.
|
|
44
|
+
*/
|
|
45
|
+
export type LivekitGetTokenRequest = {
|
|
46
|
+
/**
|
|
47
|
+
* The WebSocket URL of the LiveKit SFU to obtain a token for.
|
|
48
|
+
*/
|
|
49
|
+
url: string;
|
|
50
|
+
/**
|
|
51
|
+
* The room ID of the Matrix room the `m.rtc.member` event is in.
|
|
52
|
+
*/
|
|
53
|
+
room_id: string;
|
|
54
|
+
/**
|
|
55
|
+
* The slot ID from the `m.rtc.member` event.
|
|
56
|
+
*/
|
|
57
|
+
slot_id: string;
|
|
58
|
+
/**
|
|
59
|
+
* The MatrixRTC membership to obtain a token for.
|
|
60
|
+
*/
|
|
61
|
+
member: LivekitRtcMember;
|
|
62
|
+
/**
|
|
63
|
+
* The server name of the `m.rtc.member` event's sender. If omitted, the homeserver uses its own
|
|
64
|
+
* server name. This is what makes it possible to obtain a token for an SFU of a remote homeserver.
|
|
65
|
+
*/
|
|
66
|
+
server_name?: string;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* The response of the LiveKit `get_token` endpoint (MSC4195).
|
|
70
|
+
*/
|
|
71
|
+
export interface LivekitGetTokenResponse {
|
|
72
|
+
/**
|
|
73
|
+
* The JWT to authenticate with when connecting to the SFU.
|
|
74
|
+
*/
|
|
75
|
+
jwt: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The body of a request to the LiveKit `delegate_delayed_leave` endpoint (MSC4195).
|
|
79
|
+
*
|
|
80
|
+
* Declared as a type alias rather than an interface so that it can be passed to the widget API
|
|
81
|
+
* (MSC4533), which expects request data to be assignable to an index signature.
|
|
82
|
+
*/
|
|
83
|
+
export type LivekitDelegateDelayedLeaveRequest = {
|
|
84
|
+
/**
|
|
85
|
+
* The WebSocket URL of the LiveKit SFU that we are connected to.
|
|
86
|
+
*/
|
|
87
|
+
url: string;
|
|
88
|
+
/**
|
|
89
|
+
* The room ID of the Matrix room the `m.rtc.member` event is in.
|
|
90
|
+
*/
|
|
91
|
+
room_id: string;
|
|
92
|
+
/**
|
|
93
|
+
* The slot ID from the `m.rtc.member` event.
|
|
94
|
+
*/
|
|
95
|
+
slot_id: string;
|
|
96
|
+
/**
|
|
97
|
+
* The MatrixRTC membership the delayed leave event belongs to.
|
|
98
|
+
*/
|
|
99
|
+
member: LivekitRtcMember;
|
|
100
|
+
/**
|
|
101
|
+
* The delay ID of the delayed leave event to hand over to the homeserver.
|
|
102
|
+
*/
|
|
103
|
+
delay_id: string;
|
|
104
|
+
};
|
|
23
105
|
//# sourceMappingURL=LivekitTransport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LivekitTransport.d.ts","sourceRoot":"","sources":["../../src/matrixrtc/LivekitTransport.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,WAAW,sBAAuB,SAAQ,SAAS;IACrD,IAAI,EAAE,SAAS,CAAC;IAChB,mBAAmB,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,wBAAwB,WAAY,GAAG,KAAG,MAAM,IAAI,sBACD,CAAC;AAEjE,MAAM,WAAW,gBAAiB,SAAQ,sBAAsB;IAC5D,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,kBAAkB,WAAY,GAAG,KAAG,MAAM,IAAI,gBACM,CAAC;AAElE;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,SAAS;IACpD,IAAI,EAAE,SAAS,CAAC;IAChB,eAAe,EAAE,mBAAmB,GAAG,WAAW,CAAC;CACtD;AACD;;GAEG;AACH,eAAO,MAAM,uBAAuB,WAAY,GAAG,KAAG,MAAM,IAAI,qBACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"LivekitTransport.d.ts","sourceRoot":"","sources":["../../src/matrixrtc/LivekitTransport.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC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AEG;IACH,MAAM,EAAE,gBAAgB,CAAC;IACzB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -26,4 +26,29 @@ export const isLivekitTransport = object => isLivekitTransportConfig(object) &&
|
|
|
26
26
|
* @deprecated see LivekitFocusSelection
|
|
27
27
|
*/
|
|
28
28
|
export const isLivekitFocusSelection = object => object.type === "livekit" && "focus_selection" in object;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Identifies the MatrixRTC membership that a LiveKit request is made for (MSC4195).
|
|
32
|
+
*
|
|
33
|
+
* Note that this is *not* the `member` field of an `m.rtc.member` event verbatim: the homeserver knows
|
|
34
|
+
* the user ID from the access token, and the device ID is only ever claimed, never verified.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The body of a request to the LiveKit `get_token` endpoint (MSC4195).
|
|
39
|
+
*
|
|
40
|
+
* Declared as a type alias rather than an interface so that it can be passed to the widget API
|
|
41
|
+
* (MSC4533), which expects request data to be assignable to an index signature.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The response of the LiveKit `get_token` endpoint (MSC4195).
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The body of a request to the LiveKit `delegate_delayed_leave` endpoint (MSC4195).
|
|
50
|
+
*
|
|
51
|
+
* Declared as a type alias rather than an interface so that it can be passed to the widget API
|
|
52
|
+
* (MSC4533), which expects request data to be assignable to an index signature.
|
|
53
|
+
*/
|
|
29
54
|
//# sourceMappingURL=LivekitTransport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LivekitTransport.js","names":[],"sources":["../../src/matrixrtc/LivekitTransport.ts"],"sourcesContent":["/*\nCopyright 2025 New Vector Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type Transport } from \"./types.ts\";\n\nexport interface LivekitTransportConfig extends Transport {\n type: \"livekit\";\n livekit_service_url: string;\n}\n\nexport const isLivekitTransportConfig = (object: any): object is LivekitTransportConfig =>\n object.type === \"livekit\" && \"livekit_service_url\" in object;\n\nexport interface LivekitTransport extends LivekitTransportConfig {\n livekit_alias: string;\n}\n\nexport const isLivekitTransport = (object: any): object is LivekitTransport =>\n isLivekitTransportConfig(object) && \"livekit_alias\" in object;\n\n/**\n * @deprecated this is just needed for the old focus active / focus fields of a call membership.\n * Not needed for new implementations.\n */\nexport interface LivekitFocusSelection extends Transport {\n type: \"livekit\";\n focus_selection: \"oldest_membership\" | \"multi_sfu\";\n}\n/**\n * @deprecated see LivekitFocusSelection\n */\nexport const isLivekitFocusSelection = (object: any): object is LivekitFocusSelection =>\n object.type === \"livekit\" && \"focus_selection\" in object;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,OAAO,MAAM,wBAAwB,GAAI,MAAW,IAChD,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,qBAAqB,IAAI,MAAM;AAMhE,OAAO,MAAM,kBAAkB,GAAI,MAAW,IAC1C,wBAAwB,CAAC,MAAM,CAAC,IAAI,eAAe,IAAI,MAAM;;AAEjE;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA,OAAO,MAAM,uBAAuB,GAAI,MAAW,IAC/C,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,iBAAiB,IAAI,MAAM","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"LivekitTransport.js","names":[],"sources":["../../src/matrixrtc/LivekitTransport.ts"],"sourcesContent":["/*\nCopyright 2025 New Vector Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type Transport } from \"./types.ts\";\n\nexport interface LivekitTransportConfig extends Transport {\n type: \"livekit\";\n livekit_service_url: string;\n}\n\nexport const isLivekitTransportConfig = (object: any): object is LivekitTransportConfig =>\n object.type === \"livekit\" && \"livekit_service_url\" in object;\n\nexport interface LivekitTransport extends LivekitTransportConfig {\n livekit_alias: string;\n}\n\nexport const isLivekitTransport = (object: any): object is LivekitTransport =>\n isLivekitTransportConfig(object) && \"livekit_alias\" in object;\n\n/**\n * @deprecated this is just needed for the old focus active / focus fields of a call membership.\n * Not needed for new implementations.\n */\nexport interface LivekitFocusSelection extends Transport {\n type: \"livekit\";\n focus_selection: \"oldest_membership\" | \"multi_sfu\";\n}\n/**\n * @deprecated see LivekitFocusSelection\n */\nexport const isLivekitFocusSelection = (object: any): object is LivekitFocusSelection =>\n object.type === \"livekit\" && \"focus_selection\" in object;\n\n/**\n * Identifies the MatrixRTC membership that a LiveKit request is made for (MSC4195).\n *\n * Note that this is *not* the `member` field of an `m.rtc.member` event verbatim: the homeserver knows\n * the user ID from the access token, and the device ID is only ever claimed, never verified.\n */\nexport interface LivekitRtcMember {\n /**\n * The ID of the member within the MatrixRTC session, i.e. the `member.id` of the `m.rtc.member` event.\n */\n id: string;\n /**\n * The device ID the member claims to be using, i.e. the `member.device_id` of the `m.rtc.member` event.\n */\n claimed_device_id?: string;\n}\n\n/**\n * The body of a request to the LiveKit `get_token` endpoint (MSC4195).\n *\n * Declared as a type alias rather than an interface so that it can be passed to the widget API\n * (MSC4533), which expects request data to be assignable to an index signature.\n */\nexport type LivekitGetTokenRequest = {\n /**\n * The WebSocket URL of the LiveKit SFU to obtain a token for.\n */\n url: string;\n /**\n * The room ID of the Matrix room the `m.rtc.member` event is in.\n */\n room_id: string;\n /**\n * The slot ID from the `m.rtc.member` event.\n */\n slot_id: string;\n /**\n * The MatrixRTC membership to obtain a token for.\n */\n member: LivekitRtcMember;\n /**\n * The server name of the `m.rtc.member` event's sender. If omitted, the homeserver uses its own\n * server name. This is what makes it possible to obtain a token for an SFU of a remote homeserver.\n */\n server_name?: string;\n};\n\n/**\n * The response of the LiveKit `get_token` endpoint (MSC4195).\n */\nexport interface LivekitGetTokenResponse {\n /**\n * The JWT to authenticate with when connecting to the SFU.\n */\n jwt: string;\n}\n\n/**\n * The body of a request to the LiveKit `delegate_delayed_leave` endpoint (MSC4195).\n *\n * Declared as a type alias rather than an interface so that it can be passed to the widget API\n * (MSC4533), which expects request data to be assignable to an index signature.\n */\nexport type LivekitDelegateDelayedLeaveRequest = {\n /**\n * The WebSocket URL of the LiveKit SFU that we are connected to.\n */\n url: string;\n /**\n * The room ID of the Matrix room the `m.rtc.member` event is in.\n */\n room_id: string;\n /**\n * The slot ID from the `m.rtc.member` event.\n */\n slot_id: string;\n /**\n * The MatrixRTC membership the delayed leave event belongs to.\n */\n member: LivekitRtcMember;\n /**\n * The delay ID of the delayed leave event to hand over to the homeserver.\n */\n delay_id: string;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,OAAO,MAAM,wBAAwB,GAAI,MAAW,IAChD,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,qBAAqB,IAAI,MAAM;AAMhE,OAAO,MAAM,kBAAkB,GAAI,MAAW,IAC1C,wBAAwB,CAAC,MAAM,CAAC,IAAI,eAAe,IAAI,MAAM;;AAEjE;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA,OAAO,MAAM,uBAAuB,GAAI,MAAW,IAC/C,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,iBAAiB,IAAI,MAAM;;AAE5D;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;;AAyBA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@ import { type Room } from "../models/room.ts";
|
|
|
3
3
|
import { type MatrixClient } from "../client.ts";
|
|
4
4
|
import { CallMembership } from "./CallMembership.ts";
|
|
5
5
|
import { type CallMembershipIdentityParts } from "./EncryptionManager.ts";
|
|
6
|
-
import type { Statistics, RTCNotificationType, Status, IRTCNotificationContent, RTCCallIntent, Transport, SlotDescription, RtcSlotEventContent } from "./types.ts";
|
|
6
|
+
import type { Statistics, RTCNotificationType, Status, IRTCNotificationContent, RTCCallIntent, Transport, SlotDescription, RtcSlotEventContent, RtcSlotEncryptionContent } from "./types.ts";
|
|
7
7
|
import { MembershipManagerEvent, type MembershipManagerEventHandlerMap } from "./IMembershipManager.ts";
|
|
8
8
|
/**
|
|
9
9
|
* Events emitted by MatrixRTCSession
|
|
@@ -15,7 +15,9 @@ export declare enum MatrixRTCSessionEvent {
|
|
|
15
15
|
/** The membership manager had to shut down caused by an unrecoverable error */
|
|
16
16
|
MembershipManagerError = "membership_manager_error",
|
|
17
17
|
/** The RTCSession did send a call notification caused by joining the call as the first member */
|
|
18
|
-
DidSendCallNotification = "did_send_call_notification"
|
|
18
|
+
DidSendCallNotification = "did_send_call_notification",
|
|
19
|
+
/** Whether the session is too large for the media key to be rotated has changed */
|
|
20
|
+
KeyRotationSuppressedChanged = "key_rotation_suppressed_changed"
|
|
19
21
|
}
|
|
20
22
|
export type MatrixRTCSessionEventHandlerMap = {
|
|
21
23
|
[MatrixRTCSessionEvent.MembershipsChanged]: (oldMemberships: CallMembership[], newMemberships: CallMembership[]) => void;
|
|
@@ -25,6 +27,7 @@ export type MatrixRTCSessionEventHandlerMap = {
|
|
|
25
27
|
[MatrixRTCSessionEvent.DidSendCallNotification]: (notificationContentNew: {
|
|
26
28
|
event_id: string;
|
|
27
29
|
} & IRTCNotificationContent) => void;
|
|
30
|
+
[MatrixRTCSessionEvent.KeyRotationSuppressedChanged]: (isKeyRotationSuppressed: boolean) => void;
|
|
28
31
|
};
|
|
29
32
|
export interface SessionConfig {
|
|
30
33
|
/**
|
|
@@ -124,6 +127,16 @@ export interface EncryptionConfig {
|
|
|
124
127
|
* This has to be considered when choosing a value for this property.
|
|
125
128
|
*/
|
|
126
129
|
keyRotationGracePeriodMs?: number;
|
|
130
|
+
/**
|
|
131
|
+
* The number of participants in the session at which the media key will no longer be rotated.
|
|
132
|
+
*
|
|
133
|
+
* Rotating a key requires sending it to every participant device, so in large sessions the cost of rotating
|
|
134
|
+
* on every join/leave becomes prohibitive. At this limit the current key is kept and
|
|
135
|
+
* distributed to new joiners. No new keys are generated for joiners/leavers.
|
|
136
|
+
*
|
|
137
|
+
* Defaults to undefined.
|
|
138
|
+
*/
|
|
139
|
+
keyRotationParticipantLimit?: number;
|
|
127
140
|
/**
|
|
128
141
|
* The delay (in milliseconds) after a member leaves before we create and publish a new key, because people
|
|
129
142
|
* tend to leave calls at the same time.
|
|
@@ -190,6 +203,11 @@ export declare class MatrixRTCSession extends TypedEventEmitter<MatrixRTCSession
|
|
|
190
203
|
get membershipStatus(): Status | undefined;
|
|
191
204
|
get probablyLeft(): boolean | undefined;
|
|
192
205
|
get delayId(): string | undefined;
|
|
206
|
+
/**
|
|
207
|
+
* Whether the key rotation is currently halted.
|
|
208
|
+
* mirror of: EncryptionConfig.keyRotationParticipantLimit
|
|
209
|
+
*/
|
|
210
|
+
get isKeyRotationSuppressed(): boolean;
|
|
193
211
|
/**
|
|
194
212
|
* The callId (sessionId) of the call.
|
|
195
213
|
*
|
|
@@ -218,6 +236,27 @@ export declare class MatrixRTCSession extends TypedEventEmitter<MatrixRTCSession
|
|
|
218
236
|
* if no slot exists.
|
|
219
237
|
*/
|
|
220
238
|
isSlotClosed(): boolean | undefined;
|
|
239
|
+
/**
|
|
240
|
+
* Ensures this session's slot is open, sending a slot state event to open (or create) it if needed.
|
|
241
|
+
*
|
|
242
|
+
* The event's `application` is set from this session's slot description and its `encryption` from
|
|
243
|
+
* `opts.encryption`, replacing whatever an existing slot event declares. Other content is preserved.
|
|
244
|
+
* No-op if the slot is already open with matching `application` and `encryption`.
|
|
245
|
+
*
|
|
246
|
+
* @param opts.encryption - The encryption to declare on the slot, or `undefined` for none.
|
|
247
|
+
* @throws if sending the state event fails.
|
|
248
|
+
*/
|
|
249
|
+
ensureRtcSlotOpen(opts?: {
|
|
250
|
+
encryption?: RtcSlotEncryptionContent;
|
|
251
|
+
}): Promise<void>;
|
|
252
|
+
/**
|
|
253
|
+
* Ensures this session's slot is closed, sending a slot state event to close it if needed.
|
|
254
|
+
* The other content of the existing slot event is preserved. No-op if no slot event exists.
|
|
255
|
+
*
|
|
256
|
+
* @throws if sending the state event fails.
|
|
257
|
+
*/
|
|
258
|
+
ensureRtcSlotClosed(): Promise<void>;
|
|
259
|
+
private sendRtcSlot;
|
|
221
260
|
/**
|
|
222
261
|
* Returns all the call memberships for a room that match the provided `sessionDescription`,
|
|
223
262
|
* oldest first.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MatrixRTCSession.d.ts","sourceRoot":"","sources":["../../src/matrixrtc/MatrixRTCSession.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAIjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,KAAK,2BAA2B,EAA2B,MAAM,wBAAwB,CAAC;AAEnG,OAAO,KAAK,EACR,UAAU,EACV,mBAAmB,EACnB,MAAM,EACN,uBAAuB,EACvB,aAAa,EACb,SAAS,EACT,eAAe,EACf,mBAAmB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AAgB,CAI/B;IAEF;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAYlC;IAEF;;OAEG;IAEI,yBAAyB,QAAa,OAAO,CAAC,IAAI,CAAC,CAExD;IAGF,OAAO,CAAC,gCAAgC,CAAoC;IAE5E;;;;OAIG;IACH,OAAO,CAAC,+BAA+B;IAcvC;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CA0DxC;CACL"}
|
|
@@ -24,7 +24,7 @@ import { KnownMembership } from "../@types/membership.js";
|
|
|
24
24
|
import { CallMembership } from "./CallMembership.js";
|
|
25
25
|
import { RoomStateEvent } from "../models/room-state.js";
|
|
26
26
|
import { MembershipManager, StickyEventMembershipManager } from "./MembershipManager.js";
|
|
27
|
-
import { logDurationSync } from "../utils.js";
|
|
27
|
+
import { deepCompare, logDurationSync } from "../utils.js";
|
|
28
28
|
import { MembershipManagerEvent } from "./IMembershipManager.js";
|
|
29
29
|
import { RTCEncryptionManager } from "./RTCEncryptionManager.js";
|
|
30
30
|
import { ToDeviceKeyTransport } from "./ToDeviceKeyTransport.js";
|
|
@@ -48,6 +48,8 @@ export let MatrixRTCSessionEvent = /*#__PURE__*/function (MatrixRTCSessionEvent)
|
|
|
48
48
|
MatrixRTCSessionEvent["MembershipManagerError"] = "membership_manager_error";
|
|
49
49
|
/** The RTCSession did send a call notification caused by joining the call as the first member */
|
|
50
50
|
MatrixRTCSessionEvent["DidSendCallNotification"] = "did_send_call_notification";
|
|
51
|
+
/** Whether the session is too large for the media key to be rotated has changed */
|
|
52
|
+
MatrixRTCSessionEvent["KeyRotationSuppressedChanged"] = "key_rotation_suppressed_changed";
|
|
51
53
|
return MatrixRTCSessionEvent;
|
|
52
54
|
}({});
|
|
53
55
|
|
|
@@ -79,6 +81,14 @@ export class MatrixRTCSession extends TypedEventEmitter {
|
|
|
79
81
|
return this.membershipManager?.delayId;
|
|
80
82
|
}
|
|
81
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Whether the key rotation is currently halted.
|
|
86
|
+
* mirror of: EncryptionConfig.keyRotationParticipantLimit
|
|
87
|
+
*/
|
|
88
|
+
get isKeyRotationSuppressed() {
|
|
89
|
+
return this.encryptionManager?.isKeyRotationSuppressed ?? false;
|
|
90
|
+
}
|
|
91
|
+
|
|
82
92
|
/**
|
|
83
93
|
* The callId (sessionId) of the call.
|
|
84
94
|
*
|
|
@@ -118,6 +128,48 @@ export class MatrixRTCSession extends TypedEventEmitter {
|
|
|
118
128
|
return isSlotClosed(this.roomSubset, this.slotDescription);
|
|
119
129
|
}
|
|
120
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Ensures this session's slot is open, sending a slot state event to open (or create) it if needed.
|
|
133
|
+
*
|
|
134
|
+
* The event's `application` is set from this session's slot description and its `encryption` from
|
|
135
|
+
* `opts.encryption`, replacing whatever an existing slot event declares. Other content is preserved.
|
|
136
|
+
* No-op if the slot is already open with matching `application` and `encryption`.
|
|
137
|
+
*
|
|
138
|
+
* @param opts.encryption - The encryption to declare on the slot, or `undefined` for none.
|
|
139
|
+
* @throws if sending the state event fails.
|
|
140
|
+
*/
|
|
141
|
+
async ensureRtcSlotOpen(opts = {}) {
|
|
142
|
+
const application = {
|
|
143
|
+
type: this.slotDescription.application
|
|
144
|
+
};
|
|
145
|
+
const existingContent = this.getRtcSlot();
|
|
146
|
+
if (existingContent?.status === "open" && deepCompare(existingContent.application, application) && deepCompare(existingContent.encryption, opts.encryption)) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
await this.sendRtcSlot(_objectSpread(_objectSpread({}, existingContent), {}, {
|
|
150
|
+
status: "open",
|
|
151
|
+
application,
|
|
152
|
+
encryption: opts.encryption
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Ensures this session's slot is closed, sending a slot state event to close it if needed.
|
|
158
|
+
* The other content of the existing slot event is preserved. No-op if no slot event exists.
|
|
159
|
+
*
|
|
160
|
+
* @throws if sending the state event fails.
|
|
161
|
+
*/
|
|
162
|
+
async ensureRtcSlotClosed() {
|
|
163
|
+
const existingContent = this.getRtcSlot();
|
|
164
|
+
if (!existingContent || existingContent.status === "closed") return;
|
|
165
|
+
await this.sendRtcSlot(_objectSpread(_objectSpread({}, existingContent), {}, {
|
|
166
|
+
status: "closed"
|
|
167
|
+
}));
|
|
168
|
+
}
|
|
169
|
+
async sendRtcSlot(content) {
|
|
170
|
+
await this.client.sendStateEvent(this.roomSubset.roomId, EventType.RTCSlot, content, computeSlotId(this.slotDescription));
|
|
171
|
+
}
|
|
172
|
+
|
|
121
173
|
/**
|
|
122
174
|
* Returns all the call memberships for a room that match the provided `sessionDescription`,
|
|
123
175
|
* oldest first.
|
|
@@ -250,6 +302,8 @@ export class MatrixRTCSession extends TypedEventEmitter {
|
|
|
250
302
|
// Clear the flag.
|
|
251
303
|
this.membershipNeedsRecalculation = false;
|
|
252
304
|
const oldMemberships = this.memberships;
|
|
305
|
+
// Needs to be computed before `this.memberships` is updated below, since it is derived from it.
|
|
306
|
+
const wasKeyRotationSuppressed = this.isKeyRotationSuppressed;
|
|
253
307
|
this.memberships = await MatrixRTCSession.sessionMembershipsForSlot(this.room, this.slotDescription, this.calculateMembershipsOpts);
|
|
254
308
|
const changed = oldMemberships.length != this.memberships.length || oldMemberships.some((m, i) => !CallMembership.equal(m, this.memberships[i]));
|
|
255
309
|
if (changed) {
|
|
@@ -278,6 +332,10 @@ export class MatrixRTCSession extends TypedEventEmitter {
|
|
|
278
332
|
// This also needs to be done if `changed` = false
|
|
279
333
|
// A member might have updated their fingerprint (created_ts)
|
|
280
334
|
this.encryptionManager?.onMembershipsUpdate(oldMemberships);
|
|
335
|
+
if (this.isKeyRotationSuppressed !== wasKeyRotationSuppressed) {
|
|
336
|
+
this.logger.info(`Key rotation is now ${this.isKeyRotationSuppressed ? "suppressed" : "active again"} (${this.memberships.length} members)`);
|
|
337
|
+
this.emit(MatrixRTCSessionEvent.KeyRotationSuppressedChanged, this.isKeyRotationSuppressed);
|
|
338
|
+
}
|
|
281
339
|
this.setExpiryTimer();
|
|
282
340
|
});
|
|
283
341
|
this.client = client;
|