Interface ILiveKitTokenBuilder
- Namespace
- LiveKit.Authentication
- Assembly
- LiveKit.AspNetCore.ServerSdk.Abstractions.dll
Builder for creating LiveKit authentication tokens.
Provides a fluent API for constructing access tokens with video grants, SIP grants, and participant attributes. See LiveKit Authentication Documentation for more information.
public interface ILiveKitTokenBuilder
Methods
ToJwt()
Builds and returns the JWT token string.
string ToJwt()
Returns
WithAttribute(string, string)
Adds a single attribute.
ILiveKitTokenBuilder WithAttribute(string key, string value)
Parameters
Returns
WithAttributeIf(bool, string, string)
Conditionally adds an attribute.
ILiveKitTokenBuilder WithAttributeIf(bool cond, string key, string value)
Parameters
Returns
WithAttributes(IDictionary<string, string>)
Sets all attributes.
ILiveKitTokenBuilder WithAttributes(IDictionary<string, string> attributes)
Parameters
attributesIDictionary<string, string>
Returns
WithKind(string)
Sets the participant kind.
ILiveKitTokenBuilder WithKind(string kind)
Parameters
kindstring
Returns
WithMetadata(string)
Sets the metadata for the participant.
ILiveKitTokenBuilder WithMetadata(string metadata)
Parameters
metadatastring
Returns
WithParticipantName(string)
Sets the participant name.
ILiveKitTokenBuilder WithParticipantName(string name)
Parameters
namestring
Returns
WithRoomConfiguration(RoomConfiguration)
Sets room configuration.
ILiveKitTokenBuilder WithRoomConfiguration(RoomConfiguration roomConfiguration)
Parameters
roomConfigurationRoomConfiguration
Returns
WithRoomConfiguration(Action<RoomConfiguration>)
Configures room configuration.
ILiveKitTokenBuilder WithRoomConfiguration(Action<RoomConfiguration> configureRoomConfiguration)
Parameters
configureRoomConfigurationAction<RoomConfiguration>
Returns
WithRoomPreset(string)
Sets the room preset.
ILiveKitTokenBuilder WithRoomPreset(string roomPreset)
Parameters
roomPresetstring
Returns
WithSipGrant(SipGrant)
Sets SIP grant permissions.
ILiveKitTokenBuilder WithSipGrant(SipGrant sipGrant)
Parameters
sipGrantSipGrant
Returns
WithSipGrant(Action<SipGrant>)
Configures SIP grant permissions.
ILiveKitTokenBuilder WithSipGrant(Action<SipGrant> configureSipGrant)
Parameters
Returns
WithTimeToLive(TimeSpan)
Sets the token time-to-live.
ILiveKitTokenBuilder WithTimeToLive(TimeSpan ttl)
Parameters
ttlTimeSpan
Returns
WithVideoGrant(VideoGrant)
Sets video grant permissions.
ILiveKitTokenBuilder WithVideoGrant(VideoGrant videoGrant)
Parameters
videoGrantVideoGrant
Returns
WithVideoGrant(Action<VideoGrant>)
Configures video grant permissions.
ILiveKitTokenBuilder WithVideoGrant(Action<VideoGrant> configureVideoGrant)
Parameters
configureVideoGrantAction<VideoGrant>