Class LiveKitTokenBuilder
- Namespace
- LiveKit.Authentication
- Assembly
- LiveKit.AspNetCore.ServerSdk.dll
public sealed class LiveKitTokenBuilder : ILiveKitTokenBuilder
- Inheritance
-
LiveKitTokenBuilder
- Implements
- Inherited Members
Constructors
LiveKitTokenBuilder(string, string, string)
Initializes a new instance of the LiveKitTokenBuilder class.
public LiveKitTokenBuilder(string apiKey, string apiSecret, string identity)
Parameters
apiKeystringThe LiveKit API key.
apiSecretstringThe LiveKit API secret.
identitystringThe unique identity for the participant.
Methods
ToJwt()
Builds and returns the JWT token string.
public string ToJwt()
Returns
WithAttribute(string, string)
Adds a single attribute.
public ILiveKitTokenBuilder WithAttribute(string key, string value)
Parameters
Returns
WithAttributeIf(bool, string, string)
Conditionally adds an attribute.
public ILiveKitTokenBuilder WithAttributeIf(bool cond, string key, string value)
Parameters
Returns
WithAttributes(IDictionary<string, string>)
Sets all attributes.
public ILiveKitTokenBuilder WithAttributes(IDictionary<string, string> attributes)
Parameters
attributesIDictionary<string, string>
Returns
WithKind(string)
Sets the participant kind.
public ILiveKitTokenBuilder WithKind(string kind)
Parameters
kindstring
Returns
WithMetadata(string)
Sets the metadata for the participant.
public ILiveKitTokenBuilder WithMetadata(string metadata)
Parameters
metadatastring
Returns
WithParticipantName(string)
Sets the participant name.
public ILiveKitTokenBuilder WithParticipantName(string name)
Parameters
namestring
Returns
WithRoomConfiguration(RoomConfiguration)
Sets room configuration.
public ILiveKitTokenBuilder WithRoomConfiguration(RoomConfiguration roomConfiguration)
Parameters
roomConfigurationRoomConfiguration
Returns
WithRoomConfiguration(Action<RoomConfiguration>)
Configures room configuration.
public ILiveKitTokenBuilder WithRoomConfiguration(Action<RoomConfiguration> configureRoomConfiguration)
Parameters
configureRoomConfigurationAction<RoomConfiguration>
Returns
WithRoomPreset(string)
Sets the room preset.
public ILiveKitTokenBuilder WithRoomPreset(string roomPreset)
Parameters
roomPresetstring
Returns
WithSipGrant(SipGrant)
Sets SIP grant permissions.
public ILiveKitTokenBuilder WithSipGrant(SipGrant sipGrant)
Parameters
sipGrantSipGrant
Returns
WithSipGrant(Action<SipGrant>)
Configures SIP grant permissions.
public ILiveKitTokenBuilder WithSipGrant(Action<SipGrant> configureSipGrant)
Parameters
Returns
WithTimeToLive(TimeSpan)
Sets the token time-to-live.
public ILiveKitTokenBuilder WithTimeToLive(TimeSpan ttl)
Parameters
ttlTimeSpan
Returns
WithVideoGrant(VideoGrant)
Sets video grant permissions.
public ILiveKitTokenBuilder WithVideoGrant(VideoGrant videoGrant)
Parameters
videoGrantVideoGrant
Returns
WithVideoGrant(Action<VideoGrant>)
Configures video grant permissions.
public ILiveKitTokenBuilder WithVideoGrant(Action<VideoGrant> configureVideoGrant)
Parameters
configureVideoGrantAction<VideoGrant>