%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/jwt/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/jwt/__pycache__/api_jwt.cpython-312.pyc

�

d��d1.���ddlmZddlZddlZddlmZddlmZddlmZm	Z	m
Z
ddlmZm
Z
ddlmZdd	lmZmZmZmZmZmZmZdd
lmZerddlmZmZGd�d
�Ze�Zej<Zej>Zej@Z y)�)�annotationsN)�timegm)�Iterable)�datetime�	timedelta�timezone)�
TYPE_CHECKING�Any�)�api_jws)�DecodeError�ExpiredSignatureError�ImmatureSignatureError�InvalidAudienceError�InvalidIssuedAtError�InvalidIssuerError�MissingRequiredClaimError)�RemovedInPyjwt3Warning)�AllowedPrivateKeys�AllowedPublicKeysc��eZdZddd�Zedd��Z				d													dd�Z		d							dd�Z								d																					dd�Zdd�Z									d																					dd�Z
			d							dd	�Z						dd
�Z								dd�Z
								dd�Z								dd
�Z						dd�Zd d�Zy)!�PyJWTNc�>�|�i}i|j��|�|_y�N)�_get_default_options�options)�selfrs  �-/usr/lib/python3/dist-packages/jwt/api_jwt.py�__init__zPyJWT.__init__s&���?��G�'Q�$�*C�*C�*E�'Q��'Q���c��ddddddgd�S)NT)�verify_signature�
verify_exp�
verify_nbf�
verify_iat�
verify_aud�
verify_iss�require�r)r rrzPyJWT._get_default_options s#��!%�������
�	
r c�B�t|t�std��|j�}dD]A}t|j	|�t
�s�#t
||j��||<�C|j|||��}tj||||||��S)NzGExpecting a dict object, as JWT only supports JSON objects as payloads.)�exp�iat�nbf)�headers�json_encoder)�sort_headers)�
isinstance�dict�	TypeError�copy�getrr�utctimetuple�_encode_payloadr�encode)	r�payload�key�	algorithmr.r/r0�
time_claim�json_payloads	         rr8zPyJWT.encode,s����'�4�(��,��
��,�,�.��/�	Q�J��'�+�+�j�1�8�<�&,�W�Z�-@�-M�-M�-O�&P��
�#�	Q�
�+�+���%�,�
���~�~������%�

�	
r c�P�tj|d|��jd�S)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�clszutf-8)�json�dumpsr8)rr9r.r/s    rr7zPyJWT._encode_payloadRs)���z�z��!��
��&��/�		r c
��|
r4tjdt|
j����t�t|xsi�}|j
dd�|�#||dk7rtjdt��|dsZ|j
dd�|j
dd�|j
d	d�|j
d
d�|j
dd�|dr
|std��tj|||||�
�}|j|�}i|j�|�}
|j||
|||	��||d<|S)Nzypassing additional kwargs to decode_complete() is deprecated and will be removed in pyjwt version 3. Unsupported kwargs: r"Tz�The `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.)�categoryr#Fr$r%r&r'z\It is required that you pass in a value for the "algorithms" argument when calling decode().)r:�
algorithmsr�detached_payload)�audience�issuer�leewayr9)�warnings�warn�tuple�keysrr2�
setdefault�DeprecationWarningr
r�decode_complete�_decode_payloadr�_validate_claims)r�jwtr:rGr�verifyrHrIrJrK�kwargs�decodedr9�merged_optionss              rrRzPyJWT.decode_completedsk��$��M�M�'�',�V�[�[�]�';�&<�>�'�	
��w�}�"�%�����-�t�4�
��&�G�4F�,G�"G��M�M�Y�,�	
��)�*����|�U�3����|�U�3����|�U�3����|�U�3����|�U�3��%�&�z��n��
��)�)���!��-�
���&�&�w�/��4�D�L�L�4�G�4������^�h�v�f�	�	
�%��	���r c��	tj|d�}t	|t
�std��|S#t$r}td|����d}~wwxYw)a
        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.
        r9zInvalid payload string: Nz-Invalid payload string: must be a json object)rC�loads�
