Ë
    zñ�j¨9  ã                   ó@  — d dl mZmZmZmZmZ d dlZd dlmZ d dlm	Z
 d dlmZ d dlmZmZmZ  G d„ dej"                  e«      Z G d	„ d
ej"                  e«      Z edd¬«      Z G d„ dej"                  e«      Z edee«      Z G d„ dee   ej"                  e«      Zy)é    )ÚClassVarÚGenericÚOptionalÚTypeÚTypeVarN)Úencoding)Ú
exceptions)ÚEncoder)ÚEncryptedMessageÚStringFixerÚrandomc                   óÂ   — e Zd ZU dZej
                  j                  Zee	   e
d<   ej                  fdedej                  fd„Zdefd„Zde	fd„Zd	edefd
„Zd	edefd„Zy)Ú	PublicKeya=  
    The public key counterpart to an Curve25519 :class:`nacl.public.PrivateKey`
    for encrypting messages.

    :param public_key: [:class:`bytes`] Encoded Curve25519 public key
    :param encoder: A class that is able to decode the `public_key`

    :cvar SIZE: The size that the public key is required to be
    ÚSIZEÚ
public_keyÚencoderc                 ó.  — |j                  |«      | _        t        | j                  t        «      st	        j
                  d«      ‚t        | j                  «      | j                  k7  r.t	        j                  dj                  | j                  «      «      ‚y )Nz'PublicKey must be created from 32 bytesz,The public key must be exactly {} bytes long)
ÚdecodeÚ_public_keyÚ
isinstanceÚbytesÚexcÚ	TypeErrorÚlenr   Ú
ValueErrorÚformat)Úselfr   r   s      úL/var/www/api.ozpay.ru/ozpay/venv/lib/python3.12/site-packages/nacl/public.pyÚ__init__zPublicKey.__init__$   sw   € ð
 #Ÿ>™>¨*Ó5ˆÔÜ˜$×*Ñ*¬EÔ2Ü—-‘-Ð IÓJÐJäˆt×ÑÓ  D§I¡IÒ-Ü—.‘.Ø>×EÑEØ—I‘Ióóð ð .ó    Úreturnc                 ó   — | j                   S ©N©r   ©r   s    r   Ú	__bytes__zPublicKey.__bytes__4   ó   € Ø×ÑÐr    c                 ó*   — t        t        | «      «      S r#   )Úhashr   r%   s    r   Ú__hash__zPublicKey.__hash__7   s   € Ü”E˜$“KÓ Ð r    Úotherc                 ó”   — t        || j                  «      syt        j                  j	                  t        | «      t        |«      «      S ©NF)r   Ú	__class__ÚnaclÚbindingsÚsodium_memcmpr   ©r   r+   s     r   Ú__eq__zPublicKey.__eq__:   s2   € Ü˜% §¡Ô0ØÜ�}‰}×*Ñ*¬5°«;¼¸e»ÓEÐEr    c                 ó   — | |k(   S r#   © r2   s     r   Ú__ne__zPublicKey.__ne__?   ó   € Ø˜E‘MÐ"Ð"r    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r/   r0   Úcrypto_box_PUBLICKEYBYTESr   r   ÚintÚ__annotations__r   Ú
