diff --git a/README.md b/README.md index aa67e00..20c7477 100644 --- a/README.md +++ b/README.md @@ -145,12 +145,12 @@ import * as fs from 'fs' // utility function to help save the auth state in a single folder // this function serves as a good guide to help write auth & key states for SQL/no-SQL databases, which I would recommend in any production grade system -const { state, saveCreds } = useMultiFileAuthState('auth_info_baileys') +const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys') // will use the given state to connect // so if valid credentials are available -- it'll connect without QR const conn = makeWASocket({ auth: state }) // this will be called as soon as the credentials are updated -conn.ev.on ('creds.update', saveState) +conn.ev.on ('creds.update', saveCreds) ``` **Note**: When a message is received/sent, due to signal sessions needing updating, the auth keys (`authState.keys`) will update. Whenever that happens, you must save the updated keys (`authState.keys.set()` is called). Not doing so will prevent your messages from reaching the recipient & other unexpected consequences. The `useMultiFileAuthState` function automatically takes care of that, but for any other serious implementation -- you will need to be very careful with the key state management.