From 15ae8854d7aca09586516e5afbf522d31fec4f4f Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 14 Oct 2024 16:10:49 -0700 Subject: [PATCH] feat: allow Agents to pass through initial attributes --- agent/token.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/agent/token.go b/agent/token.go index ff6822f7..6bc6bfce 100644 --- a/agent/token.go +++ b/agent/token.go @@ -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, @@ -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() }