Expand description
grammers 0.11 sessions and connection params from opentele2 accounts and API profiles, and back.
session_dataturns a tdataAccountinto agrammers_session::SessionData, ready forMemorySession::fromorSessionData::import_to.account_from_sessionis its inverse: the home DC key and the self user of aSessionDatabecome anAccount.connection_paramscopies theinitConnectionfields of anApiProfileinto agrammers_mtsender::ConnectionParams.- With the
clientfeature (off by default),clientruns the opentele2 client flows over grammers-client 0.11: QR login with DC migration and 2FA, the self user id, session admin, the seven consistency checks and tdata from a client session, over anInvokerthatgrammers_client::Clientimplements. Its module docs list the limits grammers 0.11 puts on those flows.
The core crate never depends on grammers; this crate is the optional
bridge. The profile’s api_id is passed to grammers separately (for
example to SenderPool::new), and its api_hash at sign-in.
§Fingerprint gap
grammers 0.11 builds initConnection itself in SenderPool
(grammers-mtsender sender_pool.rs) and always sends lang_pack: ""
and params: None. ConnectionParams has no field for either, so the
profile’s ApiProfile::lang_pack (tdesktop for the desktop profile)
is dropped, and no params JSON object is sent. A session driven by
grammers with a desktop profile is therefore not byte-identical on the
wire to Telegram Desktop: the device, system, app and language fields
match, those two do not.
Closing the gap needs an upstream change in grammers-mtsender: a
lang_pack: String and a params: Option<JsonValue> field (the TL
JSONValue) on ConnectionParams, defaulting to "" and None, which
SenderPool copies into InitConnection in place of the hardcoded
values. Once released, connection_params fills both from the
profile.
§Keys
SessionData and its DcOption derive Debug and print the raw auth
key; do not log them. opentele2’s AuthKey prints its key id only.
Functions§
- account_
from_ session - The account at
indexfor grammers session data: the key of the home DC and the user id of the self user, with the home DC as main DC. - connection_
params - grammers connection params for
profile:device_model,system_version,app_version,system_lang_codeandlang_codefrom the profile, every other field the grammers default. - session_
data - grammers session data for
account.