RawEncoderr   r
   r   r&   r*   ÚobjectÚboolr3   r6   r5   r    r   r   r      sŠ   … ñð Ÿ-™-×AÑA€Dˆ(�3‰-ÓAð
 %-×$7Ñ$7ñàðð ×!Ñ!óð  ˜5ó  ð!˜#ó !ðF˜Fð F tó Fð
#˜Fð # tô #r    r   c                   óZ  — e Zd ZU dZej
                  j                  Zee	   e
d<   ej
                  j                  Zee	   e
d<   ej                  fdedej                   fd„Zeej                  fdedej                   dd fd	„«       Zdefd
„Zde	fd„Zdedefd„Zdedefd„Zedd„«       Zy)Ú
PrivateKeya{  
    Private key for decrypting messages using the Curve25519 algorithm.

    .. warning:: This **must** be protected and remain secret. Anyone who
        knows the value of your :class:`~nacl.public.PrivateKey` can decrypt
        any message encrypted by the corresponding
        :class:`~nacl.public.PublicKey`

    :param private_key: The private key used to decrypt messages
    :param encoder: The encoder class used to decode the given keys

    :cvar SIZE: The size that the private key is required to be
    :cvar SEED_SIZE: The size that the seed used to generate the
                     private key is required to be
    r   Ú	SEED_SIZEÚprivate_keyr   c                 ó>  — |j                  |«      }t        |t        «      rt        |«      | j                  k(  s.t        j                  dj                  | j                  «      «      ‚t        j                  j                  |«      }|| _        t        |«      | _        y )Nz>PrivateKey must be created from a {} bytes long raw secret key)r   r   r   r   r   r   r   r   r/   r0   Úcrypto_scalarmult_baseÚ_private_keyr   r   )r   rE   r   Úraw_public_keys       r   r   zPrivateKey.__init__W   sz   € ð —n‘n [Ó1ˆô �{¤EÔ*¬s°;Ó/?À4Ç9Á9Ò/Lä—-‘-àTß‘&˜Ÿ™Ó#óð ô Ÿ™×=Ñ=¸kÓJˆà'ˆÔÜ# NÓ3ˆ�r    Úseedr!   c                 ó$  — |j                  |«      }t        |t        «      rt        |«      | j                  k(  s.t        j                  dj                  | j                  «      «      ‚t        j                  j                  |«      \  }} | |«      S )ah  
        Generate a PrivateKey using a deterministic construction
        starting from a caller-provided 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: The seed used to generate the private key
        :rtype: :class:`~nacl.public.PrivateKey`
        z7PrivateKey seed must be a {} bytes long binary sequence)r   r   r   r   rD   r   r   r   r/   r0   Úcrypto_box_seed_keypair)ÚclsrJ   r   Úraw_pkÚraw_sks        r   Ú	from_seedzPrivateKey.from_seedm   sq   € ð, �~‰~˜dÓ#ˆä˜4¤Ô'¬C°«I¸¿¹Ò,FÜ—-‘-àMß‘&˜Ÿ™Ó'óð ô Ÿ™×>Ñ>¸tÓD‰ˆ�á�6‹{Ðr    c                 ó   — | j                   S r#   )rH   r%   s    r   r&   zPrivateKey.__bytes__�   s   € Ø× Ñ Ð r    c                 óT   — t        t        | «      t        | j                  «      f«      S r#   )r)   Útyper   r   r%   s    r   r*   zPrivateKey.__hash__“   s   € Ü”T˜$“Z¤ t§¡Ó!7Ð8Ó9Ð9r    r+   c                 ób   — t        || j                  «      sy| j                  |j                  k(  S r-   )r   r.   r   r2   s     r   r3   zPrivateKey.__eq__–   s(   € Ü˜% §¡Ô0ØØ�‰ %×"2Ñ"2Ñ2Ð2r    c                 ó   — | |k(   S r#   r5   r2   s     r   r6   zPrivateKey.__ne__›   r7   r    c                 ó`   —  | t        t        j                  «      t        j                  ¬«      S )z~
        Generates a random :class:`~nacl.public.PrivateKey` object

        :rtype: :class:`~nacl.public.PrivateKey`
        ©r   )r   rC   r   r   r?   )rM   s    r   ÚgeneratezPrivateKey.generatež   s    € ñ ”6œ*Ÿ/™/Ó*´H×4GÑ4GÔHÐHr    N)r!   rC   )r8   r9   r:   r;   r/   r0   Úcrypto_box_SECRETKEYBYTESr   r   r=   r>   Úcrypto_box_SEEDBYTESrD   r   r?   r   r
   r   ÚclassmethodrP   r&   r*   r@   rA   r3   r6   rX   r5   r    r   rC   rC   C   s÷   … ñð  Ÿ-™-×AÑA€Dˆ(�3‰-ÓAØ#Ÿ}™}×AÑA€Iˆx˜‰}ÓAð
 %-×$7Ñ$7ñ4àð4ð ×!Ñ!ó4ð, ð %-×$7Ñ$7ñ àð ð ×!Ñ!ð ð 
ò	 ó ð ðD!˜5ó !ð:˜#ó :ð3˜Fð 3 tó 3ð
#˜Fð # tó #ð òIó ñIr    rC   Ú_BoxÚBox)Úboundc            
       óX  — e Zd ZU dZej
                  j                  Zee	   e
d<   ee
d<   dedefd„Zdefd„Zeej$                  fd	ee   d
ededefd„«       Zdej$                  fdedee   dej*                  defd„Zdej$                  fdedee   dej*                  defd„Zdefd„Zy)r]   a/  
    The Box class boxes and unboxes messages between a pair of keys

    The ciphertexts generated by :class:`~nacl.public.Box` include a 16
    byte authenticator which is checked as part of the decryption. An invalid
    authenticator will cause the decrypt function to raise an exception. The
    authenticator is not a signature. Once you've decrypted the message you've
    demonstrated the ability to create arbitrary valid message, so messages you
    send are repudiable. For non-repudiable messages, sign them after
    encryption.

    :param private_key: :class:`~nacl.public.PrivateKey` used to encrypt and
        decrypt messages
    :param public_key: :class:`~nacl.public.PublicKey` used to encrypt and
        decrypt messages

    :cvar NONCE_SIZE: The size that the nonce is required to be.
    Ú
