Files
loustique-home/venv/lib/python3.11/site-packages/itsdangerous/__pycache__/signer.cpython-311.pyc

99 lines
12 KiB
Plaintext
Raw Normal View History

2026-03-21 10:53:02 +01:00
<EFBFBD>
<00><><EFBFBD>i<EFBFBD>%<00><01><><00>ddlmZddlmZddlZddlZddlZddl m
Z
ddl m Z ddl m Z ddl m Z ddlmZGd <09>d
<EFBFBD><00>ZGd <0B>d e<10><00>Zddd<12>ZGd<13>de<10><00>Zdd<18>ZGd<19>d<1A><00>ZdS)<1E>)<01> annotationsN<73>)<01>_base64_alphabet)<01> base64_decode)<01> base64_encode<64><01>
want_bytes)<01> BadSignaturec<01>"<00>eZdZdZd d<06>Zd d <09>Zd
S) <0A>SigningAlgorithmzgSubclasses must implement :meth:`get_signature` to provide
signature generation functionality.
<20>key<65>bytes<65>value<75>returnc<01><00>t<00><00><00>)z2Returns the signature for the given key and value.)<01>NotImplementedError<6F><03>selfr rs <20>_/home/maxime/Documents/loustiques-home/venv/lib/python3.11/site-packages/itsdangerous/signer.py<70> get_signaturezSigningAlgorithm.get_signatures<00><00>!<21>#<23>#<23>#<23><00>sig<69>boolc<01>T<00>tj||<00>||<02><00><00><00>S)zMVerifies the given signature matches the expected
signature.
)<03>hmac<61>compare_digestr)rr rrs r<00>verify_signaturez!SigningAlgorithm.verify_signatures'<00><00><14>"<22>3<EFBFBD><04>(:<3A>(:<3A>3<EFBFBD><05>(F<>(F<>G<>G<>GrN<>r rrrrr)r rrrrrrr)<06>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__rr<00>rrr r sL<00><00><00><00><00><00><08><08>$<24>$<24>$<24>$<24>H<01>H<01>H<01>H<01>H<01>Hrr c<01><00>eZdZdZdd<06>ZdS) <09> NoneAlgorithmz`Provides an algorithm that does not perform any signing and
returns an empty signature.
r rrrc<01><00>dS)Nrr#rs rrzNoneAlgorithm.get_signature$s<00><00><12>srNr)rr r!r"rr#rrr%r%s2<00><00><00><00><00><00><08><08><13><13><13><13><13>rr%r<00>stringrr<00>t.Anyc<01>*<00>tj|<00><00>S)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.
)<02>hashlib<69>sha1)r's r<00>
_lazy_sha1r,(s<00><00>
<13><<3C><06> <1F> <1F>rc<01>F<00>eZdZUdZee<05><00>Zded<d d d<06>Zdd <0B>Z dS)<0F> HMACAlgorithmz*Provides signature generation using HMACs.r(<00>default_digest_methodN<64> digest_methodc<01>&<00>|<01>|j}||_dS<00>N)r/r0)rr0s r<00>__init__zHMACAlgorithm.__init__8s<00><00> <18> <20> <20>6<>M<EFBFBD>$1<><04><1A><1A>rr rrrc<01>b<00>tj|||j<00><01><00>}|<03><00><00>S)N)<02>msg<73> digestmod)r<00>newr0<00>digest)rr r<00>macs rrzHMACAlgorithm.get_signature>s)<00><00><12>h<EFBFBD>s<EFBFBD><05><14>1C<31>D<>D<>D<><03><12>z<EFBFBD>z<EFBFBD>|<7C>|<7C>rr2)r0r(r)
rr r!r"<00> staticmethodr,r/<00>__annotations__r3rr#rrr.r.0sg<00><00><00><00><00><00><00>4<>4<>
$0<><<3C>
<EFBFBD>#;<3B>#;<3B><19>;<3B>;<3B>;<3B>;<3B>2<>2<>2<>2<>2<> <1C><1C><1C><1C><1C>rr.<00>
secret_key<EFBFBD>7str | bytes | cabc.Iterable[str] | cabc.Iterable[bytes]<5D> list[bytes]c<01>r<00>t|ttf<02><00>rt|<00><00>gSd<01>|D<00><00>S)Nc<01>,<00>g|]}t|<01><00><00><02>Sr#r)<02>.0<EFBFBD>ss r<00>
<listcomp>z#_make_keys_list.<locals>.<listcomp>Is<00><00> .<2E> .<2E> .<2E>a<EFBFBD>J<EFBFBD>q<EFBFBD>M<EFBFBD>M<EFBFBD> .<2E> .<2E> .r)<04>
isinstance<EFBFBD>strrr )r<s r<00>_make_keys_listrFCs?<00><00><12>*<2A>s<EFBFBD>E<EFBFBD>l<EFBFBD>+<2B>+<2B>(<28><1A>:<3A>&<26>&<26>'<27>'<27> .<2E> .<2E>:<3A> .<2E> .<2E> .<2E>.rc<01><><00>eZdZUdZee<05><00>Zded<dZded< d$d%d<16>Z e
d&d<19><04><00>Z d'd(d<1A>Z d)d<1C>Z d)d<1D>Zd*d <20>Zd+d"<22>Zd,d#<23>Zd S)-<2D>Signera<72>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.
r(r/<00> django-concatrE<00>default_key_derivation<6F>itsdangerous.Signer<65>.Nr<r=<00>salt<6C>str | bytes | None<6E>sep<65> str | bytes<65>key_derivation<6F>
str | Noner0<00> t.Any | None<6E> algorithm<68>SigningAlgorithm | Nonec<01>@<00>t|<01><00>|_t|<03><00>|_|jtvrt d<01><00><00>|<02>t|<02><00>}nd}||_|<04>|j}||_|<05>|j }||_
|<06>t|j
<00><00>}||_ dS)Nz<4E>The given separator cannot be used because it may be contained in the signature itself. ASCII letters, digits, and '-_=' must not be used.rK) rF<00> secret_keysr rOr<00>
ValueErrorrMrJrQr/r0r.rT)rr<rMrOrQr0rTs rr3zSigner.__init__<5F>s<><00><00>)8<>
<EFBFBD>(C<>(C<><04><18>$<24>S<EFBFBD>/<2F>/<2F><04><08> <0F>8<EFBFBD>'<27> '<27> '<27><1C>7<><0E><0E> <0E> <10> <1B><1D>d<EFBFBD>#<23>#<23>D<EFBFBD>D<EFBFBD>)<29>D<EFBFBD><18><04> <09> <19> !<21>!<21>8<>N<EFBFBD>#1<><04><1B> <18> <20> <20>6<>M<EFBFBD>$1<><04><1A> <14> <1C>%<25>d<EFBFBD>&8<>9<>9<>I<EFBFBD>+4<><04><0E><0E>rrrc<01><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>)rW)rs rr<zSigner.secret_key<65>s<00><00>
<14><1F><02>#<23>#rc<01>n<00>|<01>|jd}nt|<01><00>}|jdkrGtjt
|<00>|j|z<00><00><00><00><00><00><00>S|jdkrJtjt
|<00>|jdz|z<00><00><00><00><00><00><00>S|jdkrItj
||j<00><07><00>}|<02> |j<00><00>|<02><00><00>S|jdkr|Std <09><00><00>)
a<EFBFBD>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.
NrZ<00>concatrIssignerr)r6<00>nonezUnknown key derivation method) rWr rQ<00>t<>castrr0rMr8rr7<00>update<74> TypeError)rr<r9s r<00>
derive_keyzSigner.derive_key<65>s <00><00> <16> <1D><1D>)<29>"<22>-<2D>J<EFBFBD>J<EFBFBD>#<23>J<EFBFBD>/<2F>/<2F>J<EFBFBD> <0F> <1E>(<28> *<2A> *<2A><14>6<EFBFBD>%<25><14>!3<>!3<>D<EFBFBD>I<EFBFBD>
<EFBFBD>4J<EFBFBD>!K<>!K<>!R<>!R<>!T<>!T<>U<>U<> U<> <11> <20>O<EFBFBD> 3<> 3<><14>6<EFBFBD><15>t<EFBFBD>)<29>)<29>$<24>)<29>i<EFBFBD>*?<3F>*<2A>*L<>M<>M<>T<>T<>V<>V<><0E><0E> <0E><12> <20>F<EFBFBD> *<2A> *<2A><16>(<28>:<3A><14>1C<31>D<>D<>D<>C<EFBFBD> <0F>J<EFBFBD>J<EFBFBD>t<EFBFBD>y<EFBFBD> !<21> !<21> !<21><16>:<3A>:<3A><<3C><<3C> <1F> <11> <20>F<EFBFBD> *<2A> *<2A><1D> <1D><1B>;<3B><<3C><<3C> <rrc<01><><00>t|<01><00>}|<00><00><00>}|j<00>||<01><00>}t |<03><00>S)z*Returns the signature for the given value.)r rbrTrr)rrr rs rrzSigner.get_signature<72>sC<00><00><1A>5<EFBFBD>!<21>!<21><05><12>o<EFBFBD>o<EFBFBD><1F><1F><03><12>n<EFBFBD>*<2A>*<2A>3<EFBFBD><05>6<>6<><03><1C>S<EFBFBD>!<21>!<21>!rc<01>`<00>t|<01><00>}||jz|<00>|<01><00>zS)zSigns the given string.)r rOr)rrs r<00>signz Signer.sign<67>s/<00><00><1A>5<EFBFBD>!<21>!<21><05><14>t<EFBFBD>x<EFBFBD><1F>$<24>"4<>"4<>U<EFBFBD>";<3B>";<3B>;<3B>;rrrc<01><><00> t|<02><00>}n#t$rYdSwxYwt|<01><00>}t|j<00><00>D]6}|<00>|<03><00>}|j<00>|||<02><00>rdS<00>7dS)z+Verifies the signature for the given value.FT)r<00> Exceptionr <00>reversedrWrbrTr)rrrr<r s rrzSigner.verify_signature<72>s<><00><00> <19><1F><03>$<24>$<24>C<EFBFBD>C<EFBFBD><43><18> <19> <19> <19><18>5<EFBFBD>5<EFBFBD> <19><><EFBFBD><EFBFBD><1B>5<EFBFBD>!<21>!<21><05>"<22>4<EFBFBD>#3<>4<>4<> <1C> <1C>J<EFBFBD><16>/<2F>/<2F>*<2A>-<2D>-<2D>C<EFBFBD><13>~<7E>.<2E>.<2E>s<EFBFBD>E<EFBFBD>3<EFBFBD>?<3F>?<3F> <1C><1B>t<EFBFBD>t<EFBFBD> <1C><15>us <00><00>
<03> <03> signed_valuec<01><><00>t|<01><00>}|j|vrtd|j<00>d<02><03><00><00>|<01>|jd<03><00>\}}|<00>||<03><00>r|Std|<03>d<05>|<02><06><00><00>)zUnsigns the given string.zNo z found in valuerz
Signature z does not match)<01>payload)r rOr
<00>rsplitr)rrirrs r<00>unsignz Signer.unsign<67>s<><00><00>!<21>,<2C>/<2F>/<2F> <0C> <0F>8<EFBFBD><<3C> '<27> '<27><1E>@<40>T<EFBFBD>X<EFBFBD>@<40>@<40>@<40>A<>A<> A<>!<21>(<28>(<28><14><18>1<EFBFBD>5<>5<>
<EFBFBD><05>s<EFBFBD> <0F> <20> <20><15><03> ,<2C> ,<2C> <19><18>L<EFBFBD><1A>><3E><03>><3E>><3E>><3E><05>N<>N<>N<>Nrc<01>T<00> |<00>|<01><00>dS#t$rYdSwxYw)znOnly validates the given signed value. Returns ``True`` if
the signature exists and is valid.
TF)rmr
)rris r<00>validatezSigner.validates@<00><00> <19> <10>K<EFBFBD>K<EFBFBD> <0C> %<25> %<25> %<25><17>4<EFBFBD><34><1B> <19> <19> <19><18>5<EFBFBD>5<EFBFBD> <19><><EFBFBD>s <00><00>
'<03>')rKrLNNN) r<r=rMrNrOrPrQrRr0rSrTrU)rrr2)r<rNrr)rrPrr)rrPrrPrr)rirPrr)rirPrr)rr r!r"r:r,r/r;rJr3<00>propertyr<rbrrerrmror#rrrHrHLs <00><00><00><00><00><00><00>#<08>#<08>V$0<><<3C>
<EFBFBD>#;<3B>#;<3B><19>;<3B>;<3B>;<3B>;<3B>#2<><1A>1<>1<>1<>1<>
$:<3A><1F>%)<29>&*<2A>-1<>,5<>,5<>,5<>,5<>,5<>\<0E>$<24>$<24>$<24><0E>X<EFBFBD>$<24> =<3D>=<3D>=<3D>=<3D>=<3D>B"<22>"<22>"<22>"<22><<3C><<3C><<3C><<3C>
<15><15><15><15>" O<01> O<01> O<01> O<01><19><19><19><19><19>rrH)r)r'rrr()r<r=rr>)<16>
__future__r<00>collections.abc<62>abc<62>cabcr*r<00>typingr^<00>encodingrrrr <00>excr
r r%r,r.rFrHr#rr<00><module>rxs<><00><01>"<22>"<22>"<22>"<22>"<22>"<22><1E><1E><1E><1E><1E><1E><0E><0E><0E><0E> <0B> <0B> <0B> <0B><12><12><12><12>&<26>&<26>&<26>&<26>&<26>&<26>#<23>#<23>#<23>#<23>#<23>#<23>#<23>#<23>#<23>#<23>#<23>#<23> <20> <20> <20> <20> <20> <20><1D><1D><1D><1D><1D><1D> H<01> H<01> H<01> H<01> H<01> H<01> H<01> H<01> <13><13><13><13><13>$<24><13><13><13> <20> <20> <20> <20> <20><1C><1C><1C><1C><1C>$<24><1C><1C><1C>&/<2F>/<2F>/<2F>/<2F>~<19>~<19>~<19>~<19>~<19>~<19>~<19>~<19>~<19>~r