Skip to Content

Shared types

Serializable authentication snapshots, inputs, user data, and results exposed by the shared entry point.

The @puzzle-ui/fullstack/auth/shared subpath contains data-only TypeScript contracts used across browser and server code. It has no runtime exports, so import these types when defining app boundaries or passing auth state between runtimes. The client entry point re-exports most client-facing contracts; AuthClientLifecycleResult is available from this shared subpath.

Install

npm install @puzzle-ui/fullstack react react-dom

React and React DOM 19 are required peers by the package, including when you only consume shared types.

Import types

import type {
  AuthClientSnapshot,
  AuthClientStatus,
  AuthClientUser,
  AuthClientRegisterInput,
  AuthClientLifecycleResult,
} from "@puzzle-ui/fullstack/auth/shared";

Contracts

TypeDescription
AuthClientStatusUI state: loading, unauthenticated, MFA or enrollment pending states, step-up-pending, or authenticated.
AuthClientUserPublic user fields: id, email, nullable name and image, and emailVerified.
AuthClientMfaStatePending MFA purpose, challenge ID, expiry, and optional available factor types.
AuthClientOptionsBrowser client basePath, fetch credentials, and optional fetcher.
AuthClientSnapshotstatus, public user or null, and optional MFA state.
AuthClientSignInInputEmail and password sign-in fields.
AuthClientRegisterInputEmail, password, and optional nullable name.
AuthClientMfaFactorFactor ID, type, status, label, creation time, and last-use time.
AuthClientTotpEnrollmentTOTP enrollment status, factor ID, secret, otpauthUrl, and expiry. Treat the secret as sensitive.
AuthClientEnrollmentResultAdded factor and one-time recovery codes. Display and store recovery codes securely.
AuthClientRecoveryCodesResultNewly regenerated recovery codes.
AuthClientFactorListActive/pending factors and recovery-code count.
AuthClientLifecycleResultStatus for verification request/completion and password reset/change results.

These are public response contracts, not proof that a user is authorized for an operation. Enforce access control on the server and avoid exposing enrollment secrets or recovery codes beyond the authenticated flow.

Exports

Type-only exports: AuthClientStatus, AuthClientUser, AuthClientMfaState, AuthClientOptions, AuthClientSnapshot, AuthClientSignInInput, AuthClientRegisterInput, AuthClientMfaFactor, AuthClientTotpEnrollment, AuthClientEnrollmentResult, AuthClientRecoveryCodesResult, AuthClientFactorList, and AuthClientLifecycleResult.

See the client API for provider and browser usage, or the server handlers for server-side contracts.