o
    ç÷¡g%	  ã                	   @   s¦   d dl Z d dlmZmZmZ d dlZd dlmZ eddd�ZG dd„ de	ƒZ
G dd	„ d	ƒZd
e	defdd„Zddede	fdd„Zejfdede	dejde	fdd„ZdS )é    N)ÚSupportsBytesÚTypeÚTypeVar)ÚencodingÚ_EncryptedMessageÚEncryptedMessage)Úboundc                   @   sl   e Zd ZU dZeed< eed< edee dedededef
d	d
„ƒZ	e
defdd„ƒZe
defdd„ƒZdS )r   ze
    A bytes subclass that holds a messaged that has been encrypted by a
    :class:`SecretBox`.
    Ú_nonceÚ_ciphertextÚclsÚnonceÚ
ciphertextÚcombinedÚreturnc                 C   s   | |ƒ}||_ ||_|S ©N)r	   r
   )r   r   r   r   Úobj© r   ú5/usr/local/lib/python3.10/dist-packages/nacl/utils.pyÚ_from_parts"   s   zEncryptedMessage._from_partsc                 C   ó   | j S )zX
        The nonce used during the encryption of the :class:`EncryptedMessage`.
        )r	   ©Úselfr   r   r   r   .   ó   zEncryptedMessage.noncec                 C   r   )zP
        The ciphertext contained within the :class:`EncryptedMessage`.
        )r
   r   r   r   r   r   5   r   zEncryptedMessage.ciphertextN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚbytesÚ__annotations__Úclassmethodr   r   r   Úpropertyr   r   r   r   r   r   r      s(   
 ÿþýüûc                   @   s   e Zd Zdedefdd„ZdS )ÚStringFixerr   r   c                 C   s   t |  ¡ ƒS r   )ÚstrÚ	__bytes__r   r   r   r   Ú__str__>   s   zStringFixer.__str__N)r   r   r   r   r"   r$   r   r   r   r   r!   =   s    r!   Úbytes_inr   c                 C   s
   |   d¡S )NÚascii)Údecode)r%   r   r   r   Úbytes_as_stringB   ó   
r(   é    Úsizec                 C   s
   t  | ¡S r   )ÚosÚurandom)r+   r   r   r   ÚrandomF   r)   r.   ÚseedÚencoderc                 C   s   t j | |¡}| |¡S )zê
    Returns ``size`` number of deterministically generated pseudorandom bytes
    from a seed

    :param size: int
    :param seed: bytes
    :param encoder: The encoder class used to encode the produced bytes
    :rtype: bytes
    )ÚnaclÚbindingsÚrandombytes_buf_deterministicÚencode)r+   r/   r0   Úraw_datar   r   r   Úrandombytes_deterministicJ   s   
r6   )r*   )r,   Útypingr   r   r   Únacl.bindingsr1   r   r   r   r   r!   r"   r(   Úintr.   Ú
RawEncoderÚEncoderr6   r   r   r   r   Ú<module>   s&   $ÿÿÿÿþ