EncryptedPassportElement

class telegram.EncryptedPassportElement(type, hash, data=None, phone_number=None, email=None, files=None, front_side=None, reverse_side=None, selfie=None, translation=None, credentials=None, *, api_kwargs=None)[source]

Bases: telegram.TelegramObject

Contains information about documents or other Telegram Passport elements shared with the bot by the user. The data has been automatically decrypted by python-telegram-bot.

Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their type, data, phone_number, email, files, front_side, reverse_side and selfie are equal.

Note

This object is decrypted only when originating from telegram.PassportData.decrypted_data.

Parameters:
  • type (str) – Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”.

  • hash (str) – Base64-encoded element hash for using in telegram.PassportElementErrorUnspecified.

  • data (telegram.PersonalDetails | telegram.IdDocumentData | telegram.ResidentialAddress | str, optional) – Decrypted or encrypted data; available only for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types.

  • phone_number (str, optional) – User’s verified phone number; available only for “phone_number” type.

  • email (str, optional) – User’s verified email address; available only for “email” type.

  • files (Sequence[telegram.PassportFile], optional) –

    Array of encrypted/decrypted files with documents provided by the user; available only for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types.

    Changed in version 20.0: Accepts any collections.abc.Sequence as input instead of just a list. The input is converted to a tuple.

  • front_side (telegram.PassportFile, optional) – Encrypted/decrypted file with the front side of the document, provided by the user; Available only for “passport”, “driver_license”, “identity_card” and “internal_passport”.

  • reverse_side (telegram.PassportFile, optional) – Encrypted/decrypted file with the reverse side of the document, provided by the user; Available only for “driver_license” and “identity_card”.

  • selfie (telegram.PassportFile, optional) – Encrypted/decrypted file with the selfie of the user holding a document, provided by the user; available if requested for “passport”, “driver_license”, “identity_card” and “internal_passport”.

  • translation (Sequence[telegram.PassportFile], optional) –

    Array of encrypted/decrypted files with translated versions of documents provided by the user; available if requested requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types.

    Changed in version 20.0: Accepts any collections.abc.Sequence as input instead of just a list. The input is converted to a tuple.

type[source]

Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”.

Type:

str

hash[source]

Base64-encoded element hash for using in telegram.PassportElementErrorUnspecified.

Type:

str

data[source]

Optional. Decrypted or encrypted data; available only for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types.

Type:

telegram.PersonalDetails | telegram.IdDocumentData | telegram.ResidentialAddress | str

phone_number[source]

Optional. User’s verified phone number; available only for “phone_number” type.

Type:

str

email[source]

Optional. User’s verified email address; available only for “email” type.

Type:

str

files[source]

Optional. Array of encrypted/decrypted files with documents provided by the user; available only for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types.

Changed in version 20.0:

  • This attribute is now an immutable tuple.

  • This attribute is now always a tuple, that may be empty.

Type:

Tuple[telegram.PassportFile]

front_side[source]

Optional. Encrypted/decrypted file with the front side of the document, provided by the user; available only for “passport”, “driver_license”, “identity_card” and “internal_passport”.

Type:

telegram.PassportFile

reverse_side[source]

Optional. Encrypted/decrypted file with the reverse side of the document, provided by the user; available only for “driver_license” and “identity_card”.

Type:

telegram.PassportFile

selfie[source]

Optional. Encrypted/decrypted file with the selfie of the user holding a document, provided by the user; available if requested for “passport”, “driver_license”, “identity_card” and “internal_passport”.

Type:

telegram.PassportFile

translation[source]

Optional. Array of encrypted/decrypted files with translated versions of documents provided by the user; available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types.

Changed in version 20.0:

  • This attribute is now an immutable tuple.

  • This attribute is now always a tuple, that may be empty.

Type:

Tuple[telegram.PassportFile]

classmethod de_json(data, bot=None)[source]

See telegram.TelegramObject.de_json().

classmethod de_json_decrypted(data, bot, credentials)[source]

Variant of telegram.TelegramObject.de_json() that also takes into account passport credentials.

Parameters:
  • data (Dict[str, …]) – The JSON data.

  • bot (telegram.Bot | None) –

    The bot associated with these object. May be None, in which case shortcut methods will not be available.

    Changed in version 21.4: bot is now optional and defaults to None

    Deprecated since version 21.4: This argument will be converted to an optional argument in future versions.

  • credentials (telegram.FileCredentials) – The credentials

Return type:

telegram.EncryptedPassportElement