NONCE_SIZEÚ_shared_keyrE   r   c                 ó0  — t        |t        «      rt        |t        «      st        j                  d«      ‚t
        j                  j                  |j                  t        j                  ¬«      |j                  t        j                  ¬«      «      | _        y )Nz5Box must be created from a PrivateKey and a PublicKeyrW   )r   rC   r   r   r   r/   r0   Úcrypto_box_beforenmÚencoder   r?   ra   )r   rE   r   s      r   r   zBox.__init__Â   su   € Ü˜+¤zÔ2¼*Øœ	ô;
ô —-‘-ØGóð ô  Ÿ=™=×<Ñ<Ø×Ñ¤h×&9Ñ&9ÐÓ:Ø×Ñ¤x×':Ñ':ÐÓ;ó
ˆÕr    r!   c                 ó   — | j                   S r#   ©ra   r%   s    r   r&   zBox.__bytes__Î   r'   r    rM   Úencodedr   c                 óT   — | j                  | «      }|j                  |«      |_        |S )z[
        Alternative constructor. Creates a Box from an existing Box's shared key.
        )Ú__new__r   ra   )rM   rg   r   Úboxs       r   r   z
Box.decodeÑ   s)   € ð —K‘K Ó$ˆð "Ÿ.™.¨Ó1ˆŒàˆ
r    NÚ	plaintextÚnoncec                 ó�  — |€t        | j                  «      }t        |«      | j                  k7  r"t        j                  d| j                  z  «      ‚t
        j                  j                  ||| j                  «      }|j                  |«      }|j                  |«      }t        j                  |||j                  ||z   «      «      S )a¯  
        Encrypts the plaintext message using the given `nonce` (or generates
        one randomly if omitted) and returns the ciphertext encoded with the
        encoder.

        .. warning:: It is **VITALLY** important that the nonce is a nonce,
            i.e. it is a number used only once for any given key. If you fail
            to do this, you compromise the privacy of the messages encrypted.

        :param plaintext: [:class:`bytes`] The plaintext message to encrypt
        :param nonce: [:class:`bytes`] The nonce to use in the encryption
        :param encoder: The encoder to use to encode the ciphertext
        :rtype: [:class:`nacl.utils.EncryptedMessage`]
        ú'The nonce must be exactly %s bytes long)r   r`   r   r   r   r/   r0   Úcrypto_box_easy_afternmra   rd   r   Ú_from_parts)r   rk   rl   r   Ú
