Your IP : 18.222.60.144


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/jwt/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/jwt/__pycache__/api_jwk.cpython-311.pyc

�

��bgd���ddlmZddlZddlZddlmZddlmZmZm	Z	ddl
mZmZm
Z
mZddlmZGd�d	��ZGd
�d��ZGd�d
��ZdS)�)�annotationsN)�Any�)�get_default_algorithms�
has_crypto�requires_cryptography)�InvalidKeyError�
PyJWKError�
PyJWKSetError�
PyJWTError)�JWKDictc��eZdZddd�Zeddd���Zeddd���Zedd���Zedd���Z	edd���Z
dS)�PyJWKN�jwk_datar
�	algorithm�
str | None�return�Nonec��t��|_||_|j�dd��}|st	d|j�����|s5t|jt��r|j�dd��}|s�|j�dd��}|dkr8|dks|sd}n�|dkrd	}n�|d
krd}ny|dkrd
}npt	d|�����|dkrd}nU|dkrd}nL|dkr4|st	d|j�����|dkrd}n$t	d|�����t	d|�����ts|tvrt|�d����|j�|��|_
|j
std|j�����|j
�|j��|_dS)N�ktyzkty is not found: �alg�crv�ECzP-256�ES256zP-384�ES384zP-521�ES512�	secp256k1�ES256KzUnsupported crv: �RSA�RS256�oct�HS256�OKPzcrv is not found: �Ed25519�EdDSAzUnsupported kty: z) requires 'cryptography' to be installed.z%Unable to find an algorithm for key: )
r�_algorithms�	_jwk_data�getr	�
isinstance�dictrrr
�	Algorithm�from_jwk�key)�selfrrrrs     �B/opt/cloudlinux/venv/lib64/python3.11/site-packages/jwt/api_jwk.py�__init__zPyJWK.__init__
s��1�3�3���!����n� � ���-�-���	I�!�"G�t�~�"G�"G�H�H�H��	8�Z����=�=�	8���*�*�5�$�7�7�I��	A��.�$�$�U�D�1�1�C��d�{�{��'�>�>��>� '�I�I��G�^�^� '�I�I��G�^�^� '�I�I��K�'�'� (�I�I�)�*C�c�*C�*C�D�D�D�����#�	�	�����#�	�	������Q�)�*O�t�~�*O�*O�P�P�P��)�#�#� '�I�I�)�*C�c�*C�*C�D�D�D�%�&?�#�&?�&?�@�@�@��	V�i�+@�@�@��	�T�T�T�U�U�U��)�-�-�i�8�8����~�	W��U�T�^�U�U�V�V�V��>�*�*�4�>�:�:������obj�'PyJWK'c�"�t||��S�N)r)r2rs  r/�	from_dictzPyJWK.from_dict>s���S�)�$�$�$r1�data�strc�`�tj|��}t�||��Sr5)�json�loadsrr6)r7rr2s   r/�	from_jsonzPyJWK.from_jsonBs%���j��������s�I�.�.�.r1c�8�|j�dd��S)Nr�r'r(�r.s r/�key_typezPyJWK.key_typeG����~�!�!�%��.�.�.r1c�8�|j�dd��S)N�kidr>r?s r/�key_idzPyJWK.key_idKrAr1c�8�|j�dd��S)N�user>r?s r/�public_key_usezPyJWK.public_key_useOrAr1r5)rr
rrrr)r2r
rrrr3)r7r8rrrr3)rr)�__name__�
__module__�__qualname__r0�staticmethodr6r<�propertyr@rDrG�r1r/rrs�������/;�/;�/;�/;�/;�b�%�%�%�%��\�%��/�/�/�/��\�/��/�/�/��X�/��/�/�/��X�/��/�/�/��X�/�/�/r1rc�N�eZdZdd�Zedd	���Zedd���Zdd�ZdS)�PyJWKSet�keys�
list[JWKDict]rrc�F�g|_|std���t|t��std���|D]:}	|j�t|�����+#t$rY�7wxYwt|j��dkrtd���dS)Nz$The JWK Set did not contain any keyszInvalid JWK Set valuerzUThe JWK Set did not contain any usable keys. Perhaps 'cryptography' is not installed?)rPrr)�list�appendrr�len)r.rPr-s   r/r0zPyJWKSet.__init__Us�����	��	H�� F�G�G�G��$��%�%�	9�� 7�8�8�8��	�	�C�
��	� � ��s���,�,�,�,���
�
�
���
�����t�y�>�>�Q����g���
��s�'A*�*
A7�6A7r2�dict[str, Any]�
'PyJWKSet'c�L�|�dg��}t|��S)NrP)r(rO)r2rPs  r/r6zPyJWKSet.from_dictjs!���w�w�v�r�"�"����~�~�r1r7r8c�^�tj|��}t�|��Sr5)r:r;rOr6)r7r2s  r/r<zPyJWKSet.from_jsonos%���j������!�!�#�&�&�&r1rCr3c�X�|jD]}|j|kr|cS�td|�����)Nzkeyset has no key for kid: )rPrD�KeyError)r.rCr-s   r/�__getitem__zPyJWKSet.__getitem__tsE���9�	�	�C��z�S� � ��
�
�
�!��:�S�:�:�;�;�;r1N)rPrQrr)r2rVrrW)r7r8rrW)rCr8rr3)rHrIrJr0rKr6r<r\rMr1r/rOrOTs|����������*�����\���'�'�'��\�'�<�<�<�<�<�<r1rOc�&�eZdZd	d�Zd
d�Zdd�ZdS)�PyJWTSetWithTimestamp�jwk_setrOc�D�||_tj��|_dSr5)r_�time�	monotonic�	timestamp)r.r_s  r/r0zPyJWTSetWithTimestamp.__init__|s�������)�)����r1rc��|jSr5)r_r?s r/�get_jwk_setz!PyJWTSetWithTimestamp.get_jwk_set�s
���|�r1�floatc��|jSr5)rcr?s r/�
get_timestampz#PyJWTSetWithTimestamp.get_timestamp�s
���~�r1N)r_rO)rrO)rrf)rHrIrJr0rerhrMr1r/r^r^{sP������*�*�*�*����������r1r^)�
__future__rr:ra�typingr�
algorithmsrrr�
exceptionsr	r
rr�typesr
rrOr^rMr1r/�<module>rns��"�"�"�"�"�"���������������Q�Q�Q�Q�Q�Q�Q�Q�Q�Q�N�N�N�N�N�N�N�N�N�N�N�N�������E/�E/�E/�E/�E/�E/�E/�E/�P$<�$<�$<�$<�$<�$<�$<�$<�N	�	�	�	�	�	�	�	�	�	r1

?>