Skip to content

miniproto.session.models.AuthKey

AuthKey(dc_id: int, key: bytes, key_id: int | None = None, created_at: datetime = _utc_now(), expires_at: datetime | None = None) -> None

Validated non-empty MTProto authorization key bound to a positive DC.

Attributes:

  • dc_id (int) – Positive data-centre identifier that owns the key.
  • key (bytes) – Secret authorization-key bytes, hidden from repr.
  • key_id (int | None) – Optional server-derived authorization-key fingerprint.
  • created_at (datetime) – Creation timestamp; aware input retains its original timezone and naive input assumes UTC.
  • expires_at (datetime | None) – Optional expiry timestamp with the same aware/naive handling.

Raises:

  • ValueError – If dc_id is not positive or key is empty.