Session restoration and routing
Drive navigation from SDK state, not JWT decoding or Redux credentials.
Startup and foreground
Provider initializes once. Non-React consumers can call initialize explicitly, then resume when foregrounded. SDK serializes refresh rotation, clears expired challenges and fences old sessions. A restored session is not independent proof of server-side validity.
await auth.initialize();
const state = auth.getSnapshot();
// On foreground outside AuthProvider:
await auth.resume();Route state machine
uninitialized: splash; signed-out: public screens; mfa-required: verification; recovery-required: authenticator replacement; authenticated: profile/PIN bootstrap and protected app; error: restoration failure with explicit retry. Use generated Expo Router paths for the actual app. Route protection is not server authorization.
const session = useSession();
const canEnterApp = session.status === "authenticated" && localPinPolicySatisfied;Account isolation
Clear RTK Query or other account-scoped caches when userId/sessionId changes. Do not reuse wallet instances. SDK has no background refresh timers. An uncertain refresh rotation may require login again; do not retry a consumed refresh token.