ó
    ëÅi“  ã                  óú   • S SK Jr  S SKJr  S SKrS SKrS SKJr  S SKJ	r	  SSK
Jr  SSK
Jr  SSK
Jr  SS	K
Jr  SS
K
Jr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr   " S S\5      r " S S\\   5      rg)é    )ÚannotationsN)Údatetime)Útimezoneé   )Úbase64_decode)Úbase64_encode)Úbytes_to_int)Úint_to_bytes)Ú
want_bytes)ÚBadSignature)ÚBadTimeSignature)ÚSignatureExpired)Ú_TSerialized)Ú
Serializer)ÚSignerc                  óî   ^ • \ rS rSrSrSS jrSS jrSS jr\R                    S       SS jj5       r
\R                    S       SS jj5       r
  S       SU 4S jjjr
SSS	 jjrS
rU =r$ )ÚTimestampSigneré   zîWorks like the regular :class:`.Signer` but also records the time
of the signing and can be used to expire signatures. The
:meth:`unsign` method can raise :exc:`.SignatureExpired` if the
unsigning failed because the signature is expired.
c                ó>   • [        [        R                  " 5       5      $ )zDReturns the current timestamp. The function must return an
integer.
)ÚintÚtime)Úselfs    ÚO/home/mande/repo/quber/.venv/lib/python3.13/site-packages/itsdangerous/timed.pyÚget_timestampÚTimestampSigner.get_timestamp   s   € ô ”4—9’9“;ÓÐó    c                óH   • [         R                  " U[        R                  S9$ )zøConvert the timestamp from :meth:`get_timestamp` into an
aware :class`datetime.datetime` in UTC.

.. versionchanged:: 2.0
    The timestamp is returned as a timezone-aware ``datetime``
    in UTC rather than a naive ``datetime`` assumed to be UTC.
)Útz)r   Úfromtimestampr   Úutc)r   Útss     r   Útimestamp_to_datetimeÚ%TimestampSigner.timestamp_to_datetime#   s   € ô ×%Ò% b¬X¯\©\Ñ:Ð:r   c                óÀ   • [        U5      n[        [        U R                  5       5      5      n[        U R                  5      nX-   U-   nX-   U R                  U5      -   $ )z:Signs the given string and also attaches time information.)r   r   r
   r   ÚsepÚget_signature)r   ÚvalueÚ	timestampr%   s       r   ÚsignÚTimestampSigner.sign-   sV   € ä˜5Ó!ˆÜ!¤,¨t×/AÑ/AÓ/CÓ"DÓEˆ	Ü˜Ÿ™Ó"ˆØ‘˜iÑ'ˆØ‰{˜T×/Ñ/°Ó6Ñ6Ð6r   c                ó   • g ©N© ©r   Úsigned_valueÚmax_ageÚreturn_timestamps       r   ÚunsignÚTimestampSigner.unsign8   s   € ð r   c                ó   • g r,   r-   r.   s       r   r2   r3   @   s   € ð "%r   c                ó  >•  [         TU ]  U5      nSn[	        U R
                  5      nXt;  a  U(       a  Ue[        SUS9eUR                  US5      u  p‰Sn
Sn [        [        U	5      5      n
Ub(  U
b   U R                  U
5      n[        [        U5      X‹S9eU
c
  [        SUS9eUb]  U R!                  5       U
-
  nXÒ:”  a!  [#        SU S	U S
3UU R                  U
5      S9eUS:  a  [#        SU S3UU R                  U
5      S9eU(       a  X€R                  U
5      4$ U$ ! [         a"  nUnUR                  =(       d    Sn SnAGN4SnAff = f! [         a     Nîf = f! [        [        [        4 a  n[        SUS9UeSnAff = f)a­  Works like the regular :meth:`.Signer.unsign` but can also
validate the time. See the base docstring of the class for
the general behavior. If ``return_timestamp`` is ``True`` the
timestamp of the signature will be returned as an aware
:class:`datetime.datetime` object in UTC.

.. versionchanged:: 2.0
    The timestamp is returned as a timezone-aware ``datetime``
    in UTC rather than a naive ``datetime`` assumed to be UTC.
Nr   ztimestamp missing)Úpayloadr   zMalformed timestamp)r6   Údate_signedzSignature age z > z secondsr   z < 0 seconds)Úsuperr2   r   r6   r   r%   r   Úrsplitr	   r   Ú	Exceptionr"   Ú
ValueErrorÚOSErrorÚOverflowErrorÚstrr   r   )r   r/   r0   r1   ÚresultÚ	sig_errorÚer%   r'   Úts_bytesÚts_intÚts_dtÚexcÚageÚ	__class__s                 €r   r2   r3   H   sÍ  ø€ ð 	&Ü‘W‘^ LÓ1ˆFØˆIô
 ˜Ÿ™Ó"ˆð ÓÞØ�ä"Ð#6ÀÑGÐGà Ÿ-™-¨¨QÓ/‰ˆØ!ˆØ!%ˆð	Ü!¤-°Ó"9Ó:ˆFð Ñ ØÑ!ðØ ×6Ñ6°vÓ>�Eô #¤3 y£>¸5ÑTÐTð ‰>Ü"Ð#8À%ÑHÐHð ÑØ×$Ñ$Ó&¨Ñ/ˆCà‹}Ü&Ø$ S E¨¨W¨I°XÐ>Ø!Ø $× :Ñ :¸6Ó Bñð ð �Q‹wÜ&Ø$ S E¨Ð6Ø!Ø $× :Ñ :¸6Ó Bñð ö Ø×4Ñ4°VÓ<Ð<Ð<àˆøôG ó 	&ØˆIØ—Y‘Y×% #ŽFûð	&ûô. ó 	Ùð	ûô #¤G¬]Ð;ó ô +Ø-°uñàðûðúsA   ƒD! ÁE Á5E  Ä!
EÄ+EÅEÅ
EÅEÅ FÅ5F Æ Fc                óD   •  U R                  XS9  g! [         a     gf = f)z]Only validates the given signed value. Returns ``True`` if
the signature exists and is valid.)r0   TF)r2   r   )r   r/   r0   s      r   ÚvalidateÚTimestampSigner.validate    s*   € ð	Ø�K‰K˜ˆKÑ6ØøÜó 	Ùð	ús   ‚ ’
žr-   )Úreturnr   )r!   r   rK   r   )r'   ústr | bytesrK   Úbytes)NF)r/   rL   r0   ú
int | Noner1   zt.Literal[False]rK   rM   )NT)r/   rL   r0   rN   r1   zt.Literal[True]rK   ztuple[bytes, datetime])r/   rL   r0   rN   r1   ÚboolrK   ztuple[bytes, datetime] | bytesr,   )r/   rL   r0   rN   rK   rO   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r"   r)   ÚtÚoverloadr2   rI   Ú__static_attributes__Ú__classcell__©rG   s   @r   r   r      sì   ø† ñô ô;ô7ð ‡Z�Zð #Ø-2ð	à!ðð ðð +ð	ð
 
