Documentation
¶
Index ¶
- Constants
- Variables
- func BuildAgentToken(apiKey, secret, roomName, participantIdentity, participantName, ... string, ...) (string, error)
- func BuildJobToken(apiKey, secret string, grants *auth.ClaimGrants) (token string, expiresAt time.Time, err error)
- func ParseJobTokenClaims(claims string) (*auth.ClaimGrants, error)
- func ValidateDeployment(deployment string) error
- func ValidateThreadID(threadID string) error
Constants ¶
const JobTokenValidFor = 10 * time.Minute
JobTokenValidFor is the lifetime of a token a job asks for with CreateJobTokenRequest.
const MaxDeploymentLength = 64
Variables ¶
var ErrClaimNotAllowed = errors.New("claim not allowed")
Functions ¶
func BuildAgentToken ¶
func BuildAgentToken( apiKey, secret, roomName, participantIdentity, participantName, participantMetadata string, participantAttributes map[string]string, permissions *livekit.ParticipantPermission, kindDetails ...livekit.ParticipantInfo_KindDetail, ) (string, error)
func BuildJobToken ¶ added in v1.54.0
func BuildJobToken(apiKey, secret string, grants *auth.ClaimGrants) (token string, expiresAt time.Time, err error)
BuildJobToken signs a token that carries grants and is valid for JobTokenValidFor. The token holds only the grants given; the issuer and the times are set here. expiresAt is at most a second before the token's exp. Grants with a claim a job token never carries are refused here too, whatever produced them.
func ParseJobTokenClaims ¶ added in v1.54.0
func ParseJobTokenClaims(claims string) (*auth.ClaimGrants, error)
ParseJobTokenClaims reads the claims of CreateJobTokenRequest into typed grants. A field the grants do not know is dropped, so a client that sends a newer claim still gets a token, without that claim. Anything after the JSON object, or a claim a job token never carries, is an error.
func ValidateDeployment ¶ added in v1.45.8
func ValidateThreadID ¶ added in v1.54.0
ValidateThreadID accepts an empty thread id (the call keeps no durable thread) or an agent thread id as guid.New(guid.AgentThreadPrefix) mints it.
Types ¶
This section is empty.