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.
Methods
Section titled “Methods”clearTokens()
Section titled “clearTokens()”clearTokens():
Promise<void>
Defined in: packages/auth/src/adapters/TokenStorageAdapter.ts:25
Removes the persisted tokens. Idempotent — no-op when absent.
Returns
Section titled “Returns”Promise<void>
getTokens()
Section titled “getTokens()”getTokens():
Promise<AuthTokens|null>
Defined in: packages/auth/src/adapters/TokenStorageAdapter.ts:21
Returns the persisted tokens, or null when no entry exists.
Returns
Section titled “Returns”Promise<AuthTokens | null>
setTokens()
Section titled “setTokens()”setTokens(
tokens):Promise<void>
Defined in: packages/auth/src/adapters/TokenStorageAdapter.ts:23
Persists the tokens, overwriting any existing entry.
Parameters
Section titled “Parameters”tokens
Section titled “tokens”Returns
Section titled “Returns”Promise<void>