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

# EncryptedCredentials

class telegram.EncryptedCredentials(data, hash, secret, *, api_kwargs=None)

  Bases: `telegram.TelegramObject`

  Contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.

  Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their `data`, `hash` and `secret` are equal.

  Note

  This object is decrypted only when originating from `telegram.PassportData.decrypted_credentials`.

  Parameters:

    - data (`telegram.Credentials` | `str`) – Decrypted data with unique user’s nonce, data hashes and secrets used for EncryptedPassportElement decryption and authentication or base64 encrypted data.

    - hash (`str`) – Base64-encoded data hash for data authentication.

    - secret (`str`) – Decrypted or encrypted secret used for decryption.

  data

    Decrypted data with unique user’s nonce, data hashes and secrets used for EncryptedPassportElement decryption and authentication or base64 encrypted data.

    Type:

      `telegram.Credentials` | `str`

  hash

    Base64-encoded data hash for data authentication.

    Type:

      `str`

  secret

    Decrypted or encrypted secret used for decryption.

    Type:

      `str`

  Available In

  `telegram.PassportData.credentials`

  property decrypted_data
    Lazily decrypt and return credentials data. This object

      also contains the user specified nonce as decrypted_data.nonce.

    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_secret

    Lazily decrypt and return secret.

    Raises:

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

    Type:

      `str`