
    iU                    .   % S SK Jr  S SKrS SKrS SKrS SKJr  S SKJrJ	r	J
r
  S SKJrJrJr  S SKJrJrJrJr  SSKJrJrJr  SS	KJrJrJrJrJrJrJrJrJ r   SS
KJ!r!  \(       d  \"" \RF                  " SS5      5      (       aU  S SK$r$\$RJ                  S:  a  S SKJ&r&  OS SK'J&r&  SSK(J)r)J*r*  SSK+J,r,  SSK-J.r.J/r/J0r0  \\)\,\1\24   r3S\4S'   \\*\,\1\24   r5S\4S'    " S S5      r6\6" 5       r7\\7l8        \7Rr                  r9\7Rt                  r:\7Rv                  r;g)    )annotationsN)timegm)	ContainerIterableSequence)datetime	timedeltatimezone)TYPE_CHECKINGAnyUnioncast   )PyJWS_ALGORITHM_UNSET_jws_global_obj)	DecodeErrorExpiredSignatureErrorImmatureSignatureErrorInvalidAudienceErrorInvalidIssuedAtErrorInvalidIssuerErrorInvalidJTIErrorInvalidSubjectErrorMissingRequiredClaimError)RemovedInPyjwt3WarningSPHINX_BUILD )   
   )	TypeAlias)AllowedPrivateKeysAllowedPublicKeys)PyJWK)FullOptionsOptions
SigOptionsr!   AllowedPrivateKeyTypesAllowedPublicKeyTypesc                  2   \ rS rSrSSS jjr\SS j5       rSS jrSSS jjr\	SSS4             SS jjr
  S       S S	 jjr         S!                       S"S
 jjrS#S jr         S!                       S$S jjr    S%             S&S jjr      S'S jr S     S(S jjrS)S jr        S*S jr        S*S jr        S*S jrSS.       S+S jjr      S,S jrSrg)-PyJWT*   Nc                    U   U R                  5       U l        Ub  U R                  U5      U l        [        U R	                  5       S9U l        g )N)options)_get_default_optionsr.   _merge_optionsr   _get_sig_options_jwsselfr.   s     V/home/maestro/MAESTRO/maestro-backend/venv/lib/python3.13/site-packages/jwt/api_jwt.py__init__PyJWT.__init__+   sB    002..w7DL$"7"7"9:	    c                     SSSSSSSS/ SSS.$ )NTF)verify_signature
verify_exp
verify_nbf
verify_iat
verify_aud
verify_iss
verify_sub
verify_jtirequire
strict_audenforce_minimum_key_length rE   r8   r5   r/   PyJWT._get_default_options3   s/     !%*/
 	
r8   c                Z    U R                   S   U R                   R                  SS5      S.$ )Nr:   rD   F)r:   rD   r.   get)r4   s    r5   r1   PyJWT._get_sig_optionsC   s0     $-? @*.,,*:*:,e+
 	
