
    ,h<                       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  \R                   (       a5  S SKr\R&                  " S	\R(                  \\4   \R(                  \\4   S
9rO \R&                  " S	\R(                  \\4   S9r " S S\R0                  \   5      r    SS jr " S S\R6                  \   5      rg)    )annotationsN   )
want_bytes)
BadPayload)BadSignature)_make_keys_list)Signer_TSerialized)bounddefault)r   c                  (    \ rS rSrSS jrSS jrSrg)_PDataSerializer   c                   g N )selfpayloads     O/var/www/auris/envauris/lib/python3.13/site-packages/itsdangerous/serializer.pyloads_PDataSerializer.loads   s        c                   g r   r   r   objs     r   dumps_PDataSerializer.dumps   s    Cr   r   N)r   r
   returnt.Any)r   r   r   r
   )__name__
__module____qualname____firstlineno__r   r   __static_attributes__r   r   r   r   r      s
    ; 8r   r   c                @    [        U R                  0 5      [        5      $ )z5Checks whether a serializer generates text or binary.)
isinstancer   str)
serializers    r   is_text_serializerr)   #   s     j&&r*C00r   c                     \ rS rSr% Sr\rS\S'   \r	S\S'   / r
S\S'   \R                        S               SS
 jj5       r\R                      S                S!S jj5       r\R                   S"S	S	S	S	S.               S!S jjj5       r\R                      S              S#S jj5       r\R                   S"S	S	S	S	S.             S#S jjj5       r      S             S$S jjr\S%S j5       r S&     S'S jjrS(S jrS&S)S jjrS&S*S jjrS&S+S jjrS&S,S jjr S&       S-S jjrS&S.S jjr S&     S/S jjr  S0         S1S jjr S&     S2S jjrSrg	)3
Serializer*   a  A serializer wraps a :class:`~itsdangerous.signer.Signer` to
enable serializing and securely signing data other than bytes. It
can unsign to verify that the data hasn't been changed.

The serializer provides :meth:`dumps` and :meth:`loads`, similar to
:mod:`json`, and by default uses :mod:`json` internally to serialize
the data to bytes.

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 serializer: An object that provides ``dumps`` and ``loads``
    methods for serializing data to a string. Defaults to
    :attr:`default_serializer`, which defaults to :mod:`json`.
:param serializer_kwargs: Keyword arguments to pass when calling
    ``serializer.dumps``.
:param signer: A ``Signer`` class to instantiate when signing data.
    Defaults to :attr:`default_signer`, which defaults to
    :class:`~itsdangerous.signer.Signer`.
:param signer_kwargs: Keyword arguments to pass when instantiating
    the ``Signer`` class.
:param fallback_signers: List of signer parameters to try when
    unsigning with the default signer fails. Each item can be a dict
    of ``signer_kwargs``, a ``Signer`` class, or a tuple of
    ``(signer, signer_kwargs)``. Defaults to
    :attr:`default_fallback_signers`.

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

.. versionchanged:: 2.0
    Removed the default SHA-512 fallback signer from
    ``default_fallback_signers``.

.. versionchanged:: 1.1
    Added support for ``fallback_signers`` and configured a default
    SHA-512 fallback. This fallback is for users who used the yanked
    1.0.0 release which defaulted to SHA-512.

.. versionchanged:: 0.14
    The ``signer`` and ``signer_kwargs`` parameters were added to
    the constructor.
