Skip to content

Commit

Permalink
allow specifying attributes during token generation
Browse files Browse the repository at this point in the history
  • Loading branch information
davidzhao committed Jun 12, 2024
1 parent 5b8d658 commit c03793c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions auth/grants.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package auth

import (
"maps"
"strings"

"golang.org/x/exp/slices"
Expand Down Expand Up @@ -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) {
Expand All @@ -81,6 +84,7 @@ func (c *ClaimGrants) Clone() *ClaimGrants {

clone := *c
clone.Video = c.Video.Clone()
clone.Attributes = maps.Clone(c.Attributes)

return &clone
}
Expand Down

0 comments on commit c03793c

Please sign in to comment.