@@ -235,20 +235,26 @@ def verify(self, token: str, *, verify_signature: bool = True) -> Claims:
235235
236236 # First-party minters always set exp. Without this, a hand-rolled token
237237 # with a valid signature and no exp verifies forever (livekit/protocol#1706).
238- decode_options = (
239- {"verify_signature" : True , "require" : ["exp" ]}
240- if verify_signature
241- else {"verify_signature" : False }
242- )
243-
244- claims = jwt .decode (
245- token ,
246- key = self .api_secret or "" ,
247- issuer = self .api_key or "" ,
248- algorithms = ["HS256" ],
249- leeway = self ._leeway .total_seconds (),
250- options = decode_options ,
251- )
238+ # Inline each options literal so mypy matches PyJWT's Options TypedDict
239+ # (a shared dict from a ternary widens to dict[str, object]).
240+ if verify_signature :
241+ claims = jwt .decode (
242+ token ,
243+ key = self .api_secret or "" ,
244+ issuer = self .api_key or "" ,
245+ algorithms = ["HS256" ],
246+ leeway = self ._leeway .total_seconds (),
247+ options = {"verify_signature" : True , "require" : ["exp" ]},
248+ )
249+ else :
250+ claims = jwt .decode (
251+ token ,
252+ key = self .api_secret or "" ,
253+ issuer = self .api_key or "" ,
254+ algorithms = ["HS256" ],
255+ leeway = self ._leeway .total_seconds (),
256+ options = {"verify_signature" : False },
257+ )
252258 video_dict = claims .get ("video" , dict ())
253259 video_dict = {camel_to_snake (k ): v for k , v in video_dict .items ()}
254260 video_dict = {k : v for k , v in video_dict .items () if k in VideoGrants .__dataclass_fields__ }
0 commit comments