Add publish and subscribe permissions
This commit is contained in:
+7
-3
@@ -24,11 +24,15 @@ type TokenEndpointResponse struct {
|
||||
}
|
||||
|
||||
func generateLivekitToken(apiKey, apiSecret, room string, pubkey nostr.PubKey) string {
|
||||
at := auth.NewAccessToken(apiKey, apiSecret)
|
||||
at.SetVideoGrant(&auth.VideoGrant{
|
||||
grant := &auth.VideoGrant{
|
||||
RoomJoin: true,
|
||||
Room: room,
|
||||
})
|
||||
}
|
||||
grant.SetCanPublish(true)
|
||||
grant.SetCanSubscribe(true)
|
||||
|
||||
at := auth.NewAccessToken(apiKey, apiSecret)
|
||||
at.SetVideoGrant(grant)
|
||||
at.SetIdentity(pubkey.Hex())
|
||||
|
||||
jwt, _ := at.ToJWT()
|
||||
|
||||
Reference in New Issue
Block a user