
    Qif                         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 ddlmZ erdd	lmZmZ  G d
 de      Zy)zRContains information about Telegram Passport data shared with the bot by the user.    )Sequence)TYPE_CHECKINGOptional)EncryptedCredentials)EncryptedPassportElement)TelegramObject)parse_sequence_arg)JSONDict)BotCredentialsc            	            e Zd ZdZdZdddee   dedee	   f fdZ
e	 ddee	   d	ed
   ded    f fd       Zedeedf   fd       Zedd       Z x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                    t         |   |       t        |      | _        || _        d | _        t        |D cg c]  }|j                   c}|j                  gz         | _	        | j                          y c c}w )Nr   )super__init__r	   r   r   r   tupletypehash	_id_attrs_freeze)selfr   r   r   x	__class__s        J/app/.venv/lib/python3.12/site-packages/telegram/_passport/passportdata.pyr   zPassportData.__init__C   sl     	J/:LT:R	1<JN5159I9I8JJK  6s   A7botr   returnc                     | j                  |      }|syt        j                  |j                  d      |      |d<   t	        j
                  |j                  d      |      |d<   t        |   ||      S )z,See :meth:`telegram.TelegramObject.de_json`.Nr   r   )r   r    )_parse_datar   de_listgetr   de_jsonr   )clsr   r    r   s      r   r&   zPassportData.de_jsonT   sl    
 t$/778H#NV2::488M;RTWX]wDc22    .c                 z      j                   #t         f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.
        c              3      K   | ]A  }t        j                  |j                         j                         j                         C y wN)r   de_json_decryptedto_dictget_botdecrypted_credentials).0elementr   s     r   	<genexpr>z.PassportData.decrypted_data.<locals>.<genexpr>q   sB      )  )G )::OO%t||~t7Q7Q  )s   AA
)r   r   r   r   s   `r   decrypted_datazPassportData.decrypted_datac   s?     '#( )  $yy	) $D  ###r(   c                 .    | 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   r4   r3   s    r   r/   z"PassportData.decrypted_credentialsy   s     ...r(   r+   )r!   r   )__name__
__module____qualname____doc__	__slots__r   r   r   r   r
   r   classmethodr&   propertyr   r4   r/   __classcell__)r   s   @r   r   r   !   s    > ;I *./0 *
 X&" >B3H%3,4UO3	.	!3 3 $&>&C D $ $* 
/ 
/r(   r   N)r9   collections.abcr   typingr   r   telegram._passport.credentialsr   +telegram._passport.encryptedpassportelementr   telegram._telegramobjectr   telegram._utils.argumentparsingr	   telegram._utils.typesr
   telegramr   r   r    r(   r   <module>rG      s4   & Y $ * ? P 3 > *)c/> c/r(   