ciphertextÚencoded_nonceÚencoded_ciphertexts          r   ÚencryptzBox.encryptà   s²   € ð( ˆ=Ü˜4Ÿ?™?Ó+ˆEäˆu‹:˜Ÿ™Ò(Ü—.‘.Ø9¸D¿O¹OÑKóð ô —]‘]×:Ñ:ØØØ×Ñó
ˆ
ð  Ÿ™ uÓ-ˆØ$Ÿ^™^¨JÓ7Ðä×+Ñ+ØØØ�N‰N˜5 :Ñ-Ó.ó
ð 	
r    rq   c                 ó2  — |j                  |«      }|€|d| j                   }|| j                  d }t        |«      | j                  k7  r"t        j                  d| j                  z  «      ‚t
        j                  j                  ||| j                  «      }|S )aá  
        Decrypts the ciphertext using the `nonce` (explicitly, when passed as a
        parameter or implicitly, when omitted, as part of the ciphertext) and
        returns the plaintext message.

        :param ciphertext: [:class:`bytes`] The encrypted message to decrypt
        :param nonce: [:class:`bytes`] The nonce used when encrypting the
            ciphertext
        :param encoder: The encoder used to decode the ciphertext.
        :rtype: [:class:`bytes`]
        Nrn   )	r   r`   r   r   r   r/   r0   Úcrypto_box_open_easy_afternmra   )r   rq   rl   r   rk   s        r   ÚdecryptzBox.decrypt  s“   € ð$ —^‘^ JÓ/ˆ
àˆ=àÐ0 §¡Ð1ˆEØ# D§O¡OÐ$5Ð6ˆJäˆu‹:˜Ÿ™Ò(Ü—.‘.Ø9¸D¿O¹OÑKóð ô —M‘M×>Ñ>ØØØ×Ñó
ˆ	ð Ðr    c                 ó   — | j                   S )a§  
        Returns the Curve25519 shared secret, that can then be used as a key in
        other symmetric ciphers.

        .. warning:: It is **VITALLY** important that you use a nonce with your
            symmetric cipher. If you fail to do this, you compromise the
            privacy of the messages encrypted. Ensure that the key length of
            your cipher is 32 bytes.
        :rtype: [:class:`bytes`]
        rf   r%   s    r   Ú
shared_keyzBox.shared_key1  s   € ð ×ÑÐr    )r8   r9   r:   r;   r/   r0   Úcrypto_box_NONCEBYTESr`   r   r=   r>   r   rC   r   r   r&   r[   r   r?   r   r\   r
   r   r   r   rt   rw   ry   r5   r    r   r]   r]   «   s  … ñð& !%§¡× CÑ C€J�˜‘ÓCØÓð

 Jð 

¸Ió 

ð ˜5ó  ð à<D×<OÑ<OñØ�$‰ZðØ"'ðØ29ðà	òó ðð" "&Ø$,×$7Ñ$7ñ	)
àð)
ð ˜‰ð)
ð ×!Ñ!ð	)
ð
 
ó)
ð\ "&Ø$,×$7Ñ$7ñ	$àð$ð ˜‰ð$ð ×!Ñ!ð	$ð
 
