Ë
    îñþi
  ã                  ó°   — d dl mZ d dlZd dlZd dlmZ d dlmZ ddlm	Z	m
Z
mZ ddlmZmZmZmZmZ ddlmZ  G d	„ d
«      Z G d„ d«      Z G d„ d«      Zy)é    )ÚannotationsN)ÚIterator)ÚAnyé   )Úget_default_algorithmsÚ
has_cryptoÚrequires_cryptography)ÚInvalidKeyErrorÚMissingCryptographyErrorÚ
PyJWKErrorÚPyJWKSetErrorÚ
PyJWTError)ÚJWKDictc                  ót   — e Zd Zdd	d„Zedd
d„«       Zeddd„«       Zedd„«       Zedd„«       Z	edd„«       Z
y)ÚPyJWKNc                óF  — || _         | j                   j                  dd«      }|st        d| j                   › �«      ‚|s6t        | j                   t        «      r| j                   j                  dd«      }|s¤| j                   j                  dd«      }|dk(  r0|dk(  s|sd}ny|d	k(  rd
}nq|dk(  rd}ni|dk(  rd}nat        d|› �«      ‚|dk(  rd}nK|dk(  rd}nC|dk(  r0|st        d| j                   › �«      ‚|dk(  rd}nt        d|› �«      ‚t        d|› �«      ‚t
        s|t        v rt        |› d�«      ‚|| _        	 t        «       |   | _
        | j                  j                  | j                   «      | _        y# t        $ r t        d| j                   › �«      d‚w xY w)a“  A class that represents a `JSON Web Key <https://www.rfc-editor.org/rfc/rfc7517>`_.

        :param jwk_data: The decoded JWK data.
        :type jwk_data: dict[str, typing.Any]
        :param algorithm: The key algorithm. If not specified, the key's ``alg`` will be used.
        :type algorithm: str or None
        :raises InvalidKeyError: If the key type (``kty``) is not found or unsupported, or if the curve (``crv``) is not found or unsupported.
        :raises MissingCryptographyError: If the algorithm requires ``cryptography`` to be installed and it is not available.
        :raises PyJWKError: If unable to find an algorithm for the key.
        ÚktyNzkty is not found: ÚalgÚcrvÚECzP-256ÚES256zP-384ÚES384zP-521ÚES512Ú	secp256k1ÚES256KzUnsupported crv: ÚRSAÚRS256ÚoctÚHS256ÚOKPzcrv is not found: ÚEd25519ÚEdDSAzUnsupported kty: z) requires 'cryptography' to be installed.z%Unable to find an algorithm for key: )Ú	_jwk_dataÚgetr
   Ú
