telegram.PassportData

class telegram.PassportData(*args, **kwargs)[source]

Bases: telegram.TelegramObject

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 telegram.ext.Updater or telegram.Bot. Decrypted data is then found in decrypted_data and the payload can be found in decrypted_credentials’s attribute telegram.Credentials.nonce.

Parameters
data[source]

Array with encrypted information about documents and other Telegram Passport elements that was shared with the bot.

Type

List[telegram.EncryptedPassportElement]

credentials[source]

Encrypted credentials.

Type

telegram.EncryptedCredentials

bot[source]

The Bot to use for instance methods.

Type

telegram.Bot, optional

classmethod de_json(data, bot)[source]

See telegram.TelegramObject.de_json().

property decrypted_credentials[source]
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.

Type

telegram.Credentials

property decrypted_data[source]
Lazily decrypt and return information

about documents and other Telegram Passport elements which were shared with the bot.

Raises

telegram.error.PassportDecryptionError – Decryption failed. Usually due to bad private/public key but can also suggest malformed/tampered data.

Type

List[telegram.EncryptedPassportElement]

to_dict()[source]

See telegram.TelegramObject.to_dict().