Skip to content

TokenStorageAdapter

Defined in: packages/auth/src/adapters/TokenStorageAdapter.ts:19

Atomic, async storage abstraction for AuthTokens. Consumers wire a concrete implementation at client construction time so the SDK stays platform-agnostic.

Methods are async even when a particular runtime offers a synchronous equivalent (e.g. cookies). React Native’s storage APIs are intrinsically async; mirroring that contract avoids leaking platform differences into the SDK surface.

The adapter operates on the full AuthTokens value as a single unit — setTokens is atomic, getTokens returns either all three fields or null.

clearTokens(): Promise<void>

Defined in: packages/auth/src/adapters/TokenStorageAdapter.ts:25

Removes the persisted tokens. Idempotent — no-op when absent.

Promise<void>


getTokens(): Promise<AuthTokens | null>

Defined in: packages/auth/src/adapters/TokenStorageAdapter.ts:21

Returns the persisted tokens, or null when no entry exists.

Promise<AuthTokens | null>


setTokens(tokens): Promise<void>

Defined in: packages/auth/src/adapters/TokenStorageAdapter.ts:23

Persists the tokens, overwriting any existing entry.

AuthTokens

Promise<void>