/** * RebaseBuiltinAuthAdapter * * Wraps Rebase's existing built-in JWT auth system (routes, middleware, user/role * management) into the `AuthAdapter` interface. This is the default adapter used * when the user passes a plain `RebaseAuthConfig` object. * * This is NOT a rewrite — it delegates to the existing `createAuthRoutes()`, * `createResetPasswordRoute()`, and `verifyAccessToken()` functions. The goal is to * present the same functionality through the pluggable `AuthAdapter` contract. */ import type { AuthAdapter } from "@rebasepro/types"; import type { AuthRepository, OAuthProvider } from "./interfaces"; import type { AuthHooks } from "./auth-hooks"; import type { EmailService, EmailConfig } from "../email"; /** * Configuration for the built-in Rebase auth adapter. * * This mirrors the existing `RebaseAuthConfig` — users pass this and * server-core auto-wraps it in a `RebaseBuiltinAuthAdapter`. */ export interface BuiltinAuthAdapterConfig { /** The bootstrapper-provided auth repository (users, roles, tokens). */ authRepository: AuthRepository; /** Email service for password resets, verification, etc. */ emailService?: EmailService; /** Email configuration. */ emailConfig?: EmailConfig; /** Whether to allow new user registration. */ allowRegistration?: boolean; /** Whether to expose the authenticated email→minimal-profile lookup route. */ allowUserLookup?: boolean; /** Default role to assign to new users. */ defaultRole?: string; /** OAuth providers to register. */ oauthProviders?: OAuthProvider[]; /** Static service key for server-to-server auth. */ serviceKey?: string; /** Auth hooks for customizing password, credentials, lifecycle, etc. */ authHooks?: AuthHooks; /** The parsed auth config from the collection (if `auth` is an object, not just `true`). */ collectionAuthConfig?: import("@rebasepro/types").AuthCollectionConfig; /** Enable magic link (passwordless email) login. Requires email service. */ enableMagicLink?: boolean; /** Opt-in httpOnly cookie mode for refresh tokens. */ cookieAuth?: import("./routes").CookieAuthConfig; } /** * Create the built-in Rebase auth adapter. * * This wraps the existing auth infrastructure (JWT, OAuth, user/role management) * into the `AuthAdapter` interface. It's used internally by `initializeRebaseBackend()` * when the user passes a plain `RebaseAuthConfig` object. */ export declare function createBuiltinAuthAdapter(config: BuiltinAuthAdapterConfig): AuthAdapter;