콘텐츠로 이동

RefreshOutcome — @gj-kit/expo-auth

@gj-kit/expo-auth에서 공개하는 type입니다. package version 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;
};

이 선언은 매개변수, optionality, 제네릭, 반환값, 공개 union/type 계약의 정본입니다. 호출 전 필요한 환경·권한·오류 경계는 패키지 Golden path와 이 subpath의 import 조건을 함께 확인하세요.

  • 패키지: @gj-kit/expo-auth
  • 버전: 0.1.1
  • 공개 entry: .
  • 소스: GitHub

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).