Documentation
¶
Index ¶
- Constants
- Variables
- type APIKeyTokenVerifier
- func (v *APIKeyTokenVerifier) APIKey() string
- func (v *APIKeyTokenVerifier) Identity() string
- func (v *APIKeyTokenVerifier) Verify(key interface{}) (*jwt.RegisteredClaims, *ClaimGrants, error)
- func (v *APIKeyTokenVerifier) VerifyWithKey(k VerificationKey) (*jwt.RegisteredClaims, *ClaimGrants, error)
- type AccessToken
- func (t *AccessToken) AddGrant(grant *VideoGrant) *AccessTokendeprecated
- func (t *AccessToken) AddSIPGrant(grant *SIPGrant) *AccessTokendeprecated
- func (t *AccessToken) GetGrants() *ClaimGrants
- func (t *AccessToken) SetAgentDatabaseGrant(grant *AgentDatabaseGrant) *AccessToken
- func (t *AccessToken) SetAgentEndpointGrant(grant *AgentEndpointGrant) *AccessToken
- func (t *AccessToken) SetAgentGrant(grant *AgentGrant) *AccessToken
- func (t *AccessToken) SetAgentThreadGrant(grant *AgentThreadGrant) *AccessToken
- func (t *AccessToken) SetAgents(agents ...*livekit.RoomAgentDispatch) *AccessToken
- func (t *AccessToken) SetAllowSensitiveCredentials(allow bool) *AccessToken
- func (t *AccessToken) SetAttributes(attrs map[string]string) *AccessToken
- func (t *AccessToken) SetIdentity(identity string) *AccessToken
- func (t *AccessToken) SetInferenceGrant(grant *InferenceGrant) *AccessToken
- func (t *AccessToken) SetKind(kind livekit.ParticipantInfo_Kind) *AccessToken
- func (t *AccessToken) SetKindDetail(details ...livekit.ParticipantInfo_KindDetail) *AccessToken
- func (t *AccessToken) SetMetadata(md string) *AccessToken
- func (t *AccessToken) SetName(name string) *AccessToken
- func (t *AccessToken) SetObservabilityGrant(grant *ObservabilityGrant) *AccessToken
- func (t *AccessToken) SetRoomConfig(config *livekit.RoomConfiguration) *AccessToken
- func (t *AccessToken) SetRoomPreset(preset string) *AccessToken
- func (t *AccessToken) SetSIPGrant(grant *SIPGrant) *AccessToken
- func (t *AccessToken) SetSha256(sha string) *AccessToken
- func (t *AccessToken) SetValidFor(duration time.Duration) *AccessToken
- func (t *AccessToken) SetVideoGrant(grant *VideoGrant) *AccessToken
- func (t *AccessToken) ToJWT() (string, error)
- type AgentDatabaseGrant
- func (s *AgentDatabaseGrant) CanCreate() bool
- func (s *AgentDatabaseGrant) CanDelete(databaseID string) bool
- func (s *AgentDatabaseGrant) CanList() bool
- func (s *AgentDatabaseGrant) CanRead(databaseID string) bool
- func (s *AgentDatabaseGrant) CanWrite(databaseID string) bool
- func (s *AgentDatabaseGrant) Clone() *AgentDatabaseGrant
- func (s *AgentDatabaseGrant) MarshalLogObject(e zapcore.ObjectEncoder) error
- type AgentEndpointGrant
- type AgentGrant
- type AgentThreadGrant
- func (s *AgentThreadGrant) CanCreate(scope string) bool
- func (s *AgentThreadGrant) CanDelete(threadID string) bool
- func (s *AgentThreadGrant) CanList(scope string) bool
- func (s *AgentThreadGrant) CanRead(threadID string) bool
- func (s *AgentThreadGrant) CanSQL(threadID string) bool
- func (s *AgentThreadGrant) CanUpdate() bool
- func (s *AgentThreadGrant) CanWrite(threadID string) bool
- func (s *AgentThreadGrant) Clone() *AgentThreadGrant
- func (s *AgentThreadGrant) MarshalLogObject(e zapcore.ObjectEncoder) error
- type ClaimGrants
- func (c *ClaimGrants) Clone() *ClaimGrants
- func (c *ClaimGrants) GetKindDetails() []livekit.ParticipantInfo_KindDetail
- func (c *ClaimGrants) GetParticipantKind() livekit.ParticipantInfo_Kind
- func (c *ClaimGrants) GetRoomConfiguration() *livekit.RoomConfiguration
- func (c *ClaimGrants) MarshalLogObject(e zapcore.ObjectEncoder) error
- func (c *ClaimGrants) SetKindDetail(details ...livekit.ParticipantInfo_KindDetail)
- func (c *ClaimGrants) SetParticipantKind(kind livekit.ParticipantInfo_Kind)
- type FileBasedKeyProvider
- type InferenceGrant
- type KeyProvider
- type ObservabilityGrant
- type RoomConfiguration
- type SIPGrant
- type SimpleKeyProvider
- type TokenVerifier
- type VerificationKey
- type VideoGrant
- func (v *VideoGrant) Clone() *VideoGrant
- func (v *VideoGrant) GetCanManageAgentSession() bool
- func (v *VideoGrant) GetCanPublish() bool
- func (v *VideoGrant) GetCanPublishData() bool
- func (v *VideoGrant) GetCanPublishSource(source livekit.TrackSource) bool
- func (v *VideoGrant) GetCanPublishSources() []livekit.TrackSource
- func (v *VideoGrant) GetCanSubscribe() bool
- func (v *VideoGrant) GetCanSubscribeMetrics() bool
- func (v *VideoGrant) GetCanUpdateOwnMetadata() bool
- func (v *VideoGrant) MarshalLogObject(e zapcore.ObjectEncoder) error
- func (v *VideoGrant) MatchesPermission(permission *livekit.ParticipantPermission) bool
- func (v *VideoGrant) SetCanManageAgentSession(val bool)
- func (v *VideoGrant) SetCanPublish(val bool)
- func (v *VideoGrant) SetCanPublishData(val bool)
- func (v *VideoGrant) SetCanPublishSources(sources []livekit.TrackSource)
- func (v *VideoGrant) SetCanSubscribe(val bool)
- func (v *VideoGrant) SetCanSubscribeMetrics(val bool)
- func (v *VideoGrant) SetCanUpdateOwnMetadata(val bool)
- func (v *VideoGrant) ToPermission() *livekit.ParticipantPermission
- func (v *VideoGrant) UpdateFromPermission(permission *livekit.ParticipantPermission)
Constants ¶
const TokenTypeV2 = "livekit-v2+jwt"
TokenTypeV2 is the typ header of a token signed with a version 2 key.
Variables ¶
var ( ErrKeysMissing = errors.New("missing API key or secret key") ErrKeyAlgorithmMismatch = errors.New("token signing algorithm does not match the API key") ErrUnsupportedKeyVersion = errors.New("unsupported API key version") ErrInvalidPublicKey = errors.New("invalid API key public key") ErrKeyIDMismatch = errors.New("token kid header does not match its issuer") ErrTokenTypeMismatch = errors.New("token typ header does not match the API key version") )
var ErrSensitiveCredentials = errors.New("room configuration should not contain sensitive credentials")
Functions ¶
This section is empty.
Types ¶
type APIKeyTokenVerifier ¶
type APIKeyTokenVerifier struct {
// contains filtered or unexported fields
}
func ParseAPIToken ¶
func ParseAPIToken(raw string) (*APIKeyTokenVerifier, error)
ParseAPIToken parses an encoded JWT token without verifying its signature. The signature is verified later by Verify or VerifyWithKey, which require the key.
func (*APIKeyTokenVerifier) APIKey ¶
func (v *APIKeyTokenVerifier) APIKey() string
APIKey returns the API key this token was signed with
func (*APIKeyTokenVerifier) Identity ¶
func (v *APIKeyTokenVerifier) Identity() string
func (*APIKeyTokenVerifier) Verify ¶
func (v *APIKeyTokenVerifier) Verify(key interface{}) (*jwt.RegisteredClaims, *ClaimGrants, error)
Verify verifies a token of a version 1 key: HS256 with the API secret.
func (*APIKeyTokenVerifier) VerifyWithKey ¶ added in v1.54.2
func (v *APIKeyTokenVerifier) VerifyWithKey(k VerificationKey) (*jwt.RegisteredClaims, *ClaimGrants, error)
VerifyWithKey picks the algorithm from the key, never from the token header: HS256 with the secret for version 1, EdDSA with the public key for version 2. A version 2 token must also name the API key in its kid header and have the type TokenTypeV2.
type AccessToken ¶
type AccessToken struct {
// contains filtered or unexported fields
}
AccessToken produces token signed with API key and secret
func NewAccessToken ¶
func NewAccessToken(key string, secret string) *AccessToken
func NewAccessTokenWithPrivateKey ¶ added in v1.54.2
func NewAccessTokenWithPrivateKey(key string, privateKey ed25519.PrivateKey) *AccessToken
NewAccessTokenWithPrivateKey returns a token that ToJWT signs with EdDSA, for a version 2 key.
Do not use it yet: no LiveKit server or SDK supports version 2 keys.
func (*AccessToken) AddGrant
deprecated
func (t *AccessToken) AddGrant(grant *VideoGrant) *AccessToken
Deprecated: use SetVideoGrant instead
func (*AccessToken) AddSIPGrant
deprecated
added in
v1.19.0
func (t *AccessToken) AddSIPGrant(grant *SIPGrant) *AccessToken
Deprecated: use SetSIPGrant instead
func (*AccessToken) GetGrants ¶ added in v1.27.0
func (t *AccessToken) GetGrants() *ClaimGrants
func (*AccessToken) SetAgentDatabaseGrant ¶ added in v1.54.1
func (t *AccessToken) SetAgentDatabaseGrant(grant *AgentDatabaseGrant) *AccessToken
func (*AccessToken) SetAgentEndpointGrant ¶ added in v1.53.0
func (t *AccessToken) SetAgentEndpointGrant(grant *AgentEndpointGrant) *AccessToken
func (*AccessToken) SetAgentGrant ¶ added in v1.36.0
func (t *AccessToken) SetAgentGrant(grant *AgentGrant) *AccessToken
func (*AccessToken) SetAgentThreadGrant ¶ added in v1.53.0
func (t *AccessToken) SetAgentThreadGrant(grant *AgentThreadGrant) *AccessToken
func (*AccessToken) SetAgents ¶ added in v1.27.0
func (t *AccessToken) SetAgents(agents ...*livekit.RoomAgentDispatch) *AccessToken
SetAgents is a shortcut for setting agents in room configuration
func (*AccessToken) SetAllowSensitiveCredentials ¶ added in v1.42.0
func (t *AccessToken) SetAllowSensitiveCredentials(allow bool) *AccessToken
SetAllowSensitiveCredentials enables the token to contain sensitive credentials, by default it is disabled. When tokens are issued to end-users, it's not a good idea to issue sensitive data such as API keys/secrets in them JWT tokens are not encrypted, so anything that is issued in them can be read by anyone. When the tokens are used in a server environment (i.e. connecting from SIP or Agents), you can bypass the credentials check by enabling this option.
func (*AccessToken) SetAttributes ¶ added in v1.18.0
func (t *AccessToken) SetAttributes(attrs map[string]string) *AccessToken
func (*AccessToken) SetIdentity ¶
func (t *AccessToken) SetIdentity(identity string) *AccessToken
func (*AccessToken) SetInferenceGrant ¶ added in v1.40.0
func (t *AccessToken) SetInferenceGrant(grant *InferenceGrant) *AccessToken
func (*AccessToken) SetKind ¶ added in v1.9.4
func (t *AccessToken) SetKind(kind livekit.ParticipantInfo_Kind) *AccessToken
func (*AccessToken) SetKindDetail ¶ added in v1.43.1
func (t *AccessToken) SetKindDetail(details ...livekit.ParticipantInfo_KindDetail) *AccessToken
func (*AccessToken) SetMetadata ¶
func (t *AccessToken) SetMetadata(md string) *AccessToken
func (*AccessToken) SetName ¶ added in v0.11.5
func (t *AccessToken) SetName(name string) *AccessToken
func (*AccessToken) SetObservabilityGrant ¶ added in v1.42.0
func (t *AccessToken) SetObservabilityGrant(grant *ObservabilityGrant) *AccessToken
func (*AccessToken) SetRoomConfig ¶ added in v1.27.0
func (t *AccessToken) SetRoomConfig(config *livekit.RoomConfiguration) *AccessToken
func (*AccessToken) SetRoomPreset ¶ added in v1.27.0
func (t *AccessToken) SetRoomPreset(preset string) *AccessToken
func (*AccessToken) SetSIPGrant ¶ added in v1.27.0
func (t *AccessToken) SetSIPGrant(grant *SIPGrant) *AccessToken
func (*AccessToken) SetSha256 ¶ added in v0.7.2
func (t *AccessToken) SetSha256(sha string) *AccessToken
func (*AccessToken) SetValidFor ¶
func (t *AccessToken) SetValidFor(duration time.Duration) *AccessToken
func (*AccessToken) SetVideoGrant ¶ added in v1.27.0
func (t *AccessToken) SetVideoGrant(grant *VideoGrant) *AccessToken
func (*AccessToken) ToJWT ¶
func (t *AccessToken) ToJWT() (string, error)
type AgentDatabaseGrant ¶ added in v1.54.1
type AgentDatabaseGrant struct {
DatabaseIDs []string `json:"databaseIds,omitempty"`
Read bool `json:"read,omitempty"`
Write bool `json:"write,omitempty"`
Delete bool `json:"delete,omitempty"`
Create bool `json:"create,omitempty"`
List bool `json:"list,omitempty"`
}
AgentDatabaseGrant gives a token access to standalone agent databases ("DB_..."): Read, Write and Delete apply to the databases in DatabaseIDs, Create and List to the project. A thread's own database is agentThread's, with SQL.
func (*AgentDatabaseGrant) CanCreate ¶ added in v1.54.1
func (s *AgentDatabaseGrant) CanCreate() bool
CanCreate reports whether the holder may create databases.
func (*AgentDatabaseGrant) CanDelete ¶ added in v1.54.1
func (s *AgentDatabaseGrant) CanDelete(databaseID string) bool
CanDelete reports whether the holder may delete databaseID.
func (*AgentDatabaseGrant) CanList ¶ added in v1.54.1
func (s *AgentDatabaseGrant) CanList() bool
CanList reports whether the holder may list the project's databases.
func (*AgentDatabaseGrant) CanRead ¶ added in v1.54.1
func (s *AgentDatabaseGrant) CanRead(databaseID string) bool
CanRead reports whether the holder may read databaseID.
func (*AgentDatabaseGrant) CanWrite ¶ added in v1.54.1
func (s *AgentDatabaseGrant) CanWrite(databaseID string) bool
CanWrite reports whether the holder may write databaseID.
func (*AgentDatabaseGrant) Clone ¶ added in v1.54.1
func (s *AgentDatabaseGrant) Clone() *AgentDatabaseGrant
func (*AgentDatabaseGrant) MarshalLogObject ¶ added in v1.54.1
func (s *AgentDatabaseGrant) MarshalLogObject(e zapcore.ObjectEncoder) error
type AgentEndpointGrant ¶ added in v1.53.0
type AgentEndpointGrant struct {
// Call grants to invoke an agent's non-public HTTP endpoints.
Call bool `json:"call,omitempty"`
// AgentName restricts the grant to one agent; empty grants every agent in the project.
AgentName string `json:"agentName,omitempty"`
// Deployment restricts the grant to one deployment; empty grants every
// deployment. A worker registered without one is addressed as "default".
Deployment string `json:"deployment,omitempty"`
}
func (*AgentEndpointGrant) Allows ¶ added in v1.53.0
func (s *AgentEndpointGrant) Allows(agentName, deployment string) bool
Allows reports whether the grant authorizes calling non-public endpoints of (agentName, deployment). Matching is exact and case-sensitive; an empty scope field matches any value.
func (*AgentEndpointGrant) Clone ¶ added in v1.53.0
func (s *AgentEndpointGrant) Clone() *AgentEndpointGrant
func (*AgentEndpointGrant) MarshalLogObject ¶ added in v1.53.0
func (s *AgentEndpointGrant) MarshalLogObject(e zapcore.ObjectEncoder) error
type AgentGrant ¶ added in v1.36.0
type AgentGrant struct {
// Admin grants to create/update/delete Cloud Agents.
Admin bool `json:"admin,omitempty"`
// SimulationAdmin grants access to manage simulations and scenarios for evaluating agents.
SimulationAdmin bool `json:"simulationAdmin,omitempty"`
// DispatchAdmin grants access to manage a project's agent dispatch queue.
DispatchAdmin bool `json:"dispatchAdmin,omitempty"`
}
func (*AgentGrant) Clone ¶ added in v1.36.0
func (s *AgentGrant) Clone() *AgentGrant
func (*AgentGrant) MarshalLogObject ¶ added in v1.36.0
func (s *AgentGrant) MarshalLogObject(e zapcore.ObjectEncoder) error
type AgentThreadGrant ¶ added in v1.53.0
type AgentThreadGrant struct {
All bool `json:"all,omitempty"`
Scope string `json:"scope,omitempty"`
ThreadIDs []string `json:"threadIds,omitempty"`
List bool `json:"list,omitempty"`
Create bool `json:"create,omitempty"`
Write bool `json:"write,omitempty"`
Read bool `json:"read,omitempty"`
Delete bool `json:"delete,omitempty"`
SQL bool `json:"sql,omitempty"`
}
AgentThreadGrant gives a token access to threads, across the project's agents: list and create within Scope, and read, write and delete the threads in ThreadIDs. All extends it to every thread and scope of the project; the action flags still apply. SQL opens a covered thread's database, whose id is the thread's. It grants thread data only; which endpoints a token may call is agentEndpoint's.
func (*AgentThreadGrant) CanCreate ¶ added in v1.53.0
func (s *AgentThreadGrant) CanCreate(scope string) bool
CanCreate reports whether the holder may create threads in scope. A scoped grant creates only in its own scope.
func (*AgentThreadGrant) CanDelete ¶ added in v1.53.0
func (s *AgentThreadGrant) CanDelete(threadID string) bool
CanDelete reports whether the holder may delete threadID.
func (*AgentThreadGrant) CanList ¶ added in v1.53.0
func (s *AgentThreadGrant) CanList(scope string) bool
CanList reports whether the holder may list the threads of scope.
func (*AgentThreadGrant) CanRead ¶ added in v1.53.0
func (s *AgentThreadGrant) CanRead(threadID string) bool
CanRead reports whether the holder may read threadID.
func (*AgentThreadGrant) CanSQL ¶ added in v1.54.1
func (s *AgentThreadGrant) CanSQL(threadID string) bool
CanSQL reports whether the holder may open threadID's database.
func (*AgentThreadGrant) CanUpdate ¶ added in v1.53.0
func (s *AgentThreadGrant) CanUpdate() bool
CanUpdate reports whether the holder may change any thread's attributes and idle TTL, which only a project-wide grant may.
func (*AgentThreadGrant) CanWrite ¶ added in v1.53.0
func (s *AgentThreadGrant) CanWrite(threadID string) bool
CanWrite reports whether the holder may send to threadID.
func (*AgentThreadGrant) Clone ¶ added in v1.53.0
func (s *AgentThreadGrant) Clone() *AgentThreadGrant
func (*AgentThreadGrant) MarshalLogObject ¶ added in v1.53.0
func (s *AgentThreadGrant) MarshalLogObject(e zapcore.ObjectEncoder) error
type ClaimGrants ¶
type ClaimGrants struct {
Identity string `json:"identity,omitempty"`
Name string `json:"name,omitempty"`
Kind string `json:"kind,omitempty"`
KindDetails []string `json:"kindDetails,omitempty"`
Video *VideoGrant `json:"video,omitempty"`
SIP *SIPGrant `json:"sip,omitempty"`
Agent *AgentGrant `json:"agent,omitempty"`
Inference *InferenceGrant `json:"inference,omitempty"`
Observability *ObservabilityGrant `json:"observability,omitempty"`
AgentEndpoint *AgentEndpointGrant `json:"agentEndpoint,omitempty"`
AgentThread *AgentThreadGrant `json:"agentThread,omitempty"`
AgentDatabase *AgentDatabaseGrant `json:"agentDatabase,omitempty"`
// Room configuration to use if this participant initiates the room
RoomConfig *RoomConfiguration `json:"roomConfig,omitempty"`
// Cloud-only, config preset to use
// when both room and roomPreset are set, parameters in room overrides the preset
RoomPreset string `json:"roomPreset,omitempty"`
// for verifying integrity of the message body
Sha256 string `json:"sha256,omitempty"`
Metadata string `json:"metadata,omitempty"`
// Key/value attributes to attach to the participant
Attributes map[string]string `json:"attributes,omitempty"`
}
func (*ClaimGrants) Clone ¶ added in v0.13.3
func (c *ClaimGrants) Clone() *ClaimGrants
func (*ClaimGrants) GetKindDetails ¶ added in v1.43.1
func (c *ClaimGrants) GetKindDetails() []livekit.ParticipantInfo_KindDetail
func (*ClaimGrants) GetParticipantKind ¶ added in v1.9.4
func (c *ClaimGrants) GetParticipantKind() livekit.ParticipantInfo_Kind
func (*ClaimGrants) GetRoomConfiguration ¶ added in v1.27.0
func (c *ClaimGrants) GetRoomConfiguration() *livekit.RoomConfiguration
func (*ClaimGrants) MarshalLogObject ¶ added in v1.30.0
func (c *ClaimGrants) MarshalLogObject(e zapcore.ObjectEncoder) error
func (*ClaimGrants) SetKindDetail ¶ added in v1.43.1
func (c *ClaimGrants) SetKindDetail(details ...livekit.ParticipantInfo_KindDetail)
func (*ClaimGrants) SetParticipantKind ¶ added in v1.9.4
func (c *ClaimGrants) SetParticipantKind(kind livekit.ParticipantInfo_Kind)
type FileBasedKeyProvider ¶
type FileBasedKeyProvider struct {
// contains filtered or unexported fields
}
func NewFileBasedKeyProviderFromMap ¶
func NewFileBasedKeyProviderFromMap(keys map[string]string) *FileBasedKeyProvider
func NewFileBasedKeyProviderFromReader ¶
func NewFileBasedKeyProviderFromReader(r io.Reader) (p *FileBasedKeyProvider, err error)
func (*FileBasedKeyProvider) GetSecret ¶
func (p *FileBasedKeyProvider) GetSecret(key string) string
func (*FileBasedKeyProvider) NumKeys ¶
func (p *FileBasedKeyProvider) NumKeys() int
type InferenceGrant ¶ added in v1.40.0
type InferenceGrant struct {
// Perform grants to all inference features (LLM, STT, TTS)
Perform bool `json:"perform,omitempty"`
}
func (*InferenceGrant) Clone ¶ added in v1.40.0
func (s *InferenceGrant) Clone() *InferenceGrant
func (*InferenceGrant) MarshalLogObject ¶ added in v1.40.0
func (s *InferenceGrant) MarshalLogObject(e zapcore.ObjectEncoder) error
type KeyProvider ¶
type ObservabilityGrant ¶ added in v1.42.0
type ObservabilityGrant struct {
// Write grants to publish observability data
Write bool `json:"write,omitempty"`
}
func (*ObservabilityGrant) Clone ¶ added in v1.42.0
func (s *ObservabilityGrant) Clone() *ObservabilityGrant
func (*ObservabilityGrant) MarshalLogObject ¶ added in v1.42.0
func (s *ObservabilityGrant) MarshalLogObject(e zapcore.ObjectEncoder) error
type RoomConfiguration ¶ added in v1.27.0
type RoomConfiguration livekit.RoomConfiguration
func (*RoomConfiguration) CheckCredentials ¶ added in v1.39.1
func (c *RoomConfiguration) CheckCredentials() error
CheckCredentials checks if the room configuration contains sensitive credentials and returns an error if it does.
This is used to prevent sensitive credentials from being leaked to the client. It is not used to validate the credentials themselves, as that is done by the egress service.
func (*RoomConfiguration) Clone ¶ added in v1.27.0
func (c *RoomConfiguration) Clone() *RoomConfiguration
func (*RoomConfiguration) MarshalJSON ¶ added in v1.27.0
func (c *RoomConfiguration) MarshalJSON() ([]byte, error)
func (*RoomConfiguration) UnmarshalJSON ¶ added in v1.27.0
func (c *RoomConfiguration) UnmarshalJSON(data []byte) error
type SIPGrant ¶ added in v1.19.0
type SIPGrant struct {
// Admin grants access to all SIP features.
Admin bool `json:"admin,omitempty"`
// Call allows making outbound SIP calls.
Call bool `json:"call,omitempty"`
}
func (*SIPGrant) MarshalLogObject ¶ added in v1.30.0
func (s *SIPGrant) MarshalLogObject(e zapcore.ObjectEncoder) error
type SimpleKeyProvider ¶ added in v0.13.0
type SimpleKeyProvider struct {
// contains filtered or unexported fields
}
func NewSimpleKeyProvider ¶ added in v0.13.0
func NewSimpleKeyProvider(apiKey, apiSecret string) *SimpleKeyProvider
func (*SimpleKeyProvider) GetSecret ¶ added in v0.13.0
func (p *SimpleKeyProvider) GetSecret(key string) string
func (*SimpleKeyProvider) NumKeys ¶ added in v0.13.0
func (p *SimpleKeyProvider) NumKeys() int
type TokenVerifier ¶
type TokenVerifier interface {
Identity() string
Verify(key interface{}) (*ClaimGrants, error)
}
type VerificationKey ¶ added in v1.54.2
type VerificationKey struct {
Version int // 1: HS256 with Secret, 2: EdDSA with PublicKey
Secret string // version 1
PublicKey ed25519.PublicKey // version 2
}
VerificationKey is what a key record gives the verifier.
Do not use version 2 keys yet: no LiveKit server or SDK supports them.
type VideoGrant ¶
type VideoGrant struct {
// actions on rooms
RoomCreate bool `json:"roomCreate,omitempty"`
RoomList bool `json:"roomList,omitempty"`
RoomRecord bool `json:"roomRecord,omitempty"`
// actions on a particular room
RoomAdmin bool `json:"roomAdmin,omitempty"`
RoomJoin bool `json:"roomJoin,omitempty"`
Room string `json:"room,omitempty"`
// permissions within a room. each is optional and evaluated on its own: an
// unset (nil) field defaults to granted, so setting only one of these still
// leaves the others granted. set a field to false to deny it. CanPublishData,
// when unset, defaults to the effective CanPublish value.
CanPublish *bool `json:"canPublish,omitempty"`
CanSubscribe *bool `json:"canSubscribe,omitempty"`
CanPublishData *bool `json:"canPublishData,omitempty"`
// TrackSource types that a participant may publish.
// When set, it supersedes CanPublish. Only sources explicitly set here can be published
CanPublishSources []string `json:"canPublishSources,omitempty"` // keys keep track of each source
// by default, a participant is not allowed to update its own metadata
CanUpdateOwnMetadata *bool `json:"canUpdateOwnMetadata,omitempty"`
// actions on ingresses
IngressAdmin bool `json:"ingressAdmin,omitempty"` // applies to all ingress
// participant is not visible to other participants
Hidden bool `json:"hidden,omitempty"`
// indicates to the room that current participant is a recorder
Recorder bool `json:"recorder,omitempty"`
// indicates that the holder can register as an Agent framework worker
Agent bool `json:"agent,omitempty"`
// if a participant can subscribe to metrics
CanSubscribeMetrics *bool `json:"canSubscribeMetrics,omitempty"`
// if a participant can manage an agent session via RemoteSession
CanManageAgentSession *bool `json:"canManageAgentSession,omitempty"`
// destination room which this participant can forward to
DestinationRoom string `json:"destinationRoom,omitempty"`
}
func (*VideoGrant) Clone ¶ added in v0.13.3
func (v *VideoGrant) Clone() *VideoGrant
func (*VideoGrant) GetCanManageAgentSession ¶ added in v1.46.0
func (v *VideoGrant) GetCanManageAgentSession() bool
func (*VideoGrant) GetCanPublish ¶ added in v0.12.0
func (v *VideoGrant) GetCanPublish() bool
func (*VideoGrant) GetCanPublishData ¶ added in v0.12.0
func (v *VideoGrant) GetCanPublishData() bool
func (*VideoGrant) GetCanPublishSource ¶ added in v1.4.0
func (v *VideoGrant) GetCanPublishSource(source livekit.TrackSource) bool
func (*VideoGrant) GetCanPublishSources ¶ added in v1.5.2
func (v *VideoGrant) GetCanPublishSources() []livekit.TrackSource
func (*VideoGrant) GetCanSubscribe ¶ added in v0.12.0
func (v *VideoGrant) GetCanSubscribe() bool
func (*VideoGrant) GetCanSubscribeMetrics ¶ added in v1.20.1
func (v *VideoGrant) GetCanSubscribeMetrics() bool
func (*VideoGrant) GetCanUpdateOwnMetadata ¶ added in v1.4.0
func (v *VideoGrant) GetCanUpdateOwnMetadata() bool
func (*VideoGrant) MarshalLogObject ¶ added in v1.30.0
func (v *VideoGrant) MarshalLogObject(e zapcore.ObjectEncoder) error
func (*VideoGrant) MatchesPermission ¶ added in v1.5.2
func (v *VideoGrant) MatchesPermission(permission *livekit.ParticipantPermission) bool
func (*VideoGrant) SetCanManageAgentSession ¶ added in v1.46.0
func (v *VideoGrant) SetCanManageAgentSession(val bool)
func (*VideoGrant) SetCanPublish ¶ added in v0.7.3
func (v *VideoGrant) SetCanPublish(val bool)
func (*VideoGrant) SetCanPublishData ¶ added in v0.7.3
func (v *VideoGrant) SetCanPublishData(val bool)
func (*VideoGrant) SetCanPublishSources ¶ added in v1.4.0
func (v *VideoGrant) SetCanPublishSources(sources []livekit.TrackSource)
func (*VideoGrant) SetCanSubscribe ¶ added in v0.7.3
func (v *VideoGrant) SetCanSubscribe(val bool)
func (*VideoGrant) SetCanSubscribeMetrics ¶ added in v1.20.1
func (v *VideoGrant) SetCanSubscribeMetrics(val bool)
func (*VideoGrant) SetCanUpdateOwnMetadata ¶ added in v1.4.0
func (v *VideoGrant) SetCanUpdateOwnMetadata(val bool)
func (*VideoGrant) ToPermission ¶ added in v0.12.0
func (v *VideoGrant) ToPermission() *livekit.ParticipantPermission
func (*VideoGrant) UpdateFromPermission ¶ added in v1.5.2
func (v *VideoGrant) UpdateFromPermission(permission *livekit.ParticipantPermission)