Skip to content

StorageAdapter

Storage adapter for persisting auth state.

Implements the same subset of the Web Storage interface used by the SDK (getItem, setItem, removeItem). This lets callers swap the default localStorage/in-memory storage for a custom store — most commonly a cookie-backed adapter for SSR frameworks (Next.js, SvelteKit, Nuxt) where the session must be read from an httpOnly cookie on the server.

import type { StorageAdapter } from '@nimbleflux/fluxbase-sdk'
const memoryAdapter: StorageAdapter = {
getItem: (k) => myMap.get(k) ?? null,
setItem: (k, v) => myMap.set(k, v),
removeItem: (k) => myMap.delete(k),
}

getItem(key): string | null

Parameter Type
key string

string | null


removeItem(key): void

Parameter Type
key string

void


setItem(key, value): void

Parameter Type
key string
value string

void