Fix auth0-python: SignatureVerifier.verify_signature is sync, not async by cadupont · Pull Request #15468 · python/typeshed

Summary

The typeshed stub for auth0-python incorrectly declares SignatureVerifier.verify_signature as async def. The actual implementation is synchronous.

Evidence

The auth0-python implementation uses a regular def:

    def verify_signature(self, token: str) -> dict[str, Any]:
        """Verifies the signature of the given JSON web token.
        ...
        """
        kid = self._get_kid(token)
        ...
        return self._decode_jwt(token, secret_or_certificate)

Impact

With the current stub, mypy reports:

  • Argument 1 to "_verify_claims" has incompatible type "Coroutine[Any, Any, dict[str, Any]"; expected "dict[str, Any]"
  • Maybe you forgot to use "await"?

This forces downstream code to use cast() or # type: ignore as a workaround, when the correct fix is to align the stub with the runtime.

Change

Change async def verify_signature to def verify_signature in the SignatureVerifier class.