ó
    ëÅi¯%  ã                  óä   • S SK Jr  S SKJr  S SK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
5      r " S S\5      rSSS jjr " S S\5      r    SS jr " S S5      rg)é    )ÚannotationsNé   )Ú_base64_alphabet)Úbase64_decode)Úbase64_encode)Ú
want_bytes)ÚBadSignaturec                  ó,   • \ rS rSrSrSS jrSS jrSrg)	ÚSigningAlgorithmé   z_Subclasses must implement :meth:`get_signature` to provide
signature generation functionality.
c                ó   • [        5       e)z2Returns the signature for the given key and value.)ÚNotImplementedError©ÚselfÚkeyÚvalues      ÚP/home/mande/repo/quber/.venv/lib/python3.13/site-packages/itsdangerous/signer.pyÚget_signatureÚSigningAlgorithm.get_signature   s   € ä!Ó#Ð#ó    c                óL   • [         R                  " X0R                  X5      5      $ )z=Verifies the given signature matches the expected
signature.
)ÚhmacÚcompare_digestr   )r   r   r   Úsigs       r   Úverify_signatureÚ!SigningAlgorithm.verify_signature   s    € ô ×"Ò" 3×(:Ñ(:¸3Ó(FÓGÐGr   © N©r   Úbytesr   r   Úreturnr   )r   r   r   r   r   r   r    Úbool)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   Ú__static_attributes__r   r   r   r   r      s   † ñô$÷Hr   r   c                  ó"   • \ rS rSrSrSS jrSrg)ÚNoneAlgorithmé   zXProvides an algorithm that does not perform any signing and
returns an empty signature.
c                ó   • g)Nr   r   r   s      r   r   ÚNoneAlgorithm.get_signature$   s   € Ør   r   Nr   )r"   r#   r$   r%   r&   r   r'   r   r   r   r)   r)      s   † ñ÷r   r)   c                ó.   • [         R                  " U 5      $ )z¼Don't access ``hashlib.sha1`` until runtime. FIPS builds may not include
SHA-1, in which case the import and use as a default would fail before the
developer can configure something else.
)ÚhashlibÚsha1)Ústrings    r   Ú
_lazy_sha1r1   (   s   € ô
 �<Š<˜ÓÐr   c                  óL   • \ rS rSr% Sr\" \5      rS\S'   S	S
S jjr	SS jr
Srg)ÚHMACAlgorithmé0   z*Provides signature generation using HMACs.út.AnyÚdefault_digest_methodNc                ó.   • Uc  U R                   nXl        g ©N)r6   Údigest_method)r   r9   s     r   Ú__init__ÚHMACAlgorithm.__init__8   s   € ØÑ Ø ×6Ñ6ˆMà$1Õr   c                ó`   • [         R                  " XU R                  S9nUR                  5       $ )N)ÚmsgÚ	digestmod)r   Únewr9   Údigest)r   r   r   Úmacs       r   r   ÚHMACAlgorithm.get_signature>   s$   € Ü�hŠh�s°×1CÑ1CÑDˆØ�z‰z‹|Ðr   )r9   r8   )r9   r5   r   )r"   r#   r$   r%   r&   Ústaticmethodr1   r6   Ú__annotations__r:   r   r'   r   r   r   r3   r3   0   s!   ‡ Ù4ñ
 $0°
Ó#;Ð˜5Ó;ö2÷r   r3   c                ó’   • [        U [        [        45      (       a  [        U 5      /$ U  Vs/ s H  n[        U5      PM     sn$ s  snf r8   )Ú
isinstanceÚstrr   r   )Ú
secret_keyÚss     r   Ú_make_keys_listrJ   C   s?   € ô �*œs¤E˜l×+Ñ+Ü˜:Ó&Ð'Ð'á#-Ó.¢:˜aŒJ�qŽM¡:Ñ.Ð.ùÒ.s   ¬Ac                  óÄ   • \ rS rSr% Sr\" \5      rS\S'   Sr	S\S'        S           SS	 jjr
\SS
 j5       rSSS jjrSS jrSS jrSS jrSS jrSS jrSrg)ÚSigneréL   a^  A signer securely signs bytes, then unsigns them to verify that
the value hasn't been changed.

The secret key should be a random string of ``bytes`` and should not
be saved to code or version control. Different salts should be used
to distinguish signing in different contexts. See :doc:`/concepts`
for information about the security of the secret key and salt.

:param secret_key: The secret key to sign and verify with. Can be a
    list of keys, oldest to newest, to support key rotation.
:param salt: Extra key to combine with ``secret_key`` to distinguish
    signatures in different contexts.
:param sep: Separator between the signature and value.
:param key_derivation: How to derive the signing key from the secret
    key and salt. Possible values are ``concat``, ``django-concat``,
    or ``hmac``. Defaults to :attr:`default_key_derivation`, which
    defaults to ``django-concat``.
:param digest_method: Hash function to use when generating the HMAC
    signature. Defaults to :attr:`default_digest_method`, which
    defaults to :func:`hashlib.sha1`. Note that the security of the
    hash alone doesn't apply when used intermediately in HMAC.
:param algorithm: A :class:`SigningAlgorithm` instance to use
    instead of building a default :class:`HMACAlgorithm` with the
    ``digest_method``.

.. versionchanged:: 2.0
    Added support for key rotation by passing a list to
    ``secret_key``.

.. versionchanged:: 0.18
    ``algorithm`` was added as an argument to the class constructor.

.. versionchanged:: 0.14
    ``key_derivation`` and ``digest_method`` were added as arguments
    to the class constructor.
r5   r6   údjango-concatrG   Údefault_key_derivationNc                ó@  • [        U5      U l        [        U5      U l        U R                  [        ;   a  [        S5      eUb  [        U5      nOSnX l        Uc  U R                  nX@l        Uc  U R                  nXPl
        Uc  [        U R                  5      nX`l        g )NzŠThe given separator cannot be used because it may be contained in the signature itself. ASCII letters, digits, and '-_=' must not be used.ó   itsdangerous.Signer)rJ   Úsecret_keysr   Úsepr   Ú
