o
    Uh%	                  	   @   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   =/var/www/html/venv/lib/python3.10/site-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&   $