a b% @sddlZddlmZmZmZddlZddlmZedddZGddde Z Gdd d Z e e d d d Z dee dddZejfee eje dddZdS)N) SupportsBytesTypeTypeVar)encoding_EncryptedMessageEncryptedMessage)boundc@sdeZdZUdZeed<eed<eeeeeeedddZ e eddd Z e edd d Z d S) rze A bytes subclass that holds a messaged that has been encrypted by a :class:`SecretBox`. _nonce _ciphertext)clsnonce ciphertextcombinedreturncCs||}||_||_|SN)r r )r r r robjr1/tmp/pip-target-98j97qn4/lib/python/nacl/utils.py _from_parts"szEncryptedMessage._from_parts)rcCs|jS)zX The nonce used during the encryption of the :class:`EncryptedMessage`. )r selfrrrr .szEncryptedMessage.noncecCs|jS)zP The ciphertext contained within the :class:`EncryptedMessage`. )r rrrrr 5szEncryptedMessage.ciphertextN) __name__ __module__ __qualname____doc__bytes__annotations__ classmethodrrrpropertyr r rrrrrs  c@seZdZeedddZdS) StringFixer)rrcCs t|Sr)str __bytes__rrrr__str__>szStringFixer.__str__N)rrrrr r"rrrrr=sr)bytes_inrcCs |dS)Nascii)decode)r#rrrbytes_as_stringBsr& )sizercCs t|Sr)osurandom)r(rrrrandomFsr+)r(seedencoderrcCstj||}||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 )naclZbindingsZrandombytes_buf_deterministicencode)r(r,r-raw_datarrrrandombytes_deterministicJs r1)r')r)typingrrrZ nacl.bindingsr.rrrrrr r&intr+Z RawEncoderZEncoderr1rrrrs  $