%PDF- %PDF-
Mini Shell

Mini Shell

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

�

d��dd���ddlmZddlZddlZddlmZddlmZmZm	Z	ddl
mZmZm
Z
mZddlmZGd�d	�ZGd
�d�ZGd�d
�Zy)�)�annotationsN)�Any�)�get_default_algorithms�
has_crypto�requires_cryptography)�InvalidKeyError�
PyJWKError�
PyJWKSetError�
PyJWTError)�JWKDictc�t�eZdZdd	d�Zedd
d��Zeddd��Zedd��Zedd��Z	edd��Z
y)
�PyJWKNc�l�t�|_||_|jjdd�}|st	d|j����|s6t|jt�r|jjdd�}|s�|jjdd�}|dk(r0|dk(s|sd}ny|dk(rd	}nq|d
k(rd}ni|dk(rd
}nat	d|����|dk(rd}nK|dk(rd}nC|dk(r0|st	d|j����|dk(rd}nt	d|����t	d|����ts|tvrt|�d���|jj|�|_
|jstd|j����|jj|j�|_y)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)�self�jwk_data�	algorithmrrs     �-/usr/lib/python3/dist-packages/jwt/api_jwk.py�__init__zPyJWK.__init__
s���1�3���!����n�n� � ���-���!�$6�t�~�~�6F�"G�H�H��Z�����=����*�*�5�$�7�I���.�.�$�$�U�D�1�C��d�{��'�>�� '�I��G�^� '�I��G�^� '�I��K�'� (�I�)�,=�c�U�*C�D�D����#�	����#�	�����)�,>�t�~�~�>N�*O�P�P��)�#� '�I�)�,=�c�U�*C�D�D�%�(9�#��&?�@�@��i�+@�@��	�{�*S�T�U�U��)�)�-�-�i�8����~�~��D�T�^�^�DT�U�V�V��>�>�*�*�4�>�>�:���c��t||�S�N)r)�objr+s  r,�	from_dictzPyJWK.from_dict>s���S�)�$�$r.c�X�tj|�}tj||�Sr0)�json�loadsrr2)�datar+r1s   r,�	from_jsonzPyJWK.from_jsonBs!���j�j�������s�I�.�.r.c�:�|jjdd�S)Nr�r"r#�r)s r,�key_typezPyJWK.key_typeG����~�~�!�!�%��.�.r.c�:�|jjdd�S)N�kidr9r:s r,�key_idzPyJWK.key_idKr<r.c�:�|jjdd�S)N�user9r:s r,�public_key_usezPyJWK.public_key_useOr<r.r0)r*r
r+�
str | None�return�None)r1r
r+rCrD�'PyJWK')r6�strr+rErDrF)rDrC)�__name__�
__module__�__qualname__r-�staticmethodr2r7�propertyr;r?rB�r.r,rrsl��/;�b�%��%��/��/��/��/��/��/��/��/r.rc�@�eZdZdd�Zedd��Zedd��Zd	d�Zy)
�PyJWKSetc��g|_|std��t|t�std��|D]'}	|jj	t|���)t|j�dk(rtd��y#t$rY�YwxYw)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?)�keysrr$�list�appendrr�len)r)rQr(s   r,r-zPyJWKSet.__init__Us�����	��� F�G�G��$��%�� 7�8�8��	�C�
��	�	� � ��s��,�	��t�y�y�>�Q���g��
���	�
��
�s�$B�	B�Bc�<�|jdg�}t|�S)NrQ)r#rO)r1rQs  r,r2zPyJWKSet.from_dictjs���w�w�v�r�"����~�r.c�V�tj|�}tj|�Sr0)r4r5rOr2)r6r1s  r,r7zPyJWKSet.from_jsonos!���j�j�����!�!�#�&�&r.c�f�|jD]}|j|k(s�|cStd|����)Nzkeyset has no key for kid: )rQr?�KeyError)r)r>r(s   r,�__getitem__zPyJWKSet.__getitem__ts;���9�9�	�C��z�z�S� ��
�	��4�S�E�:�;�;r.N)rQz
list[JWKDict]rDrE)r1zdict[str, Any]rD�
'PyJWKSet')r6rGrDrZ)r>rGrDrF)rHrIrJr-rKr2r7rYrMr.r,rOrOTs4���*�����'��'�<r.rOc�$�eZdZdd�Zdd�Zdd�Zy)�PyJWTSetWithTimestampc�D�||_tj�|_yr0)�jwk_set�time�	monotonic�	timestamp)r)r^s  r,r-zPyJWTSetWithTimestamp.__init__|s��������)��r.c��|jSr0)r^r:s r,�get_jwk_setz!PyJWTSetWithTimestamp.get_jwk_set�s���|�|�r.c��|jSr0)rar:s r,�
get_timestampz#PyJWTSetWithTimestamp.get_timestamp�s���~�~�r.N)r^rO)rDrO)rD�float)rHrIrJr-rcrerMr.r,r\r\{s��*��r.r\)�
__future__rr4r_�typingr�
algorithmsrrr�
exceptionsr	r
rr�typesr
rrOr\rMr.r,�<module>rlsB��"����Q�Q�N�N��E/�E/�P$<�$<�N	�	r.

Zerion Mini Shell 1.0