ValueErrorr
r1r2)rrXr9�es    rrSzPyJWT._decode_payload�s\��	>��j�j���!3�4�G��'�4�(��M�N�N����	�	>�� 8���<�=�=��	>�s�7�	A�A�Ac
��|
r4tjdt|
j����t�|j|||||||||	��	}|dS)Nzppassing additional kwargs to decode() is deprecated and will be removed in pyjwt version 3. Unsupported kwargs: )rVrHrIrJrKr9)rLrMrNrOrrR)rrUr:rGrrVrHrIrJrKrWrXs            r�decodezPyJWT.decode�sr��$��M�M�'�',�V�[�[�]�';�&<�>�'�	
��&�&������-����'�

���y�!�!r c��t|t�r|j�}|�!t|ttf�std��|j
||�tjtj��j�}d|vr|dr|j|||�d|vr|dr|j|||�d|vr|dr|j|||�|d	r|j||�|d
r|j!||�yy)Nz+audience must be a string, iterable or None)�tzr,r%r-r$r+r#r'r&)r1r�
total_seconds�strrr3�_validate_required_claimsr�nowr�utc�	timestamp�
_validate_iat�
_validate_nbf�
_validate_exp�
_validate_iss�
_validate_aud)rr9rrIrJrKres       rrTzPyJWT._validate_claims�s����f�i�(��)�)�+�F���
�8�c�8�_�(M��I�J�J��&�&�w��8��l�l�h�l�l�+�5�5�7���G���� 5����w��V�4��G���� 5����w��V�4��G���� 5����w��V�4��<� ����w��/��<� ����w��1�!r c�P�|dD]}|j|���t|��y)Nr()r5r)rr9r�claims    rrdzPyJWT._validate_required_claimss2��
�Y�'�	7�E��{�{�5�!�)�/��6�6�	7r c�x�	t|d�}|||zkDrtd��y#t$rtd��wxYw)Nr,z)Issued At claim (iat) must be an integer.z The token is not yet valid (iat))�intr\rr)rr9rerKr,s     rrhzPyJWT._validate_iat	sT��	T��g�e�n�%�C��#��,��(�)K�L�L� ���	T�&�'R�S�S�	T���$�9c�x�	t|d�}|||zkDrtd��y#t$rtd��wxYw)Nr-z*Not Before claim (nbf) must be an integer.z The token is not yet valid (nbf))rpr\r
r)rr9rerKr-s     rrizPyJWT._validate_nbfsT��	L��g�e�n�%�C��#��,��(�)K�L�L� ���	L��J�K�K�	L�rqc�x�	t|d�}|||z
krtd��y#t$rtd��wxYw)Nr+z/Expiration Time claim (exp) must be an integer.zSignature has expired)rpr\r
r)rr9rerKr+s     rrjzPyJWT._validate_exp$sT��	T��g�e�n�%�C��3��<� �'�(?�@�@�!���	T��R�S�S�	T�rqc�`��|�d|vs|dsytd��d|vs|dstd��|d�t�t�r�g�t�t�std��td��D��rtd��t|t�r|g}t
�fd�|D��rtd��y)N�audzInvalid audiencezInvalid claim format in tokenc3�>K�|]}t|t����y�wr)r1rc)�.0�cs  r�	<genexpr>z&PyJWT._validate_aud.<locals>.<genexpr>Is����?�!�:�a��%�%�?�s�c3�&�K�|]}|�v���
y�wrr))rwru�audience_claimss  �rryz&PyJWT._validate_aud.<locals>.<genexpr>Os�����>�c�s�/�)�>�s�zAudience doesn't match)rrr1rc�list�any�all)rr9rIr{s   @rrlzPyJWT._validate_aud2s����
���G�#�7�5�>��'�'9�:�:����w�u�~�,�E�2�2�!�%�.���o�s�+�.�/�O��/�4�0�&�'F�G�G��?��?�?�&�'F�G�G��h��$� �z�H��>�X�>�>�&�'?�@�@�?r c�N�|�yd|vrtd��|d|k7rtd��y)N�isszInvalid issuer)rr)rr9rJs   rrkzPyJWT._validate_issRs:���>�����+�E�2�2��5�>�V�#�$�%5�6�6�$r r)r�dict[str, Any] | None�return�None)r�zdict[str, bool | list[str]])�HS256NNT)r9�dict[str, Any]r:z AllowedPrivateKeys | str | bytesr;�
str | Noner.r�r/�type[json.JSONEncoder] | Noner0�boolr�rc)NN)r9r�r.r�r/r�r��bytes)�NNNNNNr)rU�str | bytesr:�AllowedPublicKeys | str | bytesrG�list[str] | Nonerr�rV�bool | NonerH�bytes | NonerI�str | Iterable[str] | NonerJr�rK�float | timedeltarWr
r�r�)rXr�r�r
)rUr�r:r�rGr�rr�rVr�rHr�rIr�rJr�rKr�rWr
r�r
)NNr)r9r�rr�rKr�r�r�)r9r�rr�r�r�)r9r�re�floatrKr�r�r�)r9r�rIr�r�r�)r9r�rJr
r�r�)�__name__�
__module__�__qualname__r�staticmethodrr8r7rRrSr_rTrdrhrirjrlrkr)r rrrs���R�
�	
��	
�!(�)-�6:�!�$
��$
�.�$
��	$
�
'�$
�4�
$
��$
�

�$
�R*.�6:�	���'��4�	�

��*02�'+�)-�"�)-�04�!�$%�C�
�C�-�C�%�	C�
'�C��C�'�C�-�C��C�"�C� �!C�"
�#C�J�&02�'+�)-�"�)-�04�!�$%�$"�
�$"�-�$"�%�	$"�
'�$"��$"�'�$"�-�$"��$"�"�$"� �!$"�"

�#$"�T��$%�
2��2� �2�"�
2�
�2�B7��7� �7�
�	7�M��M��M��	M�

�M�M��M��M��	M�

�M�A��A��A��	A�

�A�A��A�-�A�
�	A�@7r r)!�
__future__rrCrL�calendarr�collections.abcrrrr�typingr	r
r�r�
exceptionsr
rrrrrrrrGrrr�_jwt_global_objr8rRr_r)r r�<module>r�sq��"����$�2�2�%�����-��A�@7�@7�F
�'��	�	�	��!�1�1��	�	�	�r 

Zerion Mini Shell 1.0