Files
wg-backend-django/dell-env/lib/python3.11/site-packages/itsdangerous/__pycache__/serializer.cpython-311.pyc

132 lines
13 KiB
Plaintext
Raw Normal View History

2023-10-30 14:40:43 +07:00
<EFBFBD>
v]?e<>+<00><00><><00>ddlZddlZddlmZddlmZddlmZddlm Z ddlm
Z
ej e e fZejeZeje ejfZejeZeje
Zejej eejeefefZejeejfZej ejeefZdejd efd
<EFBFBD>ZGd <0B>d <0C><00>ZdS) <0A>N<>)<01>
want_bytes)<01>
BadPayload)<01> BadSignature)<01>_make_keys_list)<01>Signer<65>
serializer<EFBFBD>returnc<00>R<00>t|<00>i<00><00>t<00><00>S)z5Checks whether a serializer generates text or binary.)<03>
isinstance<EFBFBD>dumps<70>str)r s <20>p/home/infidel/Sync/TIP/WireGuard/ocp-wg-backend/dell-env/lib/python3.11/site-packages/itsdangerous/serializer.py<70>is_text_serializerrs <00><00> <15>j<EFBFBD>&<26>&<26>r<EFBFBD>*<2A>*<2A>C<EFBFBD> 0<> 0<>0<>c<00>d<00>eZdZUdZeZejed<e Z
e ed<gZ e ed< d#deded ejd
ed eje d ed eje fd<0E>Zedefd<10><04><00>Z d$ded ejejdejfd<12>Zdejdefd<14>Zd$dede fd<15>Zd$dedeje fd<16>Zd$dejdedefd<17>Zd$dejdejdeddfd<19>Z d$dededejdejfd<1C>Zd$dejdedejfd<1D>Z d$dedede!fd<1E>Z" d%dededed ede!f
d!<21>Z#d$dejdede!fd"<22>Z$dS)&<26>
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.
<20>default_serializer<65>default_signer<65>default_fallback_signers<72> itsdangerousN<73>
secret_key<EFBFBD>saltr <00>serializer_kwargs<67>signer<65> signer_kwargs<67>fallback_signersc<00>(<00>t|<01><00>|_|<02>t|<02><00>}||_|<03>|j}||_t |<03><00>|_|<05>|j}||_|pi|_ |<07>t|j pd<01><00>}||_ |pi|_ dS)N<>)r<00> secret_keysrrrr rrrr<00>listrrr)<08>selfrrr rrrrs r<00>__init__zSerializer.__init__Ys<><00><00>,;<3B>:<3A>+F<>+F<><04><18> <0F> <1B><1D>d<EFBFBD>#<23>#<23>D<EFBFBD><19><04> <09> <15> <1D><1D>0<>J<EFBFBD>",<2C><04><0F>(:<3A>:<3A>(F<>(F<><04><1F> <11>><3E><19>(<28>F<EFBFBD>!'<27><04> <0B>(5<>(;<3B><12><04><1A> <1B> #<23>#<23>D<EFBFBD>$A<>$G<>R<EFBFBD>H<>H<> <1C>.><3E><04><1D>,=<3D>,C<><12><04><1E><1E>rr
c<00><00>|jdS)z<>The newest (last) entry in the :attr:`secret_keys` list. This
is for compatibility from before key rotation support was added.
<20><><EFBFBD><EFBFBD><EFBFBD>)r )r"s rrzSerializer.secret_key<65>s<00><00>
<14><1F><02>#<23>#r<00>payloadc<00>
<00>|<02>|j}|j}nt|<02><00>} |r(|<02>|<01>d<02><00><00><00>S|<02>|<01><00>S#t$r}t d|<04><04><00>|<04>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.)<01>original_error)r r<00>loads<64>decode<64> Exceptionr)r"r&r <00>is_text<78>es r<00> load_payloadzSerializer.load_payload<61>s<><00><00> <16> <1D><1D><1F>J<EFBFBD><1A>-<2D>G<EFBFBD>G<EFBFBD>(<28><1A>4<>4<>G<EFBFBD>
<15><16> A<01>!<21>'<27>'<27><07><0E><0E>w<EFBFBD>(?<3F>(?<3F>@<40>@<40>@<40><1D>#<23>#<23>G<EFBFBD>,<2C>,<2C> ,<2C><><18> <15> <15> <15><1C>7<> <20><0E><0E><0E><15>  <15><><EFBFBD><EFBFBD><EFBFBD> <15><><EFBFBD>s<00>)A!<00> A!<00>!
B<03>+A=<03>=B<03>objc<00>L<00>t|jj|fi|j<00><01><01><00>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 r r)r"r0s r<00> dump_payloadzSerializer.dump_payload<61>s-<00><00>
<1A>/<2F>$<24>/<2F>/<2F><03>N<>N<>t<EFBFBD>7M<37>N<>N<>O<>O<>Orc<00>H<00>|<01>|j}|j|jfd|i|j<00><01>S)z<>Creates a new instance of the signer to be used. The default
implementation uses the :class:`.Signer` base class.
Nr)rrr r)r"rs r<00> make_signerzSerializer.make_signer<65>s5<00><00> <10><<3C><17>9<EFBFBD>D<EFBFBD><1A>t<EFBFBD>{<7B>4<EFBFBD>+<2B>M<>M<>$<24>M<>$<24>:L<>M<>M<>Mrc#<00>K<00>|<01>|j}|<00>|<01><00>V<00>|jD]Z}t|t<00><00>r
|}|j}n"t|t <00><00>r|\}}n|j}|jD]}||fd|i|<03><01>V<00><00><10>[dS)z<>Iterates over all signers to be tried for unsigning. Starts
with the configured signer, then constructs each signer
specified in ``fallback_signers``.
Nr) rr4rr <00>dictr<00>tuplerr )r"r<00>fallback<63>kwargsrs r<00>iter_unsignerszSerializer.iter_unsigners<72>s<><00><00><00><00>
<10><<3C><17>9<EFBFBD>D<EFBFBD><12><1E><1E>t<EFBFBD>$<24>$<24>$<24>$<24>$<24><1C>-<2D>
@<01>
@<01>H<EFBFBD><19>(<28>D<EFBFBD>)<29>)<29> ,<2C>!<21><06><1F>;<3B><08><08><1B>H<EFBFBD>e<EFBFBD>,<2C>,<2C> ,<2C>#+<2B> <20><08>&<26>&<26><1D>+<2B><06>"<22>.<2E> @<01> @<01>
<EFBFBD><1E>h<EFBFBD>z<EFBFBD>?<3F>?<3F><04>?<3F><06>?<3F>?<3F>?<3F>?<3F>?<3F>?<3F> @<01>
@<01>
@rc<00><><00>t|<00>|<01><00><00><00>}|<00>|<02><00><00>|<03><00>}|jr|<04>d<01><00>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()rr2r4<00>signrr+)r"r0rr&<00>rvs rr zSerializer.dumps<70>sb<00><00>
<1D>T<EFBFBD>.<2E>.<2E>s<EFBFBD>3<>3<>4<>4<><07> <11> <1D> <1D>d<EFBFBD> #<23> #<23> (<28> (<28><17> 1<> 1<><02> <0F> "<22> &<26><15>9<EFBFBD>9<EFBFBD>W<EFBFBD>%<25>%<25> %<25><11> r<00>fc<00>X<00>|<02>|<00>||<03><00><00><00>dS)z<>Like :meth:`dumps` but dumps into a file. The file handle has
to be compatible with what the internal serializer expects.
N)<02>writer )r"r0r>rs r<00>dumpzSerializer.dump<6D>s*<00><00>
<EFBFBD><07><07><04>
<EFBFBD>
<EFBFBD>3<EFBFBD><04>%<25>%<25>&<26>&<26>&<26>&<26>&r<00>sr9c <00><00>t|<01><00>}d}|<00>|<02><00>D]E} |<00>|<05>|<01><00><00><00>cS#t$r }|}Yd}~<06>>d}~wwxYwt jt|<04><00><00>)ziReverse of :meth:`dumps`. Raises :exc:`.BadSignature` if the
signature validation fails.
N)rr:r/<00>unsignr<00>_t<5F>cast)r"rBrr9<00>last_exceptionr<00>errs rr*zSerializer.loads<64>s<><00><00> <17>q<EFBFBD>M<EFBFBD>M<EFBFBD><01><1D><0E><1A>)<29>)<29>$<24>/<2F>/<2F> %<25> %<25>F<EFBFBD> %<25><1B>(<28>(<28><16><1D><1D>q<EFBFBD>)9<>)9<>:<3A>:<3A>:<3A>:<3A>:<3A><><1F> %<25> %<25> %<25>!$<24><0E><0E><0E><0E><0E><0E><><EFBFBD><EFBFBD><EFBFBD> %<25><><EFBFBD><EFBFBD><11>g<EFBFBD>l<EFBFBD>N<EFBFBD>3<>3<>3s<00>'A<02>
A*<05>A%<05>%A*c<00>R<00>|<00>|<01><00><00>|<02><00>S)z)Like :meth:`loads` but loads from a file.)r*<00>read<61>r"r>rs r<00>loadzSerializer.load<61>s<00><00><13>z<EFBFBD>z<EFBFBD>!<21>&<26>&<26>(<28>(<28>D<EFBFBD>)<29>)<29>)rc<00>.<00>|<00>||<02><00>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
)<01>_loads_unsafe_impl)r"rBrs r<00> loads_unsafezSerializer.loads_unsafe<66>s<00><00> <14>&<26>&<26>q<EFBFBD>$<24>/<2F>/<2F>/r<00> load_kwargs<67>load_payload_kwargsc<00><><00>|<03>i} d|j|fd|i|<03><01>fS#t$rF}|j<00>Yd}~dS|<04>i} d|j|jfi|<04><01>fcYd}~S#t$rYYd}~dSwxYwd}~wwxYw)zfLow level helper function to implement :meth:`loads_unsafe`
in serializer subclasses.
NTr)FNF)r*rr&r/r)r"rBrrPrQr.s rrNzSerializer._loads_unsafe_impls<><00><00> <17> <1E><1C>K<EFBFBD> #<23><17><1A><14><1A>A<EFBFBD>@<40>@<40>D<EFBFBD>@<40>K<EFBFBD>@<40>@<40>@<40> @<40><><1B> #<23> #<23> #<23><10>y<EFBFBD> <20>"<22>{<7B>{<7B>{<7B>{<7B>{<7B>"<22>*<2A>&(<28>#<23> #<23><19>%<25>D<EFBFBD>%<25>a<EFBFBD>i<EFBFBD>G<>G<>3F<33>G<>G<><12><12><12><12><12><12><12><><1E> #<23> #<23> #<23>"<22>{<7B>{<7B>{<7B>{<7B>{<7B>{<7B> #<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #<23><><EFBFBD>s<<00><00>
A(<03>A#<03>A#<03>A<02>A(<03>
A <05>A#<03>A <05> A#<03>#A(c<00>T<00>|<00>|<01><00><00>|<02><01><00>S)zYLike :meth:`loads_unsafe` but loads from a file.
.. versionadded:: 0.15
)r)rOrJrKs r<00> load_unsafezSerializer.load_unsafe"s%<00><00>
<14> <20> <20><11><16><16><18><18><04> <20>5<>5<>5r)rNNNNN)N)NN)%<25>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__<5F>jsonrrE<00>Any<6E>__annotations__rr<00> _t_signerr<00> _t_fallbacks<6B> _t_secret_key<65>_t_opt_str_bytes<65> _t_opt_kwargs<67>Optionalr#<00>property<74>bytesrr/r2r4<00>Iteratorr:<00> _t_str_bytesr <00>IOrAr*rL<00>_t_load_unsaferOrNrTrrrrrsz<00><00><00><00><00><00><00>1<08>1<08>l"&<26><16><02><06>%<25>%<25>%<25>!'<27>N<EFBFBD>I<EFBFBD>&<26>&<26>&<26>.0<EFBFBD><1C>l<EFBFBD>/<2F>/<2F>/<2F>
"1<>!<21>+/<2F>)-<2D>'+<2B>6:<3A>'D<01>'D<01>!<21>'D<01><1F>'D<01><17>F<EFBFBD> 'D<01>
)<29> 'D<01> <13> <0B>I<EFBFBD>&<26> 'D<01>%<25>'D<01><1D>+<2B>l<EFBFBD>3<>'D<01>'D<01>'D<01>'D<01>R<0E>$<24>E<EFBFBD>$<24>$<24>$<24><0E>X<EFBFBD>$<24>AE<01><15><15><1C><15>*,<2C>+<2B>b<EFBFBD>f<EFBFBD>*=<3D><15> <0B><16><15><15><15><15>6P<01><02><06>P<01>5<EFBFBD>P<01>P<01>P<01>P<01>N<01>N<01> 0<>N<01>F<EFBFBD>N<01>N<01>N<01>N<01>@<01>@<01>#3<>@<01>r<EFBFBD>{<7B>6<EFBFBD>?R<>@<01>@<01>@<01>@<01>, <12> <12><12><16> <12>'7<> <12><<3C> <12> <12> <12> <12>'<27>'<27><02><06>'<27>2<EFBFBD>5<EFBFBD>'<27>0@<40>'<27>D<EFBFBD>'<27>'<27>'<27>'<27>9=<3D>4<>4<><1D>4<>%5<>4<>HJ<48><06>4<> <0B><16>4<>4<>4<>4<>"*<2A>*<2A>b<EFBFBD>e<EFBFBD>*<2A>#3<>*<2A>r<EFBFBD>v<EFBFBD>*<2A>*<2A>*<2A>*<2A>
9=<3D>0<>0<><1D>0<>%5<>0<> <17>0<>0<>0<>0<>,&*<2A>-1<> #<23>#<23> <17>#<23><1F>#<23>#<23> #<23>
+<2B> #<23>
<18> #<23>#<23>#<23>#<23><6<>6<>R<EFBFBD>U<EFBFBD>6<>*:<3A>6<>n<EFBFBD>6<>6<>6<>6<>6<>6rr) rY<00>typingrE<00>encodingr<00>excrrrrr<00>Unionrrcrerar_<00>DictrZ<00> _t_kwargsr`<00>Typer\<00>List<73>Tupler]<00>boolrg<00>Iterabler^rrrrr<00><module>rssj<00><01> <0B> <0B> <0B> <0B><13><13><13><13> <20> <20> <20> <20> <20> <20><1B><1B><1B><1B><1B><1B><1D><1D><1D><1D><1D><1D>#<23>#<23>#<23>#<23>#<23>#<23><1A><1A><1A><1A><1A><1A><11>x<EFBFBD><03>U<EFBFBD>
<EFBFBD>#<23> <0C><15>;<3B>|<7C>,<2C><10> <0E>G<EFBFBD>C<EFBFBD><12><16>K<EFBFBD> <20> <09><12> <0B>I<EFBFBD>&<26> <0A> <0E>G<EFBFBD>F<EFBFBD>O<EFBFBD> <09><11>w<EFBFBD>r<EFBFBD>x<EFBFBD> <09>2<EFBFBD>8<EFBFBD>I<EFBFBD>y<EFBFBD>4H<34>+I<>9<EFBFBD> T<>U<>V<> <0C><13><18>$<24><02><06>,<2C>'<27><0E><12><08><12><1B>\<5C>2<>L<EFBFBD>@<40>A<> <0A>1<>2<EFBFBD>6<EFBFBD>1<>d<EFBFBD>1<>1<>1<>1<>
N6<>N6<>N6<>N6<>N6<>N6<>N6<>N6<>N6<>N6r