diff --git a/packages/core/src/highlevel/base.ts b/packages/core/src/highlevel/base.ts index 71c2cac6..2d01f7e3 100644 --- a/packages/core/src/highlevel/base.ts +++ b/packages/core/src/highlevel/base.ts @@ -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 {