fix(core): drop non-primary auth keys on logout
All checks were successful
Tests / test-deno (push) Successful in 1m42s
Tests / test-bun (push) Successful in 1m51s
Tests / test-node (node20) (push) Successful in 2m0s
Tests / test-node (node22) (push) Successful in 2m0s
Tests / test-node (node18) (push) Successful in 2m6s
Tests / test-web (chromium) (push) Successful in 2m1s
Tests / test-web (firefox) (push) Successful in 2m11s
Build and deploy typedoc / build (push) Successful in 5m59s
Tests / lint (push) Successful in 6m35s
Tests / e2e (push) Successful in 48s
Tests / e2e-deno (push) Successful in 1m0s

This commit is contained in:
alina 🌸 2025-01-30 14:47:20 +03:00
parent cc7ca2997e
commit f042c9d14e
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI

View file

@ -177,6 +177,13 @@ export class BaseTelegramClient implements ITelegramClient {
this.log.prefix = '[USER n/a] '
await this.storage.self.store(null)
// drop non-primary auth keys because they are no longer valid
const primaryDc = this.mt.network.getPrimaryDcId()
for (const dc of this.mt.network.config.getCached()?.dcOptions ?? []) {
if (dc.id === primaryDc) continue
await this.mt.storage.provider.authKeys.deleteByDc(dc.id)
}
}
async notifyChannelOpened(channelId: number, pts?: number): Promise<boolean> {