Skip to main content

Module login_relink

Module login_relink 

Expand description

Channel-owned relink hooks for QR-pairing channels.

“Relink” replaces the currently linked account: QR-pairing channels (WeChat, WhatsApp Web) persist their login on disk and silently resume it on every start — by design, a restart never re-runs the QR flow while a session exists. So issuing a new QR necessarily means clearing the persisted login first; the restarted channel then finds no session and begins a fresh pairing.

Each match arm delegates to the channel module that owns the state, so knowledge of what constitutes a persisted login (which files, which rows) never leaks out of the channel — the gateway endpoint that exposes this dispatches here and performs no file operations of its own. Paths are resolved from the canonical Config per call; nothing is cached.

Channels that cannot relink — webhook-token channels, bot-token channels, the WhatsApp Cloud API backend, or channels whose feature is not compiled into this binary — never resolve to a QrPairingChannel key (crate::listing::qr_pairing_channel returns None), so they never reach this hook and nothing is touched: no files are removed, no state changes, the operation is an explicit no-op the caller can surface verbatim.

Relinking only clears disk state. A currently running channel keeps its in-memory session until it restarts; callers own scheduling that restart (the daemon reload path), which keeps this hook free of lifecycle side effects and keeps restart policy where it already lives.

Enums§

RelinkOutcome
Result of a relink request for one channel alias.

Functions§

relink
Clear the persisted login state for a channel alias so its next start mints a fresh QR pairing.