From c03793c87ade67435f8c13b0bdf7f34034a590c0 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 12 Jun 2024 11:29:16 -0700 Subject: [PATCH] allow specifying attributes during token generation --- auth/grants.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/auth/grants.go b/auth/grants.go index 6c5f4e49..d3b08142 100644 --- a/auth/grants.go +++ b/auth/grants.go @@ -15,6 +15,7 @@ package auth import ( + "maps" "strings" "golang.org/x/exp/slices" @@ -64,6 +65,8 @@ type ClaimGrants struct { // 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 (c *ClaimGrants) SetParticipantKind(kind livekit.ParticipantInfo_Kind) { @@ -81,6 +84,7 @@ func (c *ClaimGrants) Clone() *ClaimGrants { clone := *c clone.Video = c.Video.Clone() + clone.Attributes = maps.Clone(c.Attributes) return &clone }