ValueErrorÚsaltrO   Úkey_derivationr6   r9   r3   Ú	algorithm)r   rH   rU   rS   rV   r9   rW   s          r   r:   ÚSigner.__init__�   s    € ô )8¸
Ó(CˆÔÜ$ S›/ˆŒà�8‰8Ô'Ó'Üð7óð ð ÑÜ˜dÓ#‰Dà)ˆDàŒ	àÑ!Ø!×8Ñ8ˆNà#1ÔàÑ Ø ×6Ñ6ˆMà$1ÔàÑÜ% d×&8Ñ&8Ó9ˆIà+4�r   c                ó    • U R                   S   $ )zThe newest (last) entry in the :attr:`secret_keys` list. This
is for compatibility from before key rotation support was added.
éÿÿÿÿ)rR   )r   s    r   rH   ÚSigner.secret_key¯   s   € ð
 ×Ñ Ñ#Ð#r   c                ó„  • Uc  U R                   S   nO[        U5      nU R                  S:X  aE  [        R                  " [
        U R                  U R                  U-   5      R                  5       5      $ U R                  S:X  aH  [        R                  " [
        U R                  U R                  S-   U-   5      R                  5       5      $ U R                  S:X  aI  [        R                  " XR                  S9nUR                  U R                  5        UR                  5       $ U R                  S:X  a  U$ [        S5      e)	a´  This method is called to derive the key. The default key
derivation choices can be overridden here. Key derivation is not
intended to be used as a security method to make a complex key
out of a short password. Instead you should use large random
secret keys.

:param secret_key: A specific secret key to derive from.
    Defaults to the last item in :attr:`secret_keys`.

.. versionchanged:: 2.0
    Added the ``secret_key`` parameter.
rZ   ÚconcatrN   s   signerr   )r>   ÚnonezUnknown key derivation method)rR   r   rV   ÚtÚcastr   r9   rU   r@   r   r?   ÚupdateÚ	TypeError)r   rH   rA   s      r   Ú
derive_keyÚSigner.derive_key¶   s  € ð ÑØ×)Ñ)¨"Ñ-‰Jä# JÓ/ˆJà×Ñ (Ó*Ü—6’6œ% ×!3Ñ!3°D·I±IÀ
Ñ4JÓ!K×!RÑ!RÓ!TÓUÐUØ× Ñ  OÓ3Ü—6’6Ü�t×)Ñ)¨$¯)©)°iÑ*?À*Ñ*LÓM×TÑTÓVóð ð × Ñ  FÓ*Ü—(’(˜:×1CÑ1CÑDˆCØ�J‰J�t—y‘yÔ!Ø—:‘:“<ÐØ× Ñ  FÓ*ØÐäÐ;Ó<Ð<r   c                ó„   • [        U5      nU R                  5       nU R                  R                  X!5      n[	        U5      $ )z*Returns the signature for the given value.)r   rc   rW   r   r   )r   r   r   r   s       r   r   ÚSigner.get_signature×   s7   € ä˜5Ó!ˆØ�o‰oÓˆØ�n‰n×*Ñ*¨3Ó6ˆÜ˜SÓ!Ð!r   c                óX   • [        U5      nXR                  -   U R                  U5      -   $ )zSigns the given string.)r   rS   r   )r   r   s     r   ÚsignÚSigner.signÞ   s)   € ä˜5Ó!ˆØ—x‘xÑ $×"4Ñ"4°UÓ";Ñ;Ð;r   c                óò   •  [        U5      n[        U5      n[        U R                  5       H7  nU R                  U5      nU R                  R                  XAU5      (       d  M7    g   g! [         a     gf = f)z+Verifies the signature for the given value.FT)r   Ú	Exceptionr   ÚreversedrR   rc   rW   r   )r   r   r   rH   r   s        r   r   ÚSigner.verify_signatureã   ss   € ð	Ü Ó$ˆCô ˜5Ó!ˆä" 4×#3Ñ#3Ö4ˆJØ—/‘/ *Ó-ˆCà�~‰~×.Ñ.¨s¸3×?Ó?Ùñ	 5ð øô ó 	Ùð	ús   ‚A) Á)
A6Á5A6c                óö   • [        U5      nU R                  U;  a  [        SU R                  < S35      eUR                  U R                  S5      u  p#U R	                  X#5      (       a  U$ [        SU< S3US9e)zUnsigns the given string.zNo z found in valuer   z
Signature z does not match)Úpayload)r   rS   r	   Úrsplitr   )r   Úsigned_valuer   r   s       r   ÚunsignÚSigner.unsignô   st   € ä! ,Ó/ˆà�8‰8˜<Ó'Ü  T§X¡X¡L°Ð@ÓAÐAà!×(Ñ(¨¯©°1Ó5‰
ˆà× Ñ  ×,Ñ,ØˆLä˜Z¨¡w¨oÐ>ÈÑNÐNr   c                óH   •  U R                  U5        g! [         a     gf = f)z^Only validates the given signed value. Returns ``True`` if
the signature exists and is valid.
TF)rr   r	   )r   rq   s     r   ÚvalidateÚSigner.validate  s(   € ð	Ø�K‰K˜Ô%ØøÜó 	Ùð	ús   ‚ ”
! !)rW   r9   rV   rU   rR   rS   )rQ   ó   .NNN)rH   ú7str | bytes | cabc.Iterable[str] | cabc.Iterable[bytes]rU   ústr | bytes | NonerS   ústr | bytesrV   z
str | Noner9   zt.Any | NonerW   zSigningAlgorithm | None)r    r   r8   )rH   ry   r    r   )r   rz   r    r   )r   rz   r   rz   r    r!   )rq   rz   r    r   )rq   rz   r    r!   )r"   r#   r$   r%   r&   rC   r1   r6   rD   rO   r:   ÚpropertyrH   rc   r   rh   r   rr   ru   r'   r   r   r   rL   rL   L   s¬   ‡ ñ#ñV $0°
Ó#;Ð˜5Ó;ð #2Ð˜CÓ1ð
 $:ØØ%)Ø&*Ø-1ð,5àKð,5ð !ð,5ð ð	,5ð
 #ð,5ð $ð,5ð +õ,5ð\ ó$ó ð$ö=ôB"ô<ô
ô"O÷r   rL   )r   )r0   r   r    r5   )rH   rx   r    zlist[bytes])Ú
__future__r   Úcollections.abcÚabcÚcabcr.   r   Útypingr_   Úencodingr   r   r   r   Úexcr	   r   r)   r1   r3   rJ   rL   r   r   r   Ú<module>rƒ      so   ðÝ "å Û Û Û å &Ý #Ý #Ý  Ý ÷Hñ Hô Ð$ô ö ôÐ$ô ð&/ØGð/àô/÷~ò ~r   