ó$ðL ˜Eô  r    Ú_Keyc            	       óÈ   — e Zd ZU dZeed<   ee   ed<   defd„Zdefd„Z	e
j                  fded	e
j                  defd
„Ze
j                  fddded	e
j                  defd„Zy)Ú	SealedBoxa`  
    The SealedBox class boxes and unboxes messages addressed to
    a specified key-pair by using ephemeral sender's key pairs,
    whose private part will be discarded just after encrypting
    a single plaintext message.

    The ciphertexts generated by :class:`~nacl.public.SecretBox` include
    the public part of the ephemeral key before the :class:`~nacl.public.Box`
    ciphertext.

    :param recipient_key: a :class:`~nacl.public.PublicKey` used to encrypt
        messages and derive nonces, or a :class:`~nacl.public.PrivateKey` used
        to decrypt messages.

    .. versionadded:: 1.2
    r   rH   Úrecipient_keyc                 óp  — t        |t        «      r-|j                  t        j                  ¬«      | _        d | _        y t        |t        «      rU|j                  t        j                  ¬«      | _        |j                  j                  t        j                  ¬«      | _        y t        j                  d«      ‚)NrW   z:SealedBox must be created from a PublicKey or a PrivateKey)r   r   rd   r   r?   r   rH   rC   r   r   r   )r   r~   s     r   r   zSealedBox.__init__X  s¡   € Ü�m¤YÔ/Ø,×3Ñ3Ü ×+Ñ+ð  4ó  ˆDÔð !%ˆDÕÜ˜¤zÔ2Ø -× 4Ñ 4Ü ×+Ñ+ð !5ó !ˆDÔð  -×7Ñ7×>Ñ>Ü ×+Ñ+ð  ?ó  ˆDÕô —-‘-ØLóð r    r!   c                 ó   — | j                   S r#   r$   r%   s    r   r&   zSealedBox.__bytes__j  r'   r    rk   r   c                 ó|   — t         j                  j                  || j                  «      }|j	                  |«      }|S )a{  
        Encrypts the plaintext message using a random-generated ephemeral
        key pair and returns a "composed ciphertext", containing both
        the public part of the key pair and the ciphertext proper,
        encoded with the encoder.

        The private part of the ephemeral key-pair will be scrubbed before
        returning the ciphertext, therefore, the sender will not be able to
        decrypt the generated ciphertext.

        :param plaintext: [:class:`bytes`] The plaintext message to encrypt
        :param encoder: The encoder to use to encode the ciphertext
        :return bytes: encoded ciphertext
        )r/   r0   Úcrypto_box_sealr   rd   )r   rk   r   rq   rs   s        r   rt   zSealedBox.encryptm  s5   € ô( —]‘]×2Ñ2°9¸d×>NÑ>NÓOˆ
à$Ÿ^™^¨JÓ7Ðà!Ð!r    r   zSealedBox[PrivateKey]rq   c                 óÀ   — |j                  |«      }| j                  €t        d«      ‚t        j                  j                  || j                  | j                  «      }|S )a  
        Decrypts the ciphertext using the ephemeral public key enclosed
        in the ciphertext and the SealedBox private key, returning
        the plaintext message.

        :param ciphertext: [:class:`bytes`] The encrypted message to decrypt
        :param encoder: The encoder used to decode the ciphertext.
        :return bytes: The original plaintext
        :raises TypeError: if this SealedBox was created with a
            :class:`~nacl.public.PublicKey` rather than a
            :class:`~nacl.public.PrivateKey`.
        z4SealedBoxes created with a public key cannot decrypt)r   rH   r   r/   r0   Úcrypto_box_seal_openr   )r   rq   r   rk   s       r   rw   zSealedBox.decrypt‡  sa   € ð$ —^‘^ JÓ/ˆ
à×ÑÐ$ÜØFóð ô —M‘M×6Ñ6ØØ×ÑØ×Ñó
ˆ	ð Ðr    N)r8   r9   r:   r;   r   r>   r   r{   r   r&   r   r?   r
   rt   rw   r5   r    r   r}   r}   C  s�   … ñð" ÓØ˜5‘/Ó!ð dó ð$ ˜5ó  ð %-×$7Ñ$7ñ"àð"ð ×!Ñ!ð"ð 
ó	"ð: %-×$7Ñ$7ñØ%ðàðð ×!Ñ!ðð 
ô	r    r}   )Útypingr   r   r   r   r   Únacl.bindingsr/   r   r	   r   Únacl.encodingr
   Ú
nacl.utilsr   r   r   Ú	Encodabler   rC   r\   r]   r{   r}   r5   r    r   ú<module>rŠ      sž   ð÷ >Õ =ã Ý Ý "Ý !ß <Ñ <ô)#�×"Ñ" Kô )#ôXbI�×#Ñ# [ô bIñJ ˆv˜UÔ#€ôR ˆ(×
Ñ
˜kô R ñj ˆv�y *Ó-€ôb�˜‘˜x×1Ñ1°;õ br    