ôó ðð ‡Z�Zð #Ø,0ð	%à!ð%ð ð%ð *ð	%ð
 
 ô%ó ð%ð #Ø!&ð	Và!ðVð ðVð ð	Vð
 
(÷Vð V÷pô r   r   c                  ó’   ^ • \ rS rSr% Sr\rS\S'    S	   S
U 4S jjjr   S         SS jjr	  S       SS jjr
SrU =r$ )ÚTimedSerializeréª   zGUses :class:`TimestampSigner` instead of the default
:class:`.Signer`.
ztype[TimestampSigner]Údefault_signerc                óL   >• [         R                  " S[        TU ]  U5      5      $ )Núcabc.Iterator[TimestampSigner])rU   Úcastr8   Úiter_unsigners)r   ÚsaltrG   s     €r   ra   ÚTimedSerializer.iter_unsigners±   s!   ø€ ô �vŠvÐ6¼¹Ñ8NÈtÓ8TÓUÐUr   c                ó.  • [        U5      nSnU R                  U5       H5  n UR                  XSS9u  pxU R                  U5      n	U(       a  X˜4s  $ U	s  $    [        R                  " [
        U5      e! [         a    e [
         a  n
U
n Sn
A
Mp  Sn
A
ff = f)aV  Reverse of :meth:`dumps`, raises :exc:`.BadSignature` if the
signature validation fails. If a ``max_age`` is provided it will
ensure the signature is not older than that time in seconds. In
case the signature is outdated, :exc:`.SignatureExpired` is
raised. All arguments are forwarded to the signer's
:meth:`~TimestampSigner.unsign` method.
NT)r0   r1   )r   ra   r2   Úload_payloadr   r   rU   r`   )r   Úsr0   r1   rb   Úlast_exceptionÚsignerÚbase64dr(   r6   Úerrs              r   ÚloadsÚTimedSerializer.loads¹   s¡   € ô �q‹MˆØˆà×)Ñ)¨$Ö/ˆFð%Ø%+§]¡]Ø¸ð &3ð &Ñ"�ð ×+Ñ+¨GÓ4�æ#Ø"Ð-Ò-à’ñ 0ô$ �fŠf”\ >Ó2Ð2øô $ó ð Üó %Ø!$–ûð%ús   £,A3ÁA3Á3BÂBÂBc                ó&   • U R                  XSU0S9$ )Nr0   )Úload_kwargs)Ú_loads_unsafe_impl)r   rf   r0   rb   s       r   Úloads_unsafeÚTimedSerializer.loads_unsafeÞ   s   € ð ×&Ñ& q¸YÈÐ<PÐ&ÐQÐQr   r-   r,   )rb   ústr | bytes | NonerK   r_   )NFN)
rf   rL   r0   rN   r1   rO   rb   rr   rK   zt.Any)NN)rf   rL   r0   rN   rb   rr   rK   ztuple[bool, t.Any])rP   rQ   rR   rS   rT   r   r]   Ú__annotations__ra   rk   rp   rW   rX   rY   s   @r   r[   r[   ª   s·   ø‡ ñð -<€NÐ)Ó;ð *.ðVØ&ðVà	'÷Vð Vð #Ø!&Ø#'ð#3àð#3ð ð#3ð ð	#3ð
 !ð#3ð 
õ#3ðP #Ø#'ð	RàðRð ðRð !ð	Rð
 
÷Ró Rr   r[   )Ú
__future__r   Úcollections.abcÚabcÚcabcr   ÚtypingrU   r   r   Úencodingr   r   r	   r
   r   rE   r   r   r   Ú
serializerr   r   rh   r   r   r[   r-   r   r   Ú<module>r{      sZ   ðÝ "å Û Û Ý Ý å #Ý #Ý "Ý "Ý  Ý Ý !Ý !Ý $Ý "Ý ôQ�fô Qôh:R�j Ñ.õ :Rr   