Passport objects

PassportData

class PassportData(*, data, credentials)

This class contains formation about Telegram Passport data shared with the bot by the user

Parameters
  • data (list of EncryptedPassportElement) – List with information about documents and other Telegram Passport elements that was shared with the bot

  • credentials (EncryptedCredentials) – Encrypted credentials required to decrypt the data

EncryptedCredentials

class EncryptedCredentials(*, data, hash_data, secret)

This class contains data required for decrypting and authenticating EncryptedPassportElement See https://core.telegram.org/passport#receiving-information for further information

Parameters
  • data (str) – Base64 encoded encrypted JSON-serialized data with unique user’s payload,d ata hashed and secrets required for EncryptedPassportElement decryption and authentication

  • hash_data (str) – Base64 encoded data hash for data authentication

  • secret (str) – Base64 encoded secret, encrypted with the bot’s public RSA key, required for data decryption

EncryptedPassportElement

class EncryptedPassportElement(*, type_result, data=None, hash_data, phone_number=None, email=None, files=None, front_side=None, reverse_side=None, selfie=None, translation=None)

This class contains information about documents or other Telegram Passport elements shared with the bot by the user

Parameters
  • type_result (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”

  • data (str) – Optional: Base64-encoded encrypted Telegram Passport element data provided by the user, available for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types

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

  • 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 (list of PassportFile) – Optional: Array of encrypted files with documents provided by the user, available for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials

  • front_side (PassportFile) – Optional: Encrypted file with the front side of the document, provided by the user. Available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials.

  • reverse_side (PassportFile) – Optional: Encrypted file with the reverse side of the document, provided by the user. Available or “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials

  • selfie (PassportFile) – Optional: Encrypted file with the selfie of the user holding a document, provided by the user; available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials

  • translation (list of PassportFile) – Optional: Array of encrypted 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. Files can be decrypted and verified using the accompanying EncryptedCredentials

PassportFile

class PassportFile(*, file_id, file_size, file_date)

This class represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don’t exceed 10 MB

Parameters
  • file_id (str) – Identifier for this file

  • file_size (int) – Size of file

  • file_date (int) – Unix time when the file was uploaded

PassportElementErrorUnspecified

class PassportElementErrorUnspecified(*, source, type_result, element_hash, message)

This class represents an issue in an unspecified place. The error is considered resolved when new data is added

Parameters
  • source (str) – Error source, must be unspecified

  • type_result (str) – Type of element of the user’s Telegram Passport which has the issue

  • element_hash (str) – Base64 encoded element hash

  • message (str) – Error message