Files
gridpilot.gg/apps/website/lib/auth/AuthService.ts
2025-12-07 18:38:03 +01:00

36 lines
982 B
TypeScript

import type { AuthenticatedUserDTO } from '@gridpilot/identity/application/dto/AuthenticatedUserDTO';
import type { AuthSessionDTO } from '@gridpilot/identity/application/dto/AuthSessionDTO';
export type AuthUser = AuthenticatedUserDTO;
export type AuthSession = AuthSessionDTO;
export interface SignupParams {
email: string;
password: string;
displayName: string;
}
export interface LoginParams {
email: string;
password: string;
}
export interface AuthService {
getCurrentSession(): Promise<AuthSession | null>;
// Email/password authentication
signupWithEmail(params: SignupParams): Promise<AuthSession>;
loginWithEmail(params: LoginParams): Promise<AuthSession>;
// iRacing OAuth (demo)
startIracingAuthRedirect(
returnTo?: string,
): Promise<{ redirectUrl: string; state: string }>;
loginWithIracingCallback(params: {
code: string;
state: string;
returnTo?: string;
}): Promise<AuthSession>;
logout(): Promise<void>;
}