Hide navigation sidebar
Hide table of contents sidebar
PTB has undergone significant changes in v20. Please read the documentation carefully and also check out the transition guide in the wiki.
Back to top
Toggle table of contents sidebar

# 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)

  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 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 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 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 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 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 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

    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

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

    Type:

      `str`

  data

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

    Type:

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

  phone_number

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

    Type:

      `str`

  email

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

    Type:

      `str`

  files

    Optional. Array of encrypted/decrypted files with documents provided by the user, available 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

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

    Type:

      `telegram.PassportFile`

  reverse_side

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

    Type:

      `telegram.PassportFile`

  selfie

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

    Type:

      `telegram.PassportFile`

  translation

    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`]

  Available In

  `telegram.PassportData.data`

  classmethod de_json(data, bot)

    See `telegram.TelegramObject.de_json()`.

  classmethod de_json_decrypted(data, bot, credentials)

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

    Parameters:

      - data (Dict[`str`, …]) – The JSON data.

      - bot (`telegram.Bot`) – The bot associated with this object.

      - credentials (`telegram.FileCredentials`) – The credentials

    Return type:

      `telegram.EncryptedPassportElement`