o
    Zzj<  ã                   @   sˆ   d Z ddlmZ ddl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)Ú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dB f‡ fdd	„Z	e
dded
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   úZ/var/www/kodo/tsheker/venv/lib/python3.10/site-packages/telegram/_passport/passportdata.pyÚ
<listcomp>Q   s    z)PassportData.__init__.<locals>.<listcomp>)
ÚsuperÚ__init__r	   r   r   r   ÚtupleÚhashÚ	_id_attrsÚ_freeze)Úselfr   r   r   ©Ú	__class__r   r   r   D   s   
zPassportData.__init__Úbotz
Bot | NoneÚ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&   U   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>m   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   r0   r.   r   r   r   r,   u   s   z"PassportData.decrypted_credentialsr(   )r#   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   r   r
   r   Úclassmethodr&   Úpropertyr   r0   r,   Ú__classcell__r   r   r    r   r   "   s"    ûþýû	r   N)r4   Úcollections.abcr   Útypingr   Ú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   