Skip to main content

Interface: AuthStrategy

Defined in: auth/AuthStrategy.ts:11

Contract for an authentication strategy: how the WhatsApp session credentials/keys are loaded and saved across restarts.

With Baileys 7 the state also persists LID↔PN mappings, device lists and tokens; useMultiFileAuthState (used by LocalAuth) already handles this for you.

Methods

clear()?

optional clear(): Promise<void>

Defined in: auth/AuthStrategy.ts:22

Deletes the persisted session (after logout). Optional.

Returns

Promise<void>


getAuthState()

getAuthState(): Promise<{ saveCreds: () => Promise<void>; state: AuthenticationState; }>

Defined in: auth/AuthStrategy.ts:16

Returns the authentication state and a saveCreds function that the client will call whenever something changes.

Returns

Promise<{ saveCreds: () => Promise<void>; state: AuthenticationState; }>