You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/LiveKit/Auth/TokenSource.swift
+21-9Lines changed: 21 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -26,18 +26,19 @@ public enum Token {
26
26
/// Request parameters for generating connection credentials.
27
27
publicstructRequest:Encodable,Sendable,Equatable{
28
28
/// The name of the room being requested when generating credentials.
29
-
letroomName:String?
29
+
publicletroomName:String?
30
30
/// The name of the participant being requested for this client when generating credentials.
31
-
letparticipantName:String?
31
+
publicletparticipantName:String?
32
32
/// The identity of the participant being requested for this client when generating credentials.
33
-
letparticipantIdentity:String?
33
+
publicletparticipantIdentity:String?
34
34
/// Any participant metadata being included along with the credentials generation operation.
35
-
letparticipantMetadata:String?
35
+
publicletparticipantMetadata:String?
36
36
/// Any participant attributes being included along with the credentials generation operation.
37
-
letparticipantAttributes:[String:String]?
38
-
/// A `RoomConfiguration` object can be passed to request extra parameters should be included when generating connection credentials - dispatching agents, etc.
37
+
publicletparticipantAttributes:[String:String]?
38
+
/// A `RoomConfiguration` object can be passed to request extra parameters when generating connection credentials.
39
+
/// Used for advanced room configuration like dispatching agents, setting room limits, etc.
39
40
/// - SeeAlso: [Room Configuration Documentation](https://docs.livekit.io/home/get-started/authentication/#room-configuration) for more info.
40
-
letroomConfiguration:RoomConfiguration?
41
+
publicletroomConfiguration:RoomConfiguration?
41
42
42
43
// enum CodingKeys: String, CodingKey {
43
44
// case roomName = "room_name"
@@ -68,9 +69,9 @@ public enum Token {
68
69
/// Response containing the credentials needed to connect to a room.
69
70
publicstructResponse:Decodable,Sendable{
70
71
/// The WebSocket URL for the LiveKit server.
71
-
letserverURL:URL
72
+
publicletserverURL:URL
72
73
/// The JWT token containing participant permissions and metadata.
73
-
letparticipantToken:String
74
+
publicletparticipantToken:String
74
75
75
76
enumCodingKeys:String,CodingKey{
76
77
case serverURL ="serverUrl"
@@ -92,6 +93,10 @@ public enum Token {
92
93
/// Protocol for types that can provide connection credentials.
93
94
/// Implement this protocol to create custom credential providers (e.g., fetching from your backend API).
94
95
publicprotocolTokenSource:Sendable{
96
+
/// Fetch connection credentials for the given request.
97
+
/// - Parameter request: The token request containing room and participant information
98
+
/// - Returns: A token response containing the server URL and participant token
99
+
/// - Throws: An error if the token generation fails
0 commit comments