Skip to content

fix(telegram): restore DC-only sessions and migrate QR on the same cl… - #1851

Open
arashm404 wants to merge 1 commit into
gotd:mainfrom
arashm404:fix/dc-migrate-session-restore
Open

fix(telegram): restore DC-only sessions and migrate QR on the same cl…#1851
arashm404 wants to merge 1 commit into
gotd:mainfrom
arashm404:fix/dc-migrate-session-restore

Conversation

@arashm404

Copy link
Copy Markdown

…ient

Persisting a session blob with DC set but no auth key used to fail with "corrupted key" because a zero key has a non-zero SHA-1 id. Treat that as an unauthenticated handshake pinned to the stored DC (same as pool.Session.Migrate in memory). Also derive AuthKeyID when it is missing, and persist the session before signalling Run ready so SessionStorage wrappers observe DC/auth key ID in the callback.

QR LoginTokenMigrateTo is bound to the current connection's auth key. Auth() now migrates via Options.Migrate and importLoginToken on the same client instead of leaving callers to open a second Client with Options.DC (that path AUTH_TOKEN_EXPIRED).

…ient

Persisting a session blob with DC set but no auth key used to fail with
"corrupted key" because a zero key has a non-zero SHA-1 id. Treat that
as an unauthenticated handshake pinned to the stored DC (same as
pool.Session.Migrate in memory). Also derive AuthKeyID when it is
missing, and persist the session before signalling Run ready so
SessionStorage wrappers observe DC/auth key ID in the callback.

QR LoginTokenMigrateTo is bound to the current connection's auth key.
Auth() now migrates via Options.Migrate and importLoginToken on the
same client instead of leaving callers to open a second Client with
Options.DC (that path AUTH_TOKEN_EXPIRED).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant