import { type H3Event } from 'h3'; import { type DatabaseType } from '../db.js'; import { type SqlExecutor } from '../orchestration-schema.js'; export type OAuthProvider = 'google' | 'github'; export type OAuthTempSession = { provider: OAuthProvider; state: string; codeVerifier: string; redirect: string; redirectOrigin?: string; createdAt: string; }; export type PublicUser = { id: string; enterprise_uuid: string; enterprise_name: string; name: string; email: string; plan: string; }; export type OAuthProfile = { provider: OAuthProvider; providerUserId: string; email: string; emailVerified: boolean; name: string; raw: Record; }; export type OAuthRegistration = { enterpriseName: string; name: string; email: string; passwordHash: string; provider: OAuthProvider; providerUserId: string; providerEmail: string; emailVerified: boolean; profile: Record; }; export declare const oauthSessionKey = "oauth"; export declare function normalizeOAuthProvider(value: unknown): OAuthProvider; export declare function normalizeRelativeRedirect(value: unknown, fallback?: string): string; export declare function normalizeOAuthRedirectOrigin(event: H3Event, value: unknown): string | undefined; export declare function configuredOAuthAppOrigin(): string; export declare function oauthFinalRedirectUrl(session: OAuthTempSession): string; export declare function oauthLoginRedirectUrl(errorCode: string, session?: OAuthTempSession): string; export declare function oauthClientId(provider: OAuthProvider): string; export declare function oauthClientSecret(provider: OAuthProvider): string; export declare function oauthCallbackUrl(event: H3Event, provider: OAuthProvider): string; export declare function defaultOAuthScopes(provider: OAuthProvider): string[]; export declare function randomOAuthValue(byteLength?: number): string; export declare function pkceChallenge(codeVerifier: string): string; export declare function providerAuthorizeUrl(provider: OAuthProvider): string; export declare function storeOAuthTempSession(event: H3Event, session: OAuthTempSession): void; export declare function consumeOAuthTempSession(event: H3Event): OAuthTempSession; export declare function exchangeOAuthCode(provider: OAuthProvider, code: string, codeVerifier: string, redirectUri: string): Promise; export declare function googleProfileFromTokenResponse(tokenResponse: unknown): OAuthProfile; export declare function githubProfileFromTokenResponse(tokenResponse: unknown): Promise; export declare function resolveOAuthUser(executeSql: SqlExecutor, profile: OAuthProfile, autoCreateEnterprise: boolean, databaseTypeValue?: DatabaseType, deferNewUserProvisioning?: boolean): Promise<{ user: PublicUser; isNewUser: boolean; linkedIdentity: boolean; requiresRegistration: boolean; registration: null; } | { user: null; isNewUser: boolean; linkedIdentity: boolean; requiresRegistration: boolean; registration: OAuthRegistration; }>; export declare function linkOAuthIdentity(executeSql: SqlExecutor, employeeId: string, profile: OAuthProfile, databaseTypeValue?: DatabaseType): Promise<{ user: PublicUser; linkedIdentity: boolean; }>;