Skip to content

TokenStorage — @gj-kit/expo-auth

A public interface from @gj-kit/expo-auth. The signature below is taken directly from the 0.1.1 release declaration.

import { TokenStorage } from '@gj-kit/expo-auth';
/**
* Storage seam (design §3.1). Implementation contract:
*
* - `getTokens` returns a pair only when BOTH tokens are present; half states converge to
* `null` (H12 — a torn write reads as "signed out", never as corrupt data).
* - `getTokens` **freshness**: inside the refresh critical section (§3.5) a read must reflect
* the last write committed by any other tab/instance — the precondition of the H2b adoption
* and the H3 comparison. An in-memory cache is only allowed where no external writer exists
* (native single process — §3.8); the web implementation is read-through.
* - `setTokens` with `persistence` omitted keeps the current mode (H14 — a rotation after a
* session login must not silently promote tokens to durable). The initial default is
* implementation-defined.
* - `clearTokens` is idempotent and resets the persistence mode to the implementation default.
* - No method may throw an error whose message contains a token string (§4.2).
*/
interface TokenStorage {
getTokens(): Promise<TokenPair | null>;
setTokens(tokens: TokenPair, options?: {
readonly persistence?: TokenPersistence | undefined;
}): Promise<void>;
clearTokens(): Promise<void>;
}

This declaration is the source of truth for parameters, optionality, generics, return values, and public union/type contracts. Check the package golden path and this subpath’s import conditions for required environment, permission, and error boundaries before calling it.

  • Package: @gj-kit/expo-auth
  • Version: 0.1.1
  • Public entry: .
  • Source: GitHub