isinstanceÚdictr   r	   r   Úalgorithm_namer   Ú	AlgorithmÚKeyErrorr   Úfrom_jwkÚkey)ÚselfÚjwk_dataÚ	algorithmr   r   s        úK/root/aria/mcps/aria-brain/venv/lib/python3.12/site-packages/jwt/api_jwk.pyÚ__init__zPyJWK.__init__   sÂ  € ð "ˆŒà�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Ô+@Ñ@Ü*Ø�+ÐFÐGóð ð (ˆÔð	Ü3Ó5°iÑ@ˆDŒNð —>‘>×*Ñ*¨4¯>©>Ó:ˆ�øô ò 	ÜØ7¸¿¹Ð7GÐHóàðð	ús   Å E= Å=#F c                ó   — t        | |«      S )a;  Creates a :class:`PyJWK` object from a JSON-like dictionary.

        :param obj: The JWK data, as a dictionary
        :type obj: dict[str, typing.Any]
        :param algorithm: The key algorithm. If not specified, the key's ``alg`` will be used.
        :type algorithm: str or None
        :rtype: PyJWK
        )r   )Úobjr.   s     r/   Ú	from_dictzPyJWK.from_dictT   s   € ô �S˜)Ó$Ð$ó    c                óX   — t        j                  | «      }t        j                  ||«      S )aE  Create a :class:`PyJWK` object from a JSON string.
        Implicitly calls :meth:`PyJWK.from_dict()`.

        :param str data: The JWK data, as a JSON string.
        :param algorithm:  The key algorithm.  If not specific, the key's ``alg`` will be used.
        :type algorithm: str or None

        :rtype: PyJWK
        )ÚjsonÚloadsr   r3   )Údatar.   r2   s      r/   Ú	from_jsonzPyJWK.from_json`   s#   € ô �j‰j˜ÓˆÜ�‰˜s IÓ.Ð.r4   c                ó:   — | j                   j                  dd«      S )zFThe `kty` property from the JWK.

        :rtype: str or None
        r   N©r#   r$   ©r,   s    r/   Úkey_typezPyJWK.key_typen   ó   € ð �~‰~×!Ñ! %¨Ó.Ð.r4   c                ó:   — | j                   j                  dd«      S )zFThe `kid` property from the JWK.

        :rtype: str or None
        ÚkidNr;   r<   s    r/   Úkey_idzPyJWK.key_idv   r>   r4   c                ó:   — | j                   j                  dd«      S )zFThe `use` property from the JWK.

        :rtype: str or None
        ÚuseNr;   r<   s    r/   Úpublic_key_usezPyJWK.public_key_use~   r>   r4   ©N)r-   r   r.   ú
str | NoneÚreturnÚNone)r2   r   r.   rF   rG   r   )r8   Ústrr.   rH   rG   r   )rG   rF   )Ú__name__Ú
__module__Ú__qualname__r0   Ústaticmethodr3   r9   Úpropertyr=   rA   rD   © r4   r/   r   r      sl   „ ô>;ð@ ó	%ó ð	%ð ó/ó ð/ð ò/ó ð/ð ò/ó ð/ð ò/ó ñ/r4   r   c                  óH   — e Zd Zdd„Zedd„«       Zed	d„«       Zd
d„Zdd„Zy)ÚPyJWKSetc                óP  — g | _         |st        d«      ‚t        |t        «      st        d«      ‚|D ]'  }	 | j                   j	                  t        |«      «       Œ) t        | j                   «      dk(  rt        d«      ‚y # t        $ r}t        |t        «      r|‚Y d }~Œnd }~ww xY w)Nz$The JWK Set did not contain any keyszInvalid JWK Set valuer   zUThe JWK Set did not contain any usable keys. Perhaps 'cryptography' is not installed?)	Úkeysr   r%   ÚlistÚappendr   r   r   Úlen)r,   rS   r+   Úerrors       r/   r0   zPyJWKSet.__init__ˆ   s¤   € Ø!#ˆŒ	áÜÐ FÓGÐGä˜$¤Ô%ÜÐ 7Ó8Ð8àò 	ˆCðØ—	‘	× Ñ ¤ s£Õ,ð	ô ˆt�y‰y‹>˜QÒÜØgóð ð øô ò Ü˜eÔ%=Ô>Ø�Käûð	ús   ¶$B Â 	B%Â	B Â B%c                ó<   — | j                  dg «      }t        |«      S )NrS   )r$   rQ   )r2   rS   s     r/   r3   zPyJWKSet.from_dictŸ   s   € à�w‰w�v˜rÓ"ˆÜ˜‹~Ðr4   c                óV   — t        j                  | «      }t        j                  |«      S rE   )r6   r7   rQ   r3   )r8   r2   s     r/   r9   zPyJWKSet.from_json¤   s!   € ä�j‰j˜ÓˆÜ×!Ñ! #Ó&Ð&r4   c                óf   — | j                   D ]  }|j                  |k(  sŒ|c S  t        d|› �«      ‚)Nzkeyset has no key for kid: )rS   rA   r)   )r,   r@   r+   s      r/   Ú__getitem__zPyJWKSet.__getitem__©   s;   € Ø—9‘9ò 	ˆCØ�z‰z˜SÓ Ø’
ð	ô Ð4°S°EÐ:Ó;Ð;r4   c                ó,   — t        | j                  «      S rE   )ÚiterrS   r<   s    r/   Ú__iter__zPyJWKSet.__iter__¯   s   € Ü�D—I‘I‹Ðr4   N)rS   zlist[JWKDict]rG   rH   )r2   zdict[str, Any]rG   rQ   )r8   rI   rG   rQ   )r@   rI   rG   r   )rG   zIterator[PyJWK])	rJ   rK   rL   r0   rM   r3   r9   r[   r^   rO   r4   r/   rQ   rQ   ‡   s9   „ óð. òó ðð ò'ó ð'ó<ôr4   rQ   c                  ó$   — e Zd Zdd„Zdd„Zdd„Zy)ÚPyJWTSetWithTimestampc                óD   — || _         t        j                  «       | _        y rE   )Újwk_setÚtimeÚ	monotonicÚ	timestamp)r,   rb   s     r/   r0   zPyJWTSetWithTimestamp.__init__´   s   € ØˆŒÜŸ™Ó)ˆ�r4   c                ó   — | j                   S rE   )rb   r<   s    r/   Úget_jwk_setz!PyJWTSetWithTimestamp.get_jwk_set¸   s   € Ø�|‰|Ðr4   c                ó   — | j                   S rE   )re   r<   s    r/   Úget_timestampz#PyJWTSetWithTimestamp.get_timestamp»   s   € Ø�~‰~Ðr4   N)rb   rQ   )rG   rQ   )rG   Úfloat)rJ   rK   rL   r0   rg   ri   rO   r4   r/   r`   r`   ³   s   „ ó*óôr4   r`   )Ú
__future__r   r6   rc   Úcollections.abcr   Útypingr   Ú
algorithmsr   r   r	   Ú
exceptionsr
   r   r   r   r   Útypesr   r   rQ   r`   rO   r4   r/   ú<module>rq      sK   ðÝ "ã Û Ý $Ý ç QÑ Q÷õ õ ÷q/ñ q/÷h)ñ )÷X	ò 	r4   