Get SFU tokens and delegate delayed leaves through the MSC4195 CS API

src/livekit/auth now fronts two flows. For a transport with a LiveKit SFU
`url`, tokens come from our own homeserver's MSC4195 get_token endpoint
and delayed leaves are delegated through delegate_delayed_leave, both via
the js-sdk's unstable client methods. Transports with only a
livekit_service_url keep using the OpenID flow against the JWT service.

A transport advertising both shapes lets a subscriber fall back to the
OpenID flow when the homeserver answers get_token with a 404 (Synapse
reports M_UNRECOGNIZED for unknown routes rather than M_NOT_FOUND), so a
client can still join calls hosted on servers that have not deployed
MSC4195 yet. Publishers never fall back: a homeserver that advertises a
`url` but does not implement the endpoints is misconfigured and the
admin should hear about it, so they get NoMatrix2AuthorizationService.
Delegation uses the same flow as the token so that the participant
identity the service computes matches.

The local member only probes a transport's delegate_delayed_leave
endpoint when it has a service URL. The developer settings tab validates
a custom service URL through the same facade.
This commit is contained in:
Robin
2026-10-12 10:33:00 +02:00
committed by Johannes Marbach
parent 17c3a7cb5d
commit e336ee5cfa
14 changed files with 709 additions and 104 deletions
+5 -1
View File
@@ -133,6 +133,7 @@ describe("DeveloperSettingsTab", () => {
getCrypto: () => ({ getVersion: (): string => "x" }),
getUserId: () => "@u:hs",
getDeviceId: () => "DEVICE",
getDomain: () => "hs",
} as unknown as MatrixClient;
it("will not update custom livekit url without roomId", async () => {
const user = userEvent.setup();
@@ -228,7 +229,10 @@ describe("DeveloperSettingsTab", () => {
await user.click(saveButton);
expect(getSFUConfig).toHaveBeenCalledWith(
expect.objectContaining({
serviceUrl: "wss://example.livekit.valid",
transport: {
type: "livekit",
livekit_service_url: "wss://example.livekit.valid",
},
roomId: "#testRoom",
}),
);