r8   c                   Uc  U R                   $ UR                  SS5      (       d  UR                  SS5      US'   UR                  SS5      US'   UR                  SS5      US'   UR                  SS5      US'   UR                  SS5      US'   UR                  S	S5      US	'   UR                  S
S5      US
'   0 U R                   EUE$ )Nr:   Tr;   Fr<   r=   r>   r?   r@   rA   rH   r3   s     r5   r0   PyJWT._merge_optionsK   s    ?<< {{-t44$+KKe$DGL!$+KKe$DGL!$+KKe$DGL!$+KKe$DGL!$+KKe$DGL!$+KKe$DGL!$+KKe$DGL!*$,,*'**r8   Tc           	        [        U[        5      (       d  [        S5      eUR                  5       nS HF  n[        UR	                  U5      [
        5      (       d  M)  [        X   R                  5       5      X'   MH     SU;   a#  [        US   [        5      (       d  [        S5      eU R                  UUUS9nU R                  R                  UUUUUUS9$ )a  Encode the ``payload`` as JSON Web Token.

:param payload: JWT claims, e.g. ``dict(iss=..., aud=..., sub=...)``
:type payload: dict[str, typing.Any]
:param key: a key suitable for the chosen algorithm:

    * for **asymmetric algorithms**: PEM-formatted private key, a multiline string
    * for **symmetric algorithms**: plain string, sufficiently long for security

:type key: str or bytes or PyJWK or :py:class:`jwt.algorithms.AllowedPrivateKeys`
:param algorithm: algorithm to sign the token with, e.g. ``"ES256"``.
    If ``headers`` includes ``alg``, it will be preferred to this parameter.
    If ``key`` is a :class:`PyJWK` object, by default the key algorithm will be used.
:type algorithm: str or None
:param headers: additional JWT header fields, e.g. ``dict(kid="my-key-id")``.
:type headers: dict[str, typing.Any] or None
:param json_encoder: custom JSON encoder for ``payload`` and ``headers``
:type json_encoder: json.JSONEncoder or None

:rtype: str
:returns: a JSON Web Token

:raises TypeError: if ``payload`` is not a ``dict``
zGExpecting a dict object, as JWT only supports JSON objects as payloads.)expiatnbfisszIssuer (iss) must be a string.)headersjson_encoder)sort_headers)
isinstancedict	TypeErrorcopyrI   r   r   utctimetuplestr_encode_payloadr2   encode)	r4   payloadkey	algorithmrR   rS   rT   
time_claimjson_payloads	            r5   r\   PyJWT.encodeZ   s    D '4((,  ,,./J'++j18<<&,W-@-M-M-O&P# 0 GJwu~s$C$C<==++% , 
 yy%   
 	
r8   c                L    [         R                  " USUS9R                  S5      $ )z
Encode a given payload to the bytes to be signed.

This method is intended to be overridden by subclasses that need to
encode the payload in a different way, e.g. compress the payload.
),:)
separatorsclszutf-8)jsondumpsr\   )r4   r]   rR   rS   s       r5   r[   PyJWT._encode_payload   s)     zz!
 &/		r8   c           	        U(       a4  [         R                  " S[        UR                  5       5       3[        SS9  Uc  SnOUR                  SS5      nUb  X\:w  a  [         R                  " S[        SS9  U R                  U5      nSU0nU R                  R                  UUUUUS9nU R                  U5      nU R                  UUUUU
U	S	9  UUS
'   U$ )u,  Identical to ``jwt.decode`` except for return value which is a dictionary containing the token header (JOSE Header),
the token payload (JWT Payload), and token signature (JWT Signature) on the keys "header", "payload",
and "signature" respectively.

:param jwt: the token to be decoded
:type jwt: str or bytes
:param key: the key suitable for the allowed algorithm
:type key: str or bytes or PyJWK or :py:class:`jwt.algorithms.AllowedPublicKeys`

:param algorithms: allowed algorithms, e.g. ``["ES256"]``

    .. warning::

       Do **not** compute the ``algorithms`` parameter based on
       the ``alg`` from the token itself, or on any other data
       that an attacker may be able to influence, as that might
       expose you to various vulnerabilities (see `RFC 8725 §2.1
       <https://www.rfc-editor.org/rfc/rfc8725.html#section-2.1>`_). Instead,
       either hard-code a fixed value for ``algorithms``, or
       configure it in the same place you configure the
       ``key``. Make sure not to mix symmetric and asymmetric
       algorithms that interpret the ``key`` in different ways
       (e.g. HS\* and RS\*).
:type algorithms: typing.Sequence[str] or None

:param jwt.types.Options options: extended decoding and validation options
    Refer to :py:class:`jwt.types.Options` for more information.

:param audience: optional, the value for ``verify_aud`` check
:type audience: str or typing.Iterable[str] or None
:param issuer: optional, the value for ``verify_iss`` check
:type issuer: str or typing.Container[str] or None
:param leeway: a time margin in seconds for the expiration check
:type leeway: float or datetime.timedelta
:rtype: dict[str, typing.Any]
:returns: Decoded JWT with the JOSE Header on the key ``header``, the JWS
 Payload on the key ``payload``, and the JWS Signature on the key ``signature``.
zypassing additional kwargs to decode_complete() is deprecated and will be removed in pyjwt version 3. Unsupported kwargs:    
stacklevelTr:   zThe `verify` argument to `decode` does nothing in PyJWT 2.0 and newer. The equivalent is setting `verify_signature` to False in the `options` dictionary. This invocation has a mismatch between the kwarg and the option entry.)categoryrn   )r^   
algorithmsr.   detached_payload)audienceissuerleewaysubjectr]   )warningswarntuplekeysr   rI   DeprecationWarningr0   r2   decode_complete_decode_payload_validate_claims)r4   jwtr^   rp   r.   verifyrq   rr   rs   ru   rt   kwargsr:   merged_optionssig_optionsdecodedr]   s                    r5   r{   PyJWT.decode_complete   s   r MM'',V[[]';&<> ' ?#&{{+=tD
 &"<MMY , ,,W5  0#
 ))++!- , 
 &&w/ 	 	
 %	r8   c                     [         R                  " US   5      n[	        U[
        5      (       d  [        S5      eU$ ! [         a  n[        SU 35      UeSnAff = f)z
Decode the payload from a JWS dictionary (payload, signature, header).

This method is intended to be overridden by subclasses that need to
decode the payload in a different way, e.g. decompress compressed
payloads.
r]   zInvalid payload string: Nz-Invalid payload string: must be a json object)rh   loads
ValueErrorr   rU   rV   )r4   r   r]   es       r5   r|   PyJWT._decode_payload  sd    	E&*jj1C&DG '4((MNN	  	E 8<=1D	Es   = 
AAAc                    U(       a4  [         R                  " S[        UR                  5       5       3[        SS9  U R                  UUUUUUUUU	U
S9
n[        [        [        [        4   US   5      $ )u  Verify the ``jwt`` token signature and return the token claims.

:param jwt: the token to be decoded
:type jwt: str or bytes
:param key: the key suitable for the allowed algorithm
:type key: str or bytes or PyJWK or :py:class:`jwt.algorithms.AllowedPublicKeys`

:param algorithms: allowed algorithms, e.g. ``["ES256"]``
    If ``key`` is a :class:`PyJWK` object, allowed algorithms will default to the key algorithm.

    .. warning::

       Do **not** compute the ``algorithms`` parameter based on
       the ``alg`` from the token itself, or on any other data
       that an attacker may be able to influence, as that might
       expose you to various vulnerabilities (see `RFC 8725 §2.1
       <https://www.rfc-editor.org/rfc/rfc8725.html#section-2.1>`_). Instead,
       either hard-code a fixed value for ``algorithms``, or
       configure it in the same place you configure the
       ``key``. Make sure not to mix symmetric and asymmetric
       algorithms that interpret the ``key`` in different ways
       (e.g. HS\* and RS\*).
:type algorithms: typing.Sequence[str] or None

:param jwt.types.Options options: extended decoding and validation options
    Refer to :py:class:`jwt.types.Options` for more information.

:param audience: optional, the value for ``verify_aud`` check
:type audience: str or typing.Iterable[str] or None
:param subject: optional, the value for ``verify_sub`` check
:type subject: str or None
:param issuer: optional, the value for ``verify_iss`` check
:type issuer: str or typing.Container[str] or None
:param leeway: a time margin in seconds for the expiration check
:type leeway: float or datetime.timedelta
:rtype: dict[str, typing.Any]
:returns: the JWT claims
zppassing additional kwargs to decode() is deprecated and will be removed in pyjwt version 3. Unsupported kwargs: rl   rm   )r   rq   rr   ru   rs   rt   r]   )
rv   rw   rx   ry   r   r{   r   rV   rZ   r   )r4   r~   r^   rp   r.   r   rq   rr   ru   rs   rt   r   r   s                r5   decodePyJWT.decode,  s    r MM'',V[[]';&<> ' &&- ' 
 DcNGI$677r8   c                   [        U[        5      (       a  UR                  5       nUb&  [        U[        [        45      (       d  [        S5      eU R                  XS   5        [        R                  " [        R                  S9R                  5       nSU;   a  US   (       a  U R                  XU5        SU;   a  US   (       a  U R                  XU5        SU;   a  US	   (       a  U R                  XU5        US
   (       a  U R                  X5        US   (       a   U R!                  XUR#                  SS5      S9  US   (       a  U R%                  X5        US   (       a  U R'                  U5        g g )Nz+audience must be a string, iterable or NonerB   )tzrO   r=   rP   r<   rN   r;   r?   r>   rC   Fstrictr@   rA   )rU   r	   total_secondsrZ   r   rW   _validate_required_claimsr   nowr
   utc	timestamp_validate_iat_validate_nbf_validate_exp_validate_iss_validate_audrI   _validate_sub_validate_jti)r4   r]   r.   rr   rs   ru   rt   r   s           r5   r}   PyJWT._validate_claims{  s@    fi(())+F
8c8_(M(MIJJ&&w	0BCllhll+557G 5wV4G 5wV4G 5wV4< w/< '++lE*J   < w0< w' !r8   c                P    U H   nUR                  U5      b  M  [        U5      e   g N)rI   r   )r4   r]   claimsclaims       r5   r   PyJWT._validate_required_claims  s(    
 E{{5!)/66 r8   c                    SU;  a  g[        US   [        5      (       d  [        S5      eUb!  UR                  S5      U:w  a  [        S5      egg)z
Checks whether "sub" if in the payload is valid or not.
This is an Optional claim

:param payload(dict): The payload which needs to be validated
:param subject(str): The subject of the token
subNzSubject must be a stringzInvalid subject)rU   rZ   r   rI   )r4   r]   ru   s      r5   r   PyJWT._validate_sub  sY     '%.#..%&@AA{{5!W,)*;<< - r8   c                p    SU;  a  g[        UR                  S5      [        5      (       d  [        S5      eg)z
Checks whether "jti" if in the payload is valid or not
This is an Optional claim

:param payload(dict): The payload which needs to be validated
jtiNzJWT ID must be a string)rU   rI   rZ   r   )r4   r]   s     r5   r   PyJWT._validate_jti  s6     '++e,c22!";<< 3r8   c                |     [        US   5      nXBU-   :  a  [        S5      eg ! [         a    [        S5      S ef = f)NrO   z)Issued At claim (iat) must be an integer.z The token is not yet valid (iat))intr   r   r   )r4   r]   r   rt   rO   s        r5   r   PyJWT._validate_iat  sV    	gen%C
 ,()KLL  	  	&;	   $ ;c                |     [        US   5      nXBU-   :  a  [        S5      eg ! [         a    [        S5      S ef = f)NrP   z*Not Before claim (nbf) must be an integer.z The token is not yet valid (nbf))r   r   r   r   )r4   r]   r   rt   rP   s        r5   r   PyJWT._validate_nbf  sU    	Vgen%C ,()KLL    	VJKQUU	Vr   c                |     [        US   5      nXBU-
  ::  a  [        S5      eg ! [         a    [        S5      S ef = f)NrN   z/Expiration Time claim (exp) must be an integer.zSignature has expired)r   r   r   r   )r4   r]   r   rt   rN   s        r5   r   PyJWT._validate_exp  sV    	gen%C < '(?@@ !  	A	r   Fr   c               d  ^ Uc  SU;  d
  US   (       d  g [        S5      eSU;  d
  US   (       d  [        S5      eUS   mU(       aR  [        U[        5      (       d  [        S5      e[        T[        5      (       d  [        S5      eUT:w  a  [        S5      eg [        T[        5      (       a  T/m[        T[        5      (       d  [        S5      e[        S T 5       5      (       a  [        S5      e[        U[        5      (       a  U/n[        U4S jU 5       5      (       a  [        S	5      eg )
NaudzInvalid audiencezInvalid audience (strict)z&Invalid claim format in token (strict)zAudience doesn't match (strict)zInvalid claim format in tokenc              3  L   #    U  H  n[        U[        5      (       + v   M     g 7fr   )rU   rZ   ).0cs     r5   	<genexpr>&PyJWT._validate_aud.<locals>.<genexpr>'  s     ?!:a%%%s   "$c              3  ,   >#    U  H	  oT;  v   M     g 7fr   rE   )r   r   audience_claimss     r5   r   r   -  s     >Xc/)Xs   zAudience doesn't match)r   r   rU   rZ   listanyall)r4   r]   rr   r   r   s       @r5   r   PyJWT._validate_aud  s    G#75> ''9::wu~ ,E22!%. h,,*+FGG os33*+STT?**+LMMos++./O/400&'FGG????&'FGGh$$ zH>X>>>&'?@@ ?r8   c                   Uc  g SU;  a  [        S5      eUS   n[        U[        5      (       d  [        S5      e[        U[        5      (       a  X2:w  a  [        S5      eg  X2;  a  [        S5      eg ! [         a    [        S5      S ef = f)NrQ   z%Payload Issuer (iss) must be a stringzInvalid issuerz.Issuer param must be "str" or "Container[str]")r   rU   rZ   r   rW   )r4   r]   rs   rQ   s       r5   r   PyJWT._validate_iss0  s     >+E22en#s##$%LMMfc""}()9:: $,-=>> % (Ds   "A3 3B
)r2   r.   r   )r.   Options | NonereturnNone)r   r%   )r   r'   )r.   r   r   r%   )r]   dict[str, Any]r^   r(   r_   
str | NonerR   dict[str, Any] | NonerS   type[json.JSONEncoder] | NonerT   boolr   rZ   )NN)r]   r   rR   r   rS   r   r   bytes)	r   NNNNNNNr   )r~   str | bytesr^   r)   rp   Sequence[str] | Noner.   r   r   bool | Nonerq   bytes | Nonerr   str | Iterable[str] | Noners   str | Container[str] | Noneru   r   rt   float | timedeltar   r   r   r   )r   r   r   r   )r~   r   r^   z'AllowedPublicKeys | PyJWK | str | bytesrp   r   r.   r   r   r   rq   r   rr   r   ru   r   rs   r   rt   r   r   r   r   r   )NNNr   )r]   r   r.   r%   rr   zIterable[str] | str | Noners   Container[str] | str | Noneru   r   rt   r   r   r   )r]   r   r   zIterable[str]r   r   )r]   r   ru   r   r   r   )r]   r   r   r   )r]   r   r   floatrt   r   r   r   )r]   r   rr   r   r   r   r   r   )r]   r   rs   r   r   r   )__name__
__module____qualname____firstlineno__r6   staticmethodr/   r1   r0   r   r\   r[   r{   r|   r   r}   r   r   r   r   r   r   r   r   __static_attributes__rE   r8   r5   r+   r+   *   s   ; 
 

+& !1)-6:!@
@
 $@
 	@

 '@
 4@
 @
 
@
J *.6:	 ' 4	
 
* &(+/"&")- 04.2"$%ll #l )	l
  l l 'l -l ,l l "l" #l$ 
%l\& 8:+/"&")- 04".2$%M8M8 5M8 )	M8
  M8 M8 'M8 -M8 M8 ,M8 "M8" #M8$ 
%M8f 04.2"$%(((( (( -	((
 ,(( (( "(( 
((T77 7 
	7 >B=%=0:=	=*=MM M 	M
 
MMM M 	M
 
MAA A 	A
 
A* 0A0A -0A
 0A 
0Ad%/J	r8   r+   )<
__future__r   rh   osrv   calendarr   collections.abcr   r   r   r   r	   r
   typingr   r   r   r   api_jwsr   r   r   
exceptionsr   r   r   r   r   r   r   r   r   r   r   getenvsysversion_infor!   typing_extensionsrp   r"   r#   api_jwkr$   typesr%   r&   r'   rZ   r   r(   __annotations__r)   r+   _jwt_global_objr2   r\   r{   r   rE   r8   r5   <module>r      s    "  	   9 9 2 2 2 2 = =
 
 
 -D>2677
7"$ 	0A77(-.@%e.S(TIT',->sE-Q'R9R] ]@ '& 			!11			r8   