Skip to content

RefreshOutcome — @gj-kit/expo-auth

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

import { RefreshOutcome } from '@gj-kit/expo-auth';
/**
* The five endings of `refresh()` (design §3.4). The library cleans storage where required but
* never navigates or resets app state — that is the caller's decision.
*
* - `'refreshed'`: this instance performed the rotation. Persisted and rescheduled.
* - `'adopted'`: storage now holds a valid pair **different** from the entry snapshot and that
* pair was adopted (H2·H2b). Rescheduled. ⚠ Adoption does NOT guarantee the same subject —
* another tab's signOut→sign-in-as-someone-else also appears as `'adopted'`. Hosts where
* account switching is possible must re-confirm the subject (e.g. re-fetch /me) after
* adopting (§7-13).
* - `'signed-out'`: storage holds no refresh token (already signed out).
* - `'invalid'`: a definitive server rejection. `tokensCleared` follows the H3 discipline —
* `true` only when the attempted token was still the stored one. The caller decides whether
* to navigate to the sign-in screen.
* - `'transient'`: undecidable. Tokens are preserved — never a sign-out (H1). `cause` carries
* the value thrown by the refresh callback (§3.3 fail-safe diagnostics channel), or is
* `undefined` when the callback reported `'transient'` normally. Retry policy belongs to the
* caller (React Query and friends).
*/
type RefreshOutcome = {
readonly status: 'refreshed';
readonly tokens: TokenPair;
} | {
readonly status: 'adopted';
readonly tokens: TokenPair;
} | {
readonly status: 'signed-out';
} | {
readonly status: 'invalid';
readonly tokensCleared: boolean;
} | {
readonly status: 'transient';
readonly cause?: unknown;
};

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