Previously each authclient only supported GET /api/session/validate - the "just gate requests behind a valid session" case. A service that runs its own login/register/admin-user-management screens proxied to AuthGuard (GameStream's pattern, now also used by InfiniteVideo and OutdoorGames) needs much more: register, login, logout, me, totp_enable/verify/disable, password-reset request/confirm, and managed-user list/create/update/delete. The Go client already had this full surface from GameStream's original migration; Python and Node only had validate(), so both gained the same method set as Go, mirroring its behavior and JSON wire shapes exactly (register/login/logout return the raw Set-Cookie values to forward, totp_required surfaces on a 401 from login, etc). Also adds a SetupStatus/ setup_status/setupStatus method (GET /api/setup-status) so a service's own first-launch flow can tell whether AuthGuard already has an account before showing its own account-creation form, and adds totp_enabled to the Go client's PublicUser (AuthGuard has reported it for a while; the client just hadn't picked it up). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
35 lines
704 B
JavaScript
35 lines
704 B
JavaScript
export {
|
|
databaseConfigFromEnv,
|
|
databaseUrlFromEnv,
|
|
DATABASE_DEFAULTS,
|
|
} from './config.js';
|
|
export {
|
|
Database,
|
|
createDatabaseFromEnv,
|
|
isTransientConnectionError,
|
|
} from './db.js';
|
|
export {
|
|
AUTH_SCHEMA,
|
|
AuthStore,
|
|
RESET_CODE_TTL_MS,
|
|
ResetManager,
|
|
createSessionToken,
|
|
hashPassword,
|
|
hashToken,
|
|
USER_ROLES,
|
|
canAssignRole,
|
|
canManageUsers,
|
|
normalizeRole,
|
|
verifyPassword,
|
|
} from './auth.js';
|
|
export {
|
|
TOTP_DIGITS,
|
|
TOTP_PERIOD_SECONDS,
|
|
TOTP_WINDOW,
|
|
generateTotpSecret,
|
|
totpProvisioningUri,
|
|
verifyTotp,
|
|
} from './totp.js';
|
|
export { runMigrations } from './migrate.js';
|
|
export { APIError, AuthClient, InvalidSessionError, createAuthClient } from './authclient.js';
|