§
    ¥”j§  ã                   ó¨   — d dl mZmZ d dlmZmZ d dlmZmZ d dl	m
Z
 d dlmZ 	 d dlZn# e$ rZ ed¦  «        e‚dZ[ww xY w G d„ d	e¦  «        ZdS )
é    )ÚOptionalÚUnion)ÚcmsÚtsp)ÚTimeStamperÚTimestampRequestError)Úset_tsp_headers)ÚLazySessionNz?Install pyHanko with the [async_http] optional dependency groupc                   óÂ   ‡ — e Zd Z	 	 	 	 ddeej        ef         deej                 fˆ fd„Z	de
fd„Zdej        fd	„Zdej        fˆ fd
„Zdej        dej        fd„Zˆ xZS )ÚAIOHttpTimeStamperFé   NÚsessionÚauthc                 óÚ   •— |r$|                      d¦  «        st          d¦  «        ‚|| _        || _        || _        || _        || _        t          ¦   «                              ¦   «          dS )a�  
        Initialise the timestamp client.

        :param url:
            URL where the server listens for timestamp requests.
        :param https:
            Enforce HTTPS.
        :param timeout:
            Timeout (in seconds)
        :param auth:
            `aiohttp.BasicAuth` object with authentication credentials.
        :param headers:
            Other headers to include.
        zhttps:zTimestamp URL is not HTTPS.N)	Ú
startswithÚ
ValueErrorÚurlÚtimeoutr   ÚheadersÚ_sessionÚsuperÚ__init__)Úselfr   r   Úhttpsr   r   r   Ú	__class__s          €úu/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/pyhanko/sign/timestamps/aiohttp_client.pyr   zAIOHttpTimeStamper.__init__   sn   ø€ ð. ð 	<˜Ÿš¨Ñ1Ô1ð 	<ÝÐ:Ñ;Ô;Ð;ØˆŒØˆŒØˆŒ	ØˆŒØˆŒÝ‰Œ×ÒÑÔÐÐÐó    Úreturnc              ƒ   ó2   K  — t          | j        pi ¦  «        S )z¾
        Format the HTTP request headers.
        Subclasses can override this to perform their own header generation
        logic.

        :return:
            Header dictionary.
        )r	   r   )r   s    r   Úasync_request_headersz(AIOHttpTimeStamper.async_request_headers1   s   è è € õ ˜tœ|Ð1¨rÑ2Ô2Ð2r   c              ƒ   ój   K  — | j         }t          |t          ¦  «        r|                     ¦   «         S |S ©N)r   Ú
isinstancer
   Úget_session)r   r   s     r   r$   zAIOHttpTimeStamper.get_session<   s6   è è € Ø”-ˆÝ�g�{Ñ+Ô+ð 	Ø×&Ò&Ñ(Ô(Ð(àˆNr   c              ƒ   óX   •K  — t          ¦   «                              ||¦  «        ƒ d {V —†S r"   )r   Úasync_timestamp)r   Úmessage_digestÚmd_algorithmr   s      €r   r&   z"AIOHttpTimeStamper.async_timestampC   s5   øè è € õ ‘W”W×,Ò,¨^¸\ÑJÔJÐJÐJÐJÐJÐJÐJÐJr   Úreqc              ƒ   óÆ  K  — |                       ¦   «         ƒ d {V —†}t          j        | j        ¬¦  «        }|                      ¦   «         ƒ d {V —†}	 |                     | j        ||                     ¦   «         | j        d|¬¦  «        4 ƒd {V —†	 }| 	                    ¦   «         ƒ d {V —†}|j
                             d¦  «        }|dk    r-d|› d�}t          j        |j        |j        ||j
        ¬¦  «        ‚	 d d d ¦  «        ƒd {V —† n# 1 ƒd {V —†swxY w Y   n'# t          j        $ r}	t!          d	¦  «        |	‚d }	~	ww xY wt"          j                             |¦  «        S )
N)ÚtotalT)r   r   Údatar   Úraise_for_statusr   zContent-Typezapplication/timestamp-replyz?Bad content type. Expected application/timestamp-reply,but got ú.)Úmessager   z(Error while contacting timestamp service)r$   ÚaiohttpÚClientTimeoutr   r    Úpostr   Údumpr   Úreadr   ÚgetÚContentTypeErrorÚrequest_infoÚhistoryÚClientErrorr   r   ÚTimeStampRespÚload)
r   r)   r   Ú
cl_timeoutr   ÚresponseÚresponse_dataÚctÚmsgÚes
             r   Úasync_request_tsa_responsez-AIOHttpTimeStamper.async_request_tsa_responseH   s@  è è € ð ×(Ò(Ñ*Ô*Ð*Ð*Ð*Ð*Ð*Ð*ˆåÔ*°´Ð>Ñ>Ô>ˆ
Ø×2Ò2Ñ4Ô4Ð4Ð4Ð4Ð4Ð4Ð4ˆð	Ø—|’|Ø”HØØ—X’X‘Z”ZØ”YØ!%Ø"ð $ñ ô ð ð ð ð ð ð ð ð ð Ø&.§m¢m¡o¤oÐ 5Ð 5Ð 5Ð 5Ð 5Ð 5�ØÔ%×)Ò)¨.Ñ9Ô9�ØÐ6Ò6Ð6ðEØ?AðEð Eð Eð õ "Ô2Ø Ô-Ø Ô(Ø #Ø (Ô 0ð	ñ ô ð ð ðð ð ñ ô ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð øøøð ð ð ð øøõ* Ô"ð 	ð 	ð 	Ý'Ø:ñô àðøøøøð	øøøõ Ô ×%Ò% mÑ4Ô4Ð4s=   Á=D ÂA(DÃ9D Ä
DÄD ÄDÄD ÄEÄ,D<Ä<E)Fr   NN)Ú__name__Ú
__module__Ú__qualname__r   r0   ÚClientSessionr
   r   Ú	BasicAuthr   Údictr    r$   r   ÚContentInfor&   r   ÚTimeStampReqr:   rB   Ú__classcell__)r   s   @r   r   r      s  ø€ € € € € ð
 ØØØ,0ðð ð �wÔ,¨kÐ9Ô:ðð �wÔ(Ô)ðð ð ð ð ð ð@	3¨Tð 	3ð 	3ð 	3ð 	3ð 7Ô#8ð ð ð ð ðKà	ŒðKð Kð Kð Kð Kð Kð
!5ØÔ#ð!5à	Ô	ð!5ð !5ð !5ð !5ð !5ð !5ð !5ð !5r   r   )Útypingr   r   Ú
asn1cryptor   r   Úpyhanko.sign.timestampsr   r   Ú$pyhanko.sign.timestamps.common_utilsr	   Ú4pyhanko_certvalidator.fetchers.aiohttp_fetchers.utilr
   r0   ÚImportErrorÚ_er   © r   r   ú<module>rT      sø   ðØ "Ð "Ð "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð Ð Ð Ø FÐ FÐ FÐ FÐ FÐ FÐ FÐ FØ @Ð @Ð @Ð @Ð @Ð @Ø LÐ LÐ LÐ LÐ LÐ LðØ€N€N€N€NøØð ð ð Ø
ˆ+ØIñô àðøøøøðøøøðY5ð Y5ð Y5ð Y5ð Y5˜ñ Y5ô Y5ð Y5ð Y5ð Y5s   ¦+ «A°<¼A