_PDataSerializer[t.Any]default_serializerztype[Signer]default_signerzMlist[dict[str, t.Any] | tuple[type[Signer], dict[str, t.Any]] | type[Signer]]default_fallback_signersNc                    g r   r   r   
secret_keysaltr(   serializer_kwargssignersigner_kwargsfallback_signerss           r   __init__Serializer.__init__m        r   c                    g r   r   r2   s           r   r9   r:   }   r;   r   )r5   r6   r7   r8   c                   g r   r   r2   s           r   r9   r:           r   c                    g r   r   r2   s           r   r9   r:      r;   r   c                   g r   r   r2   s           r   r9   r:      r>   r   c                >   [        U5      U l        Ub  [        U5      nX l        Uc  U R                  nX0l        [        U5      U l        Uc  U R                  nXPl        U=(       d    0 U l	        Uc  [        U R                  5      nUU l        U=(       d    0 U l        g r   )r   secret_keysr   r4   r.   r(   r)   r/   r6   r7   listr0   r8   r5   r2   s           r   r9   r:      s    $ )8
(Cd#D 	00J:D(::(F>((F$*/</B##D$A$AB  	 4E3J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.
)rB   )r   s    r   r3   Serializer.secret_key   s    
 ##r   c                    Uc  U R                   nU R                  nOUn[        U5      n U(       a   UR                  UR                  S5      5      $ UR                  U5      $ ! [         a  n[        SUS9UeSnAff = f)zLoads the encoded object. This function raises
:class:`.BadPayload` if the payload is not valid. The
``serializer`` parameter can be used to override the serializer
stored on the class. The encoded ``payload`` should always be
bytes.
Nutf-8zSCould not load the payload because an exception occurred on unserializing the data.)original_error)r(   r)   r   decode	Exceptionr   )r   r   r(   use_serializeris_textes         r   load_payloadSerializer.load_payload   s     !__N--G'N(4G
	%++GNN7,CDD!''00 	7  		s   &A# A# #
A=-A88A=c                b    [        U R                  R                  " U40 U R                  D65      $ )zDumps the encoded object. The return value is always bytes.
If the internal serializer returns text, the value will be
encoded as UTF-8.
)r   r(   r   r5   r   s     r   dump_payloadSerializer.dump_payload  s)    
 $////Nt7M7MNOOr   c                r    Uc  U R                   nU R                  " U R                  4SU0U R                  D6$ )zrCreates a new instance of the signer to be used. The default
implementation uses the :class:`.Signer` base class.
r4   )r4   r6   rB   r7   )r   r4   s     r   make_signerSerializer.make_signer  s7     <99D{{4++M$M$:L:LMMr   c              #  J  #    Uc  U R                   nU R                  U5      v   U R                   Hm  n[        U[        5      (       a  UnU R
                  nO&[        U[        5      (       a  Uu  p#OU R                  nU R                   H  nU" U4SU0UD6v   M     Mo     g7f)zIterates over all signers to be tried for unsigning. Starts
with the configured signer, then constructs each signer
specified in ``fallback_signers``.
Nr4   )	r4   rU   r8   r&   dictr6   tupler7   rB   )r   r4   fallbackkwargsr3   s        r   iter_unsignersSerializer.iter_unsigners!  s     
 <99Dt$$--H(D))!;;He,,#+ &++"..
z???? / .s   B!B#c                    [        U R                  U5      5      nU R                  U5      R                  U5      nU R                  (       a  UR                  S5      $ U$ )zReturns a signed string serialized with the internal
serializer. The return value can be either a byte or unicode
string depending on the format of the internal serializer.
rH   )r   rR   rU   signr)   rJ   )r   r   r4   r   rvs        r   r   Serializer.dumps7  sQ    
 T..s34d#((1""99W%%	r   c                D    UR                  U R                  X5      5        g)zzLike :meth:`dumps` but dumps into a file. The file handle has
to be compatible with what the internal serializer expects.
N)writer   )r   r   fr4   s       r   dumpSerializer.dumpD  s     	


3%&r   c                    [        U5      nSnU R                  U5       H$  n U R                  UR                  U5      5      s  $    [
        R                  " [        U5      e! [         a  nUn SnAMU  SnAff = f)zYReverse of :meth:`dumps`. Raises :exc:`.BadSignature` if the
signature validation fails.
N)r   r\   rO   unsignr   tcast)r   sr4   r[   last_exceptionr6   errs          r   r   Serializer.loadsJ  sp     qM))$/F%((q)9:: 0 ff\>22   %!$%s   A""
A9,A44A9c                B    U R                  UR                  5       U5      $ )z)Like :meth:`loads` but loads from a file.)r   readr   rd   r4   s      r   loadSerializer.load[  s    zz!&&(D))r   c                $    U R                  X5      $ )a  Like :meth:`loads` but without verifying the signature. This
is potentially very dangerous to use depending on how your
serializer works. The return value is ``(signature_valid,
payload)`` instead of just the payload. The first item will be a
boolean that indicates if the signature is valid. This function
never fails.

