ó
    &ÝNj§7  ã            
       ó(  • % S SK Jr  S SKJr  S SKJrJr  S SKJ	r	  SS/r
\R                  " 5       r\\S'   \R                  " 5       r\\S'   \R"                  " 5       r\\S	'   \R&                  " 5       r\\S
'   \R*                  " 5       r\\S'   \R.                  " 5       r\\S'   \R2                  " 5       r\\S'   \R6                  " 5       r\\S'   \R:                  " 5       r\\S'   S\\\4   4S jr S\S\\\4   4S jr!S\S\S\S\S\4
S jr"S\S\S\S\S\4
S jr#S\S\S\4S jr$S\S\S\S\4S jr%S\S\S\S\4S jr&S\S\S\S\S\4
S jr'S\S\S\S\S\4
S  jr(S\S\S\S\4S! jr)S\S\S\S\4S" jr*S\S\S\4S# jr+S\S\S\S\4S$ jr,g%)&é    )ÚTuple)Ú
exceptions)ÚffiÚlib)ÚensureÚcrypto_box_keypairÚ
crypto_boxÚcrypto_box_SECRETKEYBYTESÚcrypto_box_PUBLICKEYBYTESÚcrypto_box_SEEDBYTESÚcrypto_box_NONCEBYTESÚcrypto_box_ZEROBYTESÚcrypto_box_BOXZEROBYTESÚcrypto_box_BEFORENMBYTESÚcrypto_box_SEALBYTESÚcrypto_box_MACBYTESÚreturnc                  óJ  • [         R                  " S[        5      n [         R                  " S[        5      n[        R
                  " X5      n[        US:H  S[        R                  S9  [         R                  " U [        5      SS [         R                  " U[        5      SS 4$ )ze
Returns a randomly generated public and secret key.

:rtype: (bytes(public_key), bytes(secret_key))
úunsigned char[]r   úUnexpected library error©ÚraisingN)
r   Únewr   r
   r   r   r   ÚexcÚRuntimeErrorÚbuffer)ÚpkÚskÚrcs      ÚU/home/mande/repo/quber/.venv/lib/python3.13/site-packages/nacl/bindings/crypto_box.pyr   r   #   sƒ   € ô 
�ŠÐ"Ô$=Ó	>€BÜ	�ŠÐ"Ô$=Ó	>€Bä	×	Ò	 Ó	'€BÜ
ˆ2�‰7Ð.¼×8HÑ8HÒIô 	�
Š
�2Ô0Ó1±!Ð4Ü�
Š
�2Ô0Ó1±!Ð4ðð ó    Úseedc                 óØ  • [        [        U [        5      S[        S9  [	        U 5      [
        :w  a  [        R                  " S5      e[        R                  " S[        5      n[        R                  " S[        5      n[        R                  " XU 5      n[        US:H  S[        R                  S9  [        R                  " U[        5      SS [        R                  " U[        5      SS 4$ )aí  
Returns a (public, secret) key pair deterministically generated
from an input ``seed``.

.. warning:: The seed **must** be high-entropy; therefore,
    its generator **must** be a cryptographic quality
    random function like, for example, :func:`~nacl.utils.random`.

.. warning:: The seed **must** be protected and remain secret.
    Anyone who knows the seed is really in possession of
    the corresponding PrivateKey.


:param seed: bytes
:rtype: (bytes(public_key), bytes(secret_key))
zseed must be bytesr   zInvalid seedr   r   r   N)r   Ú
isinstanceÚbytesÚ	TypeErrorÚlenr   r   Ú
ValueErrorr   r   r   r
   r   Úcrypto_box_seed_keypairr   r   )r"   r   r   r   s       r    r)   r)   5   sµ   € ô" Œ:�dœEÓ"Ð$8Ä)ÒLä
ˆ4ƒyÔ(Ó(Ü�nŠn˜^Ó,Ð,ä	�ŠÐ"Ô$=Ó	>€BÜ	�ŠÐ"Ô$=Ó	>€Bä	×	$Ò	$ R¨TÓ	2€BÜ
ˆ2�‰7Ð.¼×8HÑ8HÒIô 	�
Š
�2Ô0Ó1±!Ð4Ü�
Š
�2Ô0Ó1±!Ð4ðð r!   ÚmessageÚnoncer   r   c                 ó  • [        U5      [        :w  a  [        R                  " S5      e[        U5      [        :w  a  [        R                  " S5      e[        U5      [
        :w  a  [        R                  " S5      eS[        -  U -   n[        R                  " S[        U5      5      n[        R                  " XT[        U5      XU5      n[        US:H  S[        R                  S9  [        R                  " U[        U5      5      [        S	 $ )
úÐ
Encrypts and returns a message ``message`` using the secret key ``sk``,
public key ``pk``, and the nonce ``nonce``.

:param message: bytes
:param nonce: bytes
:param pk: bytes
:param sk: bytes
:rtype: bytes
úInvalid nonce sizeúInvalid public keyúInvalid secret keyó    r   r   r   r   N)r'   r   r   r(   r   r
   r   r   r   r   r	   r   r   r   r   )r*   r+   r   r   ÚpaddedÚ
ciphertextr   s          r    r	   r	   W   sÍ   € ô ˆ5ƒzÔ*Ó*Ü�nŠnÐ1Ó2Ð2ä
ˆ2ƒwÔ+Ó+Ü�nŠnÐ1Ó2Ð2ä
ˆ2ƒwÔ+Ó+Ü�nŠnÐ1Ó2Ð2àÔ,Ñ,°Ñ7€FÜ—’Ð*¬C°«KÓ8€Jä	�Š˜
¬C°«K¸ÀBÓ	G€BÜ
ˆ2�‰7Ð.¼×8HÑ8HÒIä�:Š:�j¤# f£+Ó.Ô/FÐ/GÐHÐHr!   r3   c                 ó  • [        U5      [        :w  a  [        R                  " S5      e[        U5      [        :w  a  [        R                  " S5      e[        U5      [
        :w  a  [        R                  " S5      eS[        -  U -   n[        R                  " S[        U5      5      n[        R                  " XT[        U5      XU5      n[        US:H  S[        R                  S9  [        R                  " U[        U5      5      [        S	 $ )
úâ
Decrypts and returns an encrypted message ``ciphertext``, using the secret
key ``sk``, public key ``pk``, and the nonce ``nonce``.

:param ciphertext: bytes
:param nonce: bytes
:param pk: bytes
:param sk: bytes
:rtype: bytes
r.   r/   r0   r1   r   r   ú/An error occurred trying to decrypt the messager   N)r'   r   r   r(   r   r
   r   r   r   r   Úcrypto_box_openr   ÚCryptoErrorr   r   )r3   r+   r   r   r2   Ú	plaintextÚress          r    r7   r7   t   sÓ   € ô ˆ5ƒzÔ*Ó*Ü�nŠnÐ1Ó2Ð2ä
ˆ2ƒwÔ+Ó+Ü�nŠnÐ1Ó2Ð2ä
ˆ2ƒwÔ+Ó+Ü�nŠnÐ1Ó2Ð2àÔ/Ñ/°:Ñ=€FÜ—’Ð)¬3¨v«;Ó7€Iä
×
Ò
˜i´°V³¸eÈÓ
L€CÜ
Øˆq‰Ø9Ü—‘òô �:Š:�i¤ V£Ó-Ô.BÐ.CÐDÐDr!   c                 ó~  • [        U 5      [        :w  a  [        R                  " S5      e[        U5      [        :w  a  [        R                  " S5      e[
        R                  " S[        5      n[        R                  " X U5      n[        US:H  S[        R                  S9  [
        R                  " U[        5      SS $ )zò
Computes and returns the shared key for the public key ``pk`` and the
secret key ``sk``. This can be used to speed up operations where the same
set of keys is going to be used multiple times.

:param pk: bytes
:param sk: bytes
:rtype: bytes
r/   r0   r   r   r   r   N)r'   r   r   r(   r
   r   r   r   r   Úcrypto_box_beforenmr   r   r   )r   r   Úkr   s       r    r<   r<   —   s�   € ô ˆ2ƒwÔ+Ó+Ü�nŠnÐ1Ó2Ð2ä
ˆ2ƒwÔ+Ó+Ü�nŠnÐ1Ó2Ð2ä�ŠÐ!Ô#;Ó<€Aä	×	 Ò	  ¨Ó	+€BÜ
ˆ2�‰7Ð.¼×8HÑ8HÒIä�:Š:�aÔ1Ó2±1Ð5Ð5r!   r=   c                 óÆ  • [        U5      [        :w  a  [        R                  " S5      e[        U5      [        :w  a  [        R                  " S5      eS[
        -  U -   n[        R                  " S[        U5      5      n[        R                  " XC[        U5      X5      n[        US:H  S[        R                  S9  [        R                  " U[        U5      5      [        S $ )	ú«
Encrypts and returns the message ``message`` using the shared key ``k`` and
the nonce ``nonce``.

:param message: bytes
:param nonce: bytes
:param k: bytes
:rtype: bytes
úInvalid nonceúInvalid shared keyr1   r   r   r   r   N)r'   r   r   r(   r   r   r   r   r   Úcrypto_box_afternmr   r   r   r   )r*   r+   r=   r2   r3   r   s         r    rB   rB   ¯   s¯   € ô ˆ5ƒzÔ*Ó*Ü�nŠn˜_Ó-Ð-ä
ˆ1ƒvÔ)Ó)Ü�nŠnÐ1Ó2Ð2àÔ+Ñ+¨gÑ5€FÜ—’Ð*¬C°«KÓ8€Jä	×	Ò	 
´C¸³KÀÓ	J€BÜ
ˆ2�‰7Ð.¼×8HÑ8HÒIä�:Š:�j¤# f£+Ó.Ô/FÐ/GÐHÐHr!   c                 óÆ  • [        U5      [        :w  a  [        R                  " S5      e[        U5      [        :w  a  [        R                  " S5      eS[
        -  U -   n[        R                  " S[        U5      5      n[        R                  " XC[        U5      X5      n[        US:H  S[        R                  S9  [        R                  " U[        U5      5      [        S $ )	ú¼
Decrypts and returns the encrypted message ``ciphertext``, using the shared
key ``k`` and the nonce ``nonce``.

:param ciphertext: bytes
:param nonce: bytes
:param k: bytes
:rtype: bytes
r@   rA   r1   r   r   r6   r   N)r'   r   r   r(   r   r   r   r   r   Úcrypto_box_open_afternmr   r8   r   r   )r3   r+   r=   r2   r9   r:   s         r    rE   rE   È   s³   € ô ˆ5ƒzÔ*Ó*Ü�nŠn˜_Ó-Ð-ä
ˆ1ƒvÔ)Ó)Ü�nŠnÐ1Ó2Ð2àÔ/Ñ/°:Ñ=€FÜ—’Ð)¬3¨v«;Ó7€Iä
×
%Ò
% i¼¸V»ÀeÓ
O€CÜ
Øˆq‰Ø9Ü—‘òô �:Š:�i¤ V£Ó-Ô.BÐ.CÐDÐDr!   c                 óè  • [        U5      [        :w  a  [        R                  " S5      e[        U5      [        :w  a  [        R                  " S5      e[        U5      [
        :w  a  [        R                  " S5      e[        U 5      n[        U-   n[        R                  " SU5      n[        R                  " X`XAX#5      n[        US:H  S[        R                  S9  [        R                  " Xe5      SS $ )	r-   r.   r/   r0   r   r   r   r   N)r'   r   r   r(   r   r
   r   r   r   r   Úcrypto_box_easyr   r   r   )r*   r+   r   r   Ú_mlenÚ_clenr3   r   s           r    rG   rG   ç   s¾   € ô ˆ5ƒzÔ*Ó*Ü�nŠnÐ1Ó2Ð2ä
ˆ2ƒwÔ+Ó+Ü�nŠnÐ1Ó2Ð2ä
ˆ2ƒwÔ+Ó+Ü�nŠnÐ1Ó2Ð2ä�‹L€EÜ %Ñ'€Eä—’Ð*¨EÓ2€Jä	×	Ò	˜Z°%ÀÓ	G€BÜ
ˆ2�‰7Ð.¼×8HÑ8HÒIä�:Š:�jÓ(©Ð+Ð+r!   c                 ób  • [        U5      [        :w  a  [        R                  " S5      e[        U5      [        :w  a  [        R                  " S5      e[        U5      [
        :w  a  [        R                  " S5      e[        U 5      n[        U[        :¬  SR                  [        5      [        R                  S9  U[        -
  n[        R                  " S[        SU5      5      n[        R                  " X`XAX#5      n[        US:H  S	[        R                  S9  [        R                   " Xe5      S
S
 $ )r5   r.   r/   r0   ú)Input ciphertext must be at least {} longr   r   é   r   r6   N)r'   r   r   r(   r   r
   r   r   Úformatr&   r   r   Úmaxr   Úcrypto_box_open_easyr8   r   )r3   r+   r   r   rI   rH   r9   r:   s           r    rO   rO     sö   € ô ˆ5ƒzÔ*Ó*Ü�nŠnÐ1Ó2Ð2ä
ˆ2ƒwÔ+Ó+Ü�nŠnÐ1Ó2Ð2ä
ˆ2ƒwÔ+Ó+Ü�nŠnÐ1Ó2Ð2ä�
‹O€Eä
ØÔ$Ñ$Ø3×:Ñ:Üó	
ô —‘òð Ô'Ñ'€Eä—’Ð)¬3¨q°%«=Ó9€Iä
×
"Ò
" 9¸%ÈÓ
O€CÜ
Øˆq‰Ø9Ü—‘òô �:Š:�iÓ'©Ð*Ð*r!   c                 ó–  • [        U5      [        :w  a  [        R                  " S5      e[        U5      [        :w  a  [        R                  " S5      e[        U 5      n[
        U-   n[        R                  " SU5      n[        R                  " XPX1U5      n[        US:H  S[        R                  S9  [        R                  " XT5      SS $ )r?   r@   rA   r   r   r   r   N)r'   r   r   r(   r   r   r   r   r   Úcrypto_box_easy_afternmr   r   r   )r*   r+   r=   rH   rI   r3   r   s          r    rQ   rQ   6  s    € ô ˆ5ƒzÔ*Ó*Ü�nŠn˜_Ó-Ð-ä
ˆ1ƒvÔ)Ó)Ü�nŠnÐ1Ó2Ð2ä�‹L€EÜ %Ñ'€Eä—’Ð*¨EÓ2€Jä	×	$Ò	$ Z¸%ÈÓ	J€BÜ
ˆ2�‰7Ð.¼×8HÑ8HÒIä�:Š:�jÓ(©Ð+Ð+r!   c                 ó  • [        U5      [        :w  a  [        R                  " S5      e[        U5      [        :w  a  [        R                  " S5      e[        U 5      n[        U[        :¬  SR                  [        5      [        R                  S9  U[        -
  n[        R                  " S[        SU5      5      n[        R                  " XPX1U5      n[        US:H  S[        R                  S9  [        R                  " XT5      S	S	 $ )
rD   r@   rA   rK   r   r   rL   r   r6   N)r'   r   r   r(   r   r   r   rM   r&   r   r   rN   r   Úcrypto_box_open_easy_afternmr8   r   )r3   r+   r=   rI   rH   r9   r:   s          r    rS   rS   Q  sÝ   € ô ˆ5ƒzÔ*Ó*Ü�nŠn˜_Ó-Ð-ä
ˆ1ƒvÔ)Ó)Ü�nŠnÐ1Ó2Ð2ä�
‹O€Eä
ØÔ$Ñ$Ø3×:Ñ:Üó	
ô —‘òð Ô'Ñ'€Eä—’Ð)¬3¨q°%«=Ó9€Iä
×
*Ò
*Ø˜u¨Qó€Cô Øˆq‰Ø9Ü—‘òô �:Š:�iÓ'©Ð*Ð*r!   c                 ó¶  • [        [        U [        5      S[        S9  [        [        U[        5      S[        S9  [	        U5      [
        :w  a  [        R                  " S5      e[	        U 5      n[        U-   n[        R                  " SU5      n[        R                  " X@X!5      n[        US:H  S[        R                  S9  [        R                  " XC5      SS $ )	aX  
Encrypts and returns a message ``message`` using an ephemeral secret key
and the public key ``pk``.
The ephemeral public key, which is embedded in the sealed box, is also
used, in combination with ``pk``, to derive the nonce needed for the
underlying box construct.

:param message: bytes
:param pk: bytes
:rtype: bytes

.. versionadded:: 1.2
zinput message must be bytesr   úpublic key must be bytesr/   r   r   r   N)r   r$   r%   r&   r'   r   r   r(   r   r   r   r   Úcrypto_box_sealr   r   )r*   r   rH   rI   r3   r   s         r    rV   rV   }  sµ   € ô Ü�7œEÓ"Ø%Üòô Ü�2”uÓÐ9Ä9òô ˆ2ƒwÔ+Ó+Ü�nŠnÐ1Ó2Ð2ä�‹L€EÜ  5Ñ(€Eä—’Ð*¨EÓ2€Jä	×	Ò	˜Z°%Ó	<€BÜ
ˆ2�‰7Ð.¼×8HÑ8HÒIä�:Š:�jÓ(©Ð+Ð+r!   c                 ó¾  • [        [        U [        5      S[        S9  [        [        U[        5      S[        S9  [        [        U[        5      S[        S9  [	        U5      [
        :w  a  [        R                  " S5      e[	        U5      [        :w  a  [        R                  " S5      e[	        U 5      n[        U[        :¬  SR                  [        5      [        R                  S9  U[        -
  n[        R                  " S[        S	U5      5      n[        R                  " XPX1U5      n[        US
:H  S[        R                   S9  [        R"                  " XT5      SS $ )al  
Decrypts and returns an encrypted message ``ciphertext``, using the
recipent's secret key ``sk`` and the sender's ephemeral public key
embedded in the sealed box. The box construct nonce is derived from
the recipient's public key ``pk`` and the sender's public key.

:param ciphertext: bytes
:param pk: bytes
:param sk: bytes
:rtype: bytes

.. versionadded:: 1.2
zinput ciphertext must be bytesr   rU   zsecret key must be bytesr/   r0   rK   r   rL   r   r6   N)r   r$   r%   r&   r'   r   r   r(   r
   r   rM   r   r   rN   r   Úcrypto_box_seal_openr8   r   )r3   r   r   rI   rH   r9   r:   s          r    rX   rX   £  s'  € ô Ü�:œuÓ%Ø(Üòô Ü�2”uÓÐ9Ä9òô Ü�2”uÓÐ9Ä9òô ˆ2ƒwÔ+Ó+Ü�nŠnÐ1Ó2Ð2ä
ˆ2ƒwÔ+Ó+Ü�nŠnÐ1Ó2Ð2ä�
‹O€Eä
ØÔ%Ñ%Ø	4×<Ñ<Ü ó	
ô —‘òð Ô(Ñ(€Eô —’Ð)¬3¨q°%«=Ó9€Iä
×
"Ò
" 9¸%ÀRÓ
H€CÜ
Øˆq‰Ø9Ü—‘òô �:Š:�iÓ'©Ð*Ð*r!   N)-Útypingr   Únaclr   r   Únacl._sodiumr   r   Únacl.exceptionsr   Ú__all__Úcrypto_box_secretkeybytesr
   ÚintÚ__annotations__Úcrypto_box_publickeybytesr   Úcrypto_box_seedbytesr   Úcrypto_box_noncebytesr   Úcrypto_box_zerobytesr   Úcrypto_box_boxzerobytesr   Úcrypto_box_beforenmbytesr   Úcrypto_box_sealbytesr   Úcrypto_box_macbytesr   r%   r   r)   r	   r7   r<   rB   rE   rG   rO   rQ   rS   rV   rX   © r!   r    Ú<module>rj      s²  ðö å "ß !Ý "ð   Ð
.€ð "%×!>Ò!>Ó!@Ð ˜3Ó @Ø!$×!>Ò!>Ó!@Ð ˜3Ó @Ø×4Ò4Ó6Ð �cÓ 6Ø ×6Ò6Ó8Ð �sÓ 8Ø×4Ò4Ó6Ð �cÓ 6Ø"×:Ò:Ó<Ð ˜Ó <Ø #× <Ò <Ó >Ð ˜#Ó >Ø×4Ò4Ó6Ð �cÓ 6Ø×2Ò2Ó4Ð �SÓ 4ð˜E %¨ ,Ñ/ô ð$ %ð ¨E°%¸°,Ñ,?ô ðDI˜ð I eð I°ð I¸Eð IÀeô Ið: EØð EØ#ð EØ).ð EØ49ð Eà
ô EðF6˜Eð 6 uð 6°ô 6ð0I ð I¨eð I¸ð IÀ%ô Ið2EØðEØ#ðEØ(-ðEà
ôEð>,Øð,Ø ð,Ø&+ð,Ø16ð,à
ô,ðB++Øð++Ø#ð++Ø).ð++Ø49ð++à
ô++ð\, Uð ,°5ð ,¸Uð ,Àuô ,ð6)+Øð)+Ø#ð)+Ø(-ð)+à
ô)+ðX#,˜Uð #,¨ð #,°%ô #,ðL8+ Uð 8+°ð 8+¸5ð 8+ÀUõ 8+r!   