File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -199,25 +199,22 @@ def __init__(
199199 api_key = api_key or os .getenv ("LIVEKIT_API_KEY" )
200200 api_secret = api_secret or os .getenv ("LIVEKIT_API_SECRET" )
201201
202- if not api_key or not api_secret :
203- raise ValueError ("api_key and api_secret must be set" )
204-
205202 self .api_key = api_key
206203 self .api_secret = api_secret
207204 self ._leeway = leeway
208205
209- def verify (self , token : str ) -> Claims :
206+ def verify (self , token : str , * , verify_signature : bool = True ) -> Claims :
207+ if verify_signature and (not self .api_key or not self .api_secret ):
208+ raise ValueError ("api_key and api_secret must be set" )
209+
210210 claims = jwt .decode (
211211 token ,
212- self .api_secret ,
213- issuer = self .api_key ,
212+ key = self .api_secret or "" ,
213+ issuer = self .api_key or "" ,
214214 algorithms = ["HS256" ],
215215 leeway = self ._leeway .total_seconds (),
216+ options = {"verify_signature" : verify_signature },
216217 )
217- return self .decode_claims (claims )
218-
219- @staticmethod
220- def decode_claims (claims : dict [str , Any ]) -> Claims :
221218 video_dict = claims .get ("video" , dict ())
222219 video_dict = {camel_to_snake (k ): v for k , v in video_dict .items ()}
223220 video_dict = {k : v for k , v in video_dict .items () if k in VideoGrants .__dataclass_fields__ }
You can’t perform that action at this time.
0 commit comments