Use it for debugging only and if you know that your serializer
module is not exploitable (for example, do not use it with a
pickle serializer).

.. versionadded:: 0.15
)_loads_unsafe_impl)r   rk   r4   s      r   loads_unsafeSerializer.loads_unsafe_  s      &&q//r   c                    Uc  0 n SU R                   " U4SU0UD64$ ! [         aU  nUR                  c   SnAgUc  0 n SU R                  " UR                  40 UD64s SnA$ ! [         a      SnAgf = fSnAff = f)zVLow level helper function to implement :meth:`loads_unsafe`
in serializer subclasses.
NTr4   )FNF)r   r   r   rO   r   )r   rk   r4   load_kwargsload_payload_kwargsrN   s         r   ru   Serializer._loads_unsafe_implq  s     K	#A@D@K@@@ 	#yy ""*&(##%%aiiG3FG   #"#	#s=    
A=A8A8 A$A=$
A5.A84A55A88A=c                >    U R                  UR                  5       US9$ )zILike :meth:`loads_unsafe` but loads from a file.

.. versionadded:: 0.15
)r4   )rv   rp   rq   s      r   load_unsafeSerializer.load_unsafe  s         55r   )r8   r)   r4   rB   r(   r5   r6   r7   )   itsdangerousNNNNN)r   zSerializer[str]r3   7str | bytes | cabc.Iterable[str] | cabc.Iterable[bytes]r4   str | bytes | Noner(   zNone | _PDataSerializer[str]r5   dict[str, t.Any] | Noner6   type[Signer] | Noner7   r   r8   Tlist[dict[str, t.Any] | tuple[type[Signer], dict[str, t.Any]] | type[Signer]] | None)NNNN)r   zSerializer[bytes]r3   r   r4   r   r(   z_PDataSerializer[bytes]r5   r   r6   r   r7   r   r8   r   )r   )r3   r   r4   r   r(   r   r5   r   r6   r   r7   r   r8   r   )r3   r   r4   r   r(   zt.Any | Noner5   r   r6   r   r7   r   r8   r   )r   bytesr   )r   r   r(   z_PDataSerializer[t.Any] | Noner   r   )r   r   r   r   )r4   r   r   r	   )r4   r   r   zcabc.Iterator[Signer])r   r   r4   r   r   r
   )r   r   rd   t.IO[t.Any]r4   r   r   None)rk   str | bytesr4   r   r[   r   r   r   )rd   r   r4   r   r   r   )rk   r   r4   r   r   tuple[bool, t.Any])NN)
rk   r   r4   r   ry   r   rz   r   r   r   )rd   r   r4   r   r   r   )r    r!   r"   r#   __doc__jsonr.   __annotations__r	   r/   r0   ri   overloadr9   propertyr3   rO   rR   rU   r\   r   re   r   rr   rv   ru   r}   r$   r   r   r   r+   r+   *   s   1l 37/6 $*NL)
 	   
 ZZ $33759&*15 K ! 1	
 3 $ /  ZZ 6:&*15 K ! ,	
 3 $ /  ZZ $3 6:&*15 K !
 , 3 $ / $ ZZ 6:&*15 K ! 	
 3 $ /  ZZ $3 6:&*15 K !
  3 $ / $ $3#'59&*15 ,KK,K !,K !	,K
 3,K $,K /,K,K\ $ $ LP*H	8PN@,' :>33$63IN3	3"*
 :>00$60	0, 047;## !# -	#
 5# 
#> :>66$66	6 6r   r+   )r(   r-   r   z#te.TypeGuard[_PDataSerializer[str]])
__future__r   collections.abcabccabcr   typingri   encodingr   excr   r   r6   r   r	   TYPE_CHECKINGtyping_extensionsteTypeVarUnionr'   r   r
   Protocolr   r)   Genericr+   r   r   r   <module>r      s    "        # ??" ::aggc5j11773:;NL
 99^1773:3FGL8qzz,/ 81'1(1l6<( l6r   