Skip to content

Commit

Permalink
feat: allow Agents to pass through initial attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
davidzhao committed Oct 14, 2024
1 parent 6e7157c commit 15ae885
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions agent/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import (
"github.com/livekit/protocol/livekit"
)

func BuildAgentToken(apiKey, secret, roomName, participantIdentity, participantName, participantMetadata string, permissions *livekit.ParticipantPermission) (string, error) {
func BuildAgentToken(
apiKey, secret, roomName, participantIdentity, participantName, participantMetadata string,
participantAttributes map[string]string,
permissions *livekit.ParticipantPermission,
) (string, error) {
grant := &auth.VideoGrant{
RoomJoin: true,
Agent: true,
Expand All @@ -26,7 +30,8 @@ func BuildAgentToken(apiKey, secret, roomName, participantIdentity, participantN
SetName(participantName).
SetKind(livekit.ParticipantInfo_AGENT).
SetValidFor(1 * time.Hour).
SetMetadata(participantMetadata)
SetMetadata(participantMetadata).
SetAttributes(participantAttributes)

return at.ToJWT()
}

0 comments on commit 15ae885

Please sign in to comment.