o
    "hN                     @   s   d Z ddlmZ ddlmZm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 ddlmZ er<dd	lmZmZ G d
d deZdS )zRContains information about Telegram Passport data shared with the bot by the user.    )Sequence)TYPE_CHECKINGOptional)EncryptedCredentials)EncryptedPassportElement)TelegramObject)de_json_optionalde_list_optionalparse_sequence_arg)JSONDict)BotCredentialsc                       s   e Zd ZdZdZdddee dedee	 f fdd	Z
edde	d
ed dd f fddZedeedf fddZedddZ  ZS )PassportDataa  Contains information about Telegram Passport data shared with the bot by the user.

    Note:
        To be able to decrypt this object, you must pass your ``private_key`` to either
        :class:`telegram.ext.Updater` or :class:`telegram.Bot`. Decrypted data is then found in
        :attr:`decrypted_data` and the payload can be found in :attr:`decrypted_credentials`'s
        attribute :attr:`telegram.Credentials.nonce`.

    Args:
        data (Sequence[:class:`telegram.EncryptedPassportElement`]): Array with encrypted
            information about documents and other Telegram Passport elements that was shared with
            the bot.

            .. versionchanged:: 20.0
                |sequenceclassargs|

        credentials (:class:`telegram.EncryptedCredentials`)): Encrypted credentials.

    Attributes:
        data (tuple[:class:`telegram.EncryptedPassportElement`]): Array with encrypted
            information about documents and other Telegram Passport elements that was shared with
            the bot.

            .. versionchanged:: 20.0
                |tupleclassattrs|

        credentials (:class:`telegram.EncryptedCredentials`): Encrypted credentials.


    )_decrypted_datacredentialsdataN
api_kwargsr   r   r   c                   sL   t  j|d t|| _|| _d | _tdd |D |jg | _| 	  d S )Nr   c                 S   s   g | ]}|j qS  )type).0xr   r   R/var/www/html/venv/lib/python3.10/site-packages/telegram/_passport/passportdata.py
<listcomp>P   s    z)PassportData.__init__.<locals>.<listcomp>)
super__init__r
   r   r   r   tuplehash	_id_attrs_freeze)selfr   r   r   	__class__r   r   r   C   s   
zPassportData.__init__botr   returnc                    sF   |  |}t|dt||d< t|dt||d< t j||dS )z,See :meth:`telegram.TelegramObject.de_json`.r   r   )r   r#   )_parse_datar	   getr   r   r   r   de_json)clsr   r#   r!   r   r   r'   T   s   
zPassportData.de_json.c                    s*    j du rt fdd jD  _  j S )a  
        tuple[:class:`telegram.EncryptedPassportElement`]: Lazily decrypt and return information
            about documents and other Telegram Passport elements which were shared with the bot.

        .. versionchanged:: 20.0
            Returns a tuple instead of a list.

        Raises:
            telegram.error.PassportDecryptionError: Decryption failed. Usually due to bad
                private/public key but can also suggest malformed/tampered data.
        Nc                 3   s(    | ]}t |    jV  qd S N)r   de_json_decryptedto_dictget_botdecrypted_credentials)r   elementr    r   r   	<genexpr>l   s    
z.PassportData.decrypted_data.<locals>.<genexpr>)r   r   r   r/   r   r/   r   decrypted_data^   s
   

zPassportData.decrypted_datar   c                 C   s   | j jS )a  
        :class:`telegram.Credentials`: Lazily decrypt and return credentials that were used
            to decrypt the data. This object also contains the user specified payload as
            `decrypted_data.payload`.

        Raises:
            telegram.error.PassportDecryptionError: Decryption failed. Usually due to bad
                private/public key but can also suggest malformed/tampered data.
        )r   r1   r/   r   r   r   r-   t   s   z"PassportData.decrypted_credentialsr)   )r$   r   )__name__
__module____qualname____doc__	__slots__r   r   r   r   r   r   classmethodr'   propertyr   r1   r-   __classcell__r   r   r!   r   r   !   s"    "	r   N)r5   collections.abcr   typingr   r   telegram._passport.credentialsr   +telegram._passport.encryptedpassportelementr   telegram._telegramobjectr   telegram._utils.argumentparsingr   r	   r
   telegram._utils.typesr   telegramr   r   r   r   r   r   r   <module>   s   