Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/itsdangerous/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/itsdangerous/__pycache__/serializer.cpython-312.pyc

�

'ٜg�<���ddlmZddlmZddlZddlZddlm	Z	ddl
mZddl
mZddl
mZddl
mZej r8ddlZej&d	ej(eefej(eef�
�Zn#ej&d	ej(eef��ZGd�d
ej0e�Z				dd�ZGd�dej6e�Zy)�)�annotationsN�)�
want_bytes)�
BadPayload)�BadSignature)�_make_keys_list)�Signer�_TSerialized)�bound�default)rc��eZdZdd�Zdd�Zy)�_PDataSerializerc��y�N�)�self�payloads  �B/usr/local/lib/python3.12/site-packages/itsdangerous/serializer.py�loadsz_PDataSerializer.loadss���c��yrr�r�objs  r�dumpsz_PDataSerializer.dumpss��CrN)rr
�return�t.Any)rrrr
)�__name__�
__module__�__qualname__rrrrrrrs
��;�8rrc�@�t|ji�t�S)z5Checks whether a serializer generates text or binary.)�
isinstancer�str)�
serializers r�is_text_serializerr$#s���j�&�&�r�*�C�0�0rc���eZdZUdZeZded<eZded<gZ	ded<e
j						d															dd	��Ze
j				d															dd
��Ze
j	d ddddd�															dd��Ze
j				d													d!d
��Ze
j	d ddddd�													d!d��Z						d													d"d�Ze
d#d��Z	d$					d%d�Zd&d�Zd$d'd�Zd$d(d�Zd$d)d�Zd$d*d�Z	d$							d+d�Zd$d,d�Z	d$					d-d�Z		d.									d/d�Z	d$					d0d�Zy)1�
Serializera:	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��yrr�r�
secret_key�saltr#�serializer_kwargs�signer�
signer_kwargs�fallback_signerss        r�__init__zSerializer.__init__m���rc��yrrr,s        rr3zSerializer.__init__}r4r)r/r0r1r2c��yrrr,s        rr3zSerializer.__init__����rc��yrrr,s        rr3zSerializer.__init__�r4rc��yrrr,s        rr3zSerializer.__init__�r7rc�(�t|�|_|�t|�}||_|�|j}||_t
|�|_|�|j}||_|xsi|_	|�t|j�}||_|xsi|_
yr)r�secret_keysrr.r(r#r$r)r0r1�listr*r2r/r,s        rr3zSerializer.__init__�s���$)8�
�(C������d�#�D���	����0�0�J�:D���(:�:�(F����>��(�(�F�$*���/<�/B�����#�#�D�$A�$A�B��
�	
��4E�3J���rc� �|jdS)z�The newest (last) entry in the :attr:`secret_keys` list. This
        is for compatibility from before key rotation support was added.
        ���)r;)rs rr-zSerializer.secret_key�s��
����#�#rc��|�|j}|j}n
|}t|�}	|r |j|jd��S|j|�S#t$r}td|��|�d}~wwxYw)aLoads 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)rrr#�use_serializer�is_text�es      r�load_payloadzSerializer.load_payload�s�����!�_�_�N��-�-�G�'�N�(��4�G�
	��%�+�+�G�N�N�7�,C�D�D�!�'�'��0�0���	��7� ���	
��	�s�!A�A�	A9�&A4�4A9c�b�t|jj|fi|j���S)z�Dumps the encoded object. The return value is always bytes.
        If the internal serializer returns text, the value will be
        encoded as UTF-8.
        )rr#rr/rs  r�dump_payloadzSerializer.dump_payloads,��
�/�$�/�/�/�/��N�t�7M�7M�N�O�Orc�p�|�|j}|j|jfd|i|j��S)z�Creates a new instance of the signer to be used. The default
        implementation uses the :class:`.Signer` base class.
        r.)r.r0r;r1)rr.s  r�make_signerzSerializer.make_signers9���<��9�9�D��t�{�{�4�+�+�M�$�M�$�:L�:L�M�Mrc#�.K�|�|j}|j|���|jD]a}t|t�r|}|j
}n"t|t�r|\}}n|j}|jD]}||fd|i|������cy�w)z�Iterates over all signers to be tried for unsigning. Starts
        with the configured signer, then constructs each signer
        specified in ``fallback_signers``.
        Nr.)	r.rKr2r!�dictr0�tupler1r;)rr.�fallback�kwargsr-s     r�iter_unsignerszSerializer.iter_unsigners!s�����
�<��9�9�D����t�$�$��-�-�H��(�D�)�!���;�;���H�e�,�#+� ��&��+�+��"�.�.�
��z�?��?��?�?�/�.�s�BBc��t|j|��}|j|�j|�}|jr|jd�S|S)z�Returns 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.
        r@)rrIrK�signr$rB)rrr.r�rvs     rrzSerializer.dumps7sQ��
�T�.�.�s�3�4��
�
�
�d�
#�
(�
(��
1���"�"��9�9�W�%�%��	rc�F�|j|j||��y)z�Like :meth:`dumps` but dumps into a file. The file handle has
        to be compatible with what the internal serializer expects.
        N)�writer)rr�fr.s    r�dumpzSerializer.dumpDs��	
