Package-level declarations

Types

Link copied to clipboard
abstract class BaseCachingTokenSource(store: TokenStore, validator: TokenValidator)
Link copied to clipboard

A configurable token source takes in a TokenRequestOptions when requesting credentials.

Link copied to clipboard

A non-configurable token source that does not take any options.

Link copied to clipboard
@Serializable
data class RoomAgentDispatch(val agentName: String? = null, val metadata: String? = null)
Link copied to clipboard
@Serializable
data class RoomConfiguration(val name: String? = null, val emptyTimeout: Int? = null, val departureTimeout: Int? = null, val maxParticipants: Int? = null, val metadata: String? = null, val minPlayoutDelay: Int? = null, val maxPlayoutDelay: Int? = null, val syncStreams: Int? = null, val agents: List<RoomAgentDispatch>? = null)
Link copied to clipboard
data class SandboxTokenServerOptions(val baseUrl: String? = null)
Link copied to clipboard
data class TokenPayload(val token: String)

Decodes a LiveKit connection token and grabs relevant information from it.

Link copied to clipboard
data class TokenRequestOptions(val roomName: String? = null, val participantName: String? = null, val participantIdentity: String? = null, val participantMetadata: String? = null, val participantAttributes: Map<String, String>? = null, val agentName: String? = null, val agentMetadata: String? = null)

The options for a token request.

Link copied to clipboard
interface TokenSource
Link copied to clipboard
@Serializable
data class TokenSourceRequest(val roomName: String?, val participantName: String?, val participantIdentity: String?, val participantMetadata: String?, val participantAttributes: Map<String, String>?, val roomConfig: RoomConfiguration?)

The JSON serializable format of the request sent to standard LiveKit token servers.

Link copied to clipboard
@Serializable
data class TokenSourceResponse(val serverUrl: String, val participantToken: String, val roomName: String? = null, val participantName: String? = null)
Link copied to clipboard
interface TokenStore
Link copied to clipboard
typealias TokenValidator = (options: TokenRequestOptions?, response: TokenSourceResponse) -> Boolean
Link copied to clipboard
data class VideoGrants(val room: String?, val roomJoin: Boolean?, val canPublish: Boolean?, val canPublishData: Boolean?, val canPublishSources: List<String>?, val canSubscribe: Boolean?)

Functions

Link copied to clipboard
fun ConfigurableTokenSource.cached(store: TokenStore = InMemoryTokenStore(), validator: TokenValidator = defaultValidator): CachingConfigurableTokenSource
fun FixedTokenSource.cached(store: TokenStore = InMemoryTokenStore(), validator: TokenValidator = defaultValidator): CachingFixedTokenSource

Wraps the token store with a cache so that it reuses the token as long as it is valid.

Link copied to clipboard
fun TokenSourceResponse.hasValidToken(tolerance: Duration = 60.seconds, date: Date = Date()): Boolean

Validates whether the JWT token is still valid.

Link copied to clipboard

Converts a TokenRequestOptions to TokenSourceRequest, a JSON serializable request body.