Your IP : 18.117.74.47


Current Path : /opt/alt/python37/lib/python3.7/site-packages/jwt/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/jwt/__pycache__/api_jwk.cpython-37.pyc

B

�E�`~�@sHddlZddlmZddlmZmZmZGdd�d�ZGdd�d�ZdS)	�N�)�get_default_algorithms)�InvalidKeyError�
PyJWKError�
PyJWKSetErrorc@sVeZdZddd�Zeddd��Zeddd��Zedd	��Zed
d��Z	edd
��Z
dS)�PyJWKNcCsJt�|_||_|j�dd�}|s.td|j��|sLt|jt�rL|j�dd�}|�s|j�dd�}|dkr�|dkst|szd}n6|dkr�d	}n(|d
kr�d}n|dkr�d
}ntd|��n`|dkr�d}nR|dkr�d}nD|dk�r|s�td|j��|dkr�d}ntd|��ntd|��|j�|�|_|j�s6td|j��|j�	|j�|_
dS)N�ktyzkty is not found: %sZalg�crvZECzP-256ZES256zP-384ZES384zP-521ZES512Z	secp256k1ZES256KzUnsupported crv: %sZRSAZRS256�octZHS256ZOKPzcrv is not found: %sZEd25519ZEdDSAzUnsupported kty: %sz&Unable to find a algorithm for key: %s)rZ_algorithms�	_jwk_data�getr�
isinstance�dictZ	AlgorithmrZfrom_jwk�key)�selfZjwk_data�	algorithmrr	�r�</opt/alt/python37/lib/python3.7/site-packages/jwt/api_jwk.py�__init__sD
zPyJWK.__init__cCs
t||�S)N)r)�objrrrr�	from_dict6szPyJWK.from_dictcCst�|�}t�||�S)N)�json�loadsrr)�datarrrrr�	from_json:s
zPyJWK.from_jsoncCs|j�dd�S)Nr)rr)rrrr�key_type?szPyJWK.key_typecCs|j�dd�S)NZkid)rr)rrrr�key_idCszPyJWK.key_idcCs|j�dd�S)NZuse)rr)rrrr�public_key_useGszPyJWK.public_key_use)N)N)N)�__name__�
__module__�__qualname__r�staticmethodrr�propertyrrrrrrrrs
.rc@s,eZdZdd�Zedd��Zedd��ZdS)�PyJWKSetcCsRg|_|rt|t�std��t|�dkr0td��x|D]}|j�t|��q6WdS)NzInvalid JWK Set valuerz$The JWK Set did not contain any keys)�keysr
�listr�len�appendr)rr$rrrrrMs
zPyJWKSet.__init__cCs|�dg�}t|�S)Nr$)rr#)rr$rrrrYszPyJWKSet.from_dictcCst�|�}t�|�S)N)rrr#r)rrrrrr^s
zPyJWKSet.from_jsonN)rrr rr!rrrrrrr#Lsr#)	rZ
algorithmsr�
exceptionsrrrrr#rrrr�<module>sE

?>