����
�
�3��%�&rc���t|�}d}|j|�D]$}	|j|j|��cStjt|��#t$r}|}Yd}~�Qd}~wwxYw)ziReverse of :meth:`dumps`. Raises :exc:`.BadSignature` if the
        signature validation fails.
        N)rrQrG�unsignr�t�cast)r�sr.rP�last_exceptionr0�errs       rrzSerializer.loadsJsp��
�q�M�����)�)�$�/�F�
%��(�(����q�)9�:�:�0��f�f�\�>�2�2�� �
%�!$���
%�s�A � 	A5�)A0�0A5c�B�|j|j�|�S)z)Like :meth:`loads` but loads from a file.)r�read�rrWr.s   r�loadzSerializer.load[s���z�z�!�&�&�(�D�)�)rc�&�|j||�S)a9Like :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)rr]r.s   r�loads_unsafezSerializer.loads_unsafe_s�� �&�&�q�$�/�/rc��|�i}	d|j|fd|i|��fS#t$rR}|j�Yd}~y|�i}	d|j|jfi|��fcYd}~S#t$rYYd}~ywxYwd}~wwxYw)zfLow level helper function to implement :meth:`loads_unsafe`
        in serializer subclasses.
        NTr.)FNF)rrrrGr)rr]r.�load_kwargs�load_payload_kwargsrFs      rrezSerializer._loads_unsafe_implqs������K�	#������A�@�D�@�K�@�@�@���
	#��y�y� �"�"�*�&(�#�
#��%�D�%�%�a�i�i�G�3F�G�����
#�"�
#��
	#�s<��	A8�A3�A3�A �A8� 	A0�)A3�/A0�0A3�3A8c�D�|j|j�|��S)zYLike :meth:`loads_unsafe` but loads from a file.

        .. versionadded:: 0.15
        )r.)rfrarbs   r�load_unsafezSerializer.load_unsafe�s ��� � ������ �5�5r)�itsdangerousNNNNN)rzSerializer[str]r-�7str | bytes | cabc.Iterable[str] | cabc.Iterable[bytes]r.�str | bytes | Noner#zNone | _PDataSerializer[str]r/�dict[str, t.Any] | Noner0�type[Signer] | Noner1ror2�Tlist[dict[str, t.Any] | tuple[type[Signer], dict[str, t.Any]] | type[Signer]] | None)NNNN)rzSerializer[bytes]r-rmr.rnr#z_PDataSerializer[bytes]r/ror0rpr1ror2rq)rl)r-rmr.rnr#rr/ror0rpr1ror2rq)r-rmr.rnr#zt.Any | Noner/ror0rpr1ror2rq)r�bytesr)rrrr#z_PDataSerializer[t.Any] | Nonerr)rrrrr)r.rnrr	)r.rnrzcabc.Iterator[Signer])rrr.rnrr
)rrrW�t.IO[t.Any]r.rnr�None)r]�str | bytesr.rnrPrrr)rWrsr.rnrr)r]rur.rnr�tuple[bool, t.Any])NN)
r]rur.rnrhrorirorrv)rWrsr.rnrrv)rrr�__doc__�jsonr(�__annotations__r	r)r*r[�overloadr3�propertyr-rGrIrKrQrrXrrcrfrerkrrrr&r&*s���1�l37��/�6�$*�N�L�)�
	����
�Z�Z�$3�37�59�&*�15�����K��!��1�	�
3��$�
�/�������Z�Z�6:�&*�15�����K��!��,�	�
3��$�
�/�������Z�Z�$3�
�6:�&*�15��
��
�K�
�!�
�
,�
�3�

�$�
�/�
��
��
�$�Z�Z�6:�&*�15���K��!���	�
3��$�
�/�������Z�Z�$3�
�6:�&*�15��
�K�
�!�
�
�
�3�

�$�
�/�
��
��
�$$3�#'�59�&*�15��,K�K�,K�!�,K�!�	,K�
3�,K�$�
,K�/�,K��,K�\�$��$�LP����*H��	��8P�N�@�,�'�:>�3��3�$6�3�IN�3�	�3�"*�
:>�0��0�$6�0�	�0�,04�7;�#��#�!�#�-�	#�
5�#�
�
#�>:>�6��6�$6�6�	�6rr&)r#r'rz#te.TypeGuard[_PDataSerializer[str]])�
__future__r�collections.abc�abc�cabcrx�typingr[�encodingr�excrrr0rr	�
TYPE_CHECKING�typing_extensions�te�TypeVar�Unionr"rrr
�Protocolrr$�Genericr&rrr�<module>r�s���"���� ���#���?�?�"��2�:�:��a�g�g�c�5�j�1�1�7�7�3��:�;N��L�
�1�9�9�^�1�7�7�3��:�3F�G�L�8�q�z�z�,�/�8�1�'�1�(�1�l6����<�(�l6r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists