Skip to main content

Crate opentele2_grammers

Crate opentele2_grammers 

Source
Expand description

grammers 0.11 sessions and connection params from opentele2 accounts and API profiles, and back.

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 index for 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_code and lang_code from the profile, every other field the grammers default.
session_data
grammers session data for account.