Skip to main content

Session Storage

This guide covers session persistence so users don’t need to re-authenticate on every visit using the Privacy Boost React SDK. For the conceptual overview, see Key Management.

Built-In Persistence

Configure persistence in the provider:
<PrivacyBoostProvider
  config={{
    appId: 'your-app-id',
    indexerUrl: 'https://...',
    persistence: {
      storage: 'localStorage',
      unlock: 'pin',
    },
  }}
>
  <App />
</PrivacyBoostProvider>
With persistence enabled, returning users don’t see wallet popups — the SDK loads stored keys.

Logout

MethodWhat it doesNext login
clearSession()Clears auth token, keeps keys in memoryFast — no wallet popups
logout()Clears everything (keys, token, connection)Full re-auth with wallet popups
import { useAuth } from '@testinprod-io/privacy-boost-react';

function LogoutButtons() {
  const { clearSession, logout } = useAuth();

  return (
    <div>
      <button onClick={clearSession}>Switch Account</button>
      <button onClick={logout}>Full Logout</button>
    </div>
  );
}

Next Steps