/** * Registration Helper Functions * * Pure helper functions for registration mode logic. * These functions have no side effects and can be used * on both server and client (where appropriate). */ import type { AuthConfig, RegistrationMode, PublicAuthConfig } from '../config/types'; /** * Check if public registration (self-signup) is allowed. * * Only 'open' mode allows unrestricted public registration. * 'domain-open' allows registration restricted to specific domains. * 'domain-restricted' allows registration only via Google OAuth for allowed domains. */ export declare function isRegistrationOpen(mode: RegistrationMode): boolean; /** * Check if an email domain is in the allowed domains list. * Returns false if allowedDomains is empty — callers should handle * the empty-list case separately (e.g., skip validation entirely). * * @param email - Full email address (e.g., "user@nextspark.dev") * @param allowedDomains - List of allowed domains without @ (e.g., ["nextspark.dev"]) * @returns true if the email domain is allowed */ export declare function isDomainAllowed(email: string, allowedDomains: string[]): boolean; /** * Check if Google OAuth should be enabled based on auth config. * * Google is disabled when: * - providers.google.enabled is explicitly false * - GOOGLE_CLIENT_ID env var is not set (runtime check, not done here) */ export declare function isGoogleAuthEnabled(authConfig: AuthConfig): boolean; /** * Check if the signup page should be accessible. * * Signup page is hidden for: * - 'domain-restricted': Registration happens via Google OAuth on login page * - 'invitation-only': Only accessible with valid invite params */ export declare function isSignupPageVisible(mode: RegistrationMode): boolean; /** * Check if email+password signup form should be shown. */ export declare function isEmailSignupEnabled(mode: RegistrationMode): boolean; /** * Check if signup should be blocked entirely (server-side enforcement). * * In 'domain-restricted' mode, email+password signup is blocked * but Google OAuth may be allowed (with domain check). * In 'domain-open' mode, email+password signup is allowed but domain is validated separately. */ export declare function shouldBlockSignup(mode: RegistrationMode, isOAuth: boolean): boolean; /** * Check if email+password login should be visible on the login page. * * In 'domain-restricted' mode, only Google OAuth is shown — email login is hidden * because new users cannot register via email and the UX is simplified to Google-only. * In 'domain-open' mode, email login is visible (domain validation happens server-side). */ export declare function isEmailLoginVisible(mode: RegistrationMode): boolean; /** * Build a PublicAuthConfig from the full AuthConfig. * Strips sensitive data (allowedDomains) for client exposure. */ export declare function getPublicAuthConfig(authConfig: AuthConfig): PublicAuthConfig; //# sourceMappingURL=registration-helpers.d.ts.map