Skip to content
36 changes: 36 additions & 0 deletions third_party/3/jwt.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from typing import Mapping, Any, Optional, Union

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From https://github.com/jpadilla/pyjwt/blob/master/jwt/__init__.py it looks like there's a few more public functions. The documentation isn't very comprehensive, but at least register_algorithm is documented.

It's important to include all public functions, because otherwise people using those functions will get spurious errors.


def decode(jwt: Union[str, bytes], key: Union[str, bytes] = ...,
verify: bool = ..., algorithms: Optional[Any] = ...,
options: Optional[Mapping[Any, Any]] = ...,
**kwargs: Any) -> Mapping[str, Any]: ...

def encode(payload: Mapping[str, Any], key: Union[str, bytes],
algorithm: str = ..., headers: Optional[Mapping[str, Any]] = ...,
json_encoder: Optional[Any] = ...) -> bytes: ...

class InvalidTokenError(Exception): pass

class DecodeError(InvalidTokenError): pass

class ExpiredSignatureError(InvalidTokenError): pass

class InvalidAudienceError(InvalidTokenError): pass

class InvalidIssuerError(InvalidTokenError): pass

class InvalidIssuedAtError(InvalidTokenError): pass

class ImmatureSignatureError(InvalidTokenError): pass

class InvalidKeyError(Exception): pass

class InvalidAlgorithmError(InvalidTokenError): pass

class MissingRequiredClaimError(InvalidTokenError): ...

# Compatibility aliases (deprecated)
ExpiredSignature = ExpiredSignatureError
InvalidAudience = InvalidAudienceError
InvalidIssuer = InvalidIssuerError