Repository navigation
feat: decode the remaining JWT video grant fields - #1239
Closed
hiroshihorie wants to merge 2 commits into
Closed
hiroshihorie wants to merge 2 commits into
hiroshihorie wants to merge 2 commits into
Conversation
Add canUpdateOwnMetadata, ingressAdmin, agent, canSubscribeMetrics, canManageAgentSession and destinationRoom to LiveKitVideoGrant so it covers every field of VideoGrant in livekit/protocol auth/grants.go.
Member
Author
|
Closing. Client SDKs shouldn't treat token grants as the source of permissions, since the token is decoded unverified and the server can change permissions after join. Most of these fields are server-side grants, and no other client SDK exposes them. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Stacked on #1237. That PR comes from a fork, so this one targets
mainand also contains its commit (0e2d351). Only the last commit (90fcab53) is new here. Once #1237 merges, I'll mergemaininto this branch so the diff shows only this change.Summary
LiveKitVideoGrantdecoded only part of thevideoclaim. This adds the remaining fields ofVideoGrantinlivekit/protocolauth/grants.go, soTokenSourceResponse.jwtPayload?.videoexposes every grant a token can carry:canUpdateOwnMetadataingressAdminagentcanSubscribeMetricscanManageAgentSessiondestinationRoomThe fields follow the protocol order and use its camelCase claim keys, which #1237 switched the class to.
Test plan
test/token/token_source_test.dart: theparses claims and grants from tokentest now sets every grant field in the token and checks each one.flutter test test/token/,flutter analyze,dart format --set-exit-if-changedandimport_sorterpass.jwt.g.dartregenerated withbuild_runner. The only change is the new keys.