U
    7d%	                     @   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e	ed
ddZdee	dddZejfee	eje	dddZdS )    N)SupportsBytesTypeTypeVar)encoding_EncryptedMessageEncryptedMessage)boundc                   @   sd   e Zd ZU dZeed< eed< eee eeeedddZ	e
eddd	Ze
ed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   L/var/www/html/alexa-login-pro/venv/lib/python3.8/site-packages/nacl/utils.py_from_parts"   s    zEncryptedMessage._from_parts)r   c                 C   s   | j S )zX
        The nonce used during the encryption of the :class:`EncryptedMessage`.
        )r	   selfr   r   r   r   .   s    zEncryptedMessage.noncec                 C   s   | j S )zP
        The ciphertext contained within the :class:`EncryptedMessage`.
        )r
   r   r   r   r   r   5   s    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eedddZdS )StringFixer)r   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   s    r&       )sizer   c                 C   s
   t | S r   )osurandom)r(   r   r   r   randomF   s    r+   )r(   seedencoderr   c                 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
    )naclZbindingsZrandombytes_buf_deterministicencode)r(   r,   r-   raw_datar   r   r   randombytes_deterministicJ   s    r1   )r'   )r)   typingr   r   r   Znacl.bindingsr.   r   r   r   r   r   r    r&   intr+   Z
RawEncoderZEncoderr1   r   r   r   r   <module>   s   $  