arvox-backend
Version:
Un framework backend moderne et modulaire basé sur Hono, TypeScript et l'architecture hexagonale avec authentification Better Auth + Drizzle intégrée
130 lines • 3.49 kB
TypeScript
import type { Context, Next } from 'hono';
/**
* Configuration pour Better Auth
*/
export interface AuthConfig {
secret: string;
baseURL: string;
trustedOrigins?: string[];
database?: {
provider?: 'postgresql' | 'mysql' | 'sqlite';
schema?: any;
};
emailAndPassword?: {
enabled?: boolean;
requireEmailVerification?: boolean;
minPasswordLength?: number;
maxPasswordLength?: number;
};
socialProviders?: {
github?: {
clientId: string;
clientSecret: string;
};
google?: {
clientId: string;
clientSecret: string;
};
discord?: {
clientId: string;
clientSecret: string;
};
facebook?: {
clientId: string;
clientSecret: string;
};
twitter?: {
clientId: string;
clientSecret: string;
};
apple?: {
clientId: string;
clientSecret: string;
};
microsoft?: {
clientId: string;
clientSecret: string;
};
};
session?: {
expiresIn?: number;
updateAge?: number;
cookieCache?: boolean;
};
plugins?: any[];
callbacks?: {
signIn?: (user: any, account: any) => Promise<boolean> | boolean;
signUp?: (user: any) => Promise<boolean> | boolean;
session?: (session: any, user: any) => Promise<any> | any;
};
advanced?: {
generateId?: () => string;
crossSubDomainCookies?: {
enabled: boolean;
domain: string;
};
useSecureCookies?: boolean;
rateLimit?: {
enabled: boolean;
requests: number;
window: number;
};
};
}
/**
* Types pour les contextes d'authentification
*/
export interface AuthContext extends Context {
get(key: 'user'): any | undefined;
get(key: 'session'): any | undefined;
set(key: 'user', value: any): void;
set(key: 'session', value: any): void;
}
/**
* Middleware d'authentification
*/
export type AuthMiddleware = (c: AuthContext, next: Next) => Promise<Response | void>;
/**
* Configuration pour le générateur Drizzle
*/
export interface DrizzleGeneratorConfig {
database: {
provider: 'postgresql' | 'mysql' | 'sqlite';
url: string;
authToken?: string;
};
output: {
schema: string;
migrations: string;
client: string;
};
tables?: {
user?: boolean;
session?: boolean;
account?: boolean;
verificationToken?: boolean;
passwordResetToken?: boolean;
};
customFields?: {
user?: Record<string, any>;
session?: Record<string, any>;
account?: Record<string, any>;
};
}
/**
* Utilitaires d'authentification
*/
export interface AuthUtils {
createUser: (data: any) => Promise<any>;
signIn: (data: any) => Promise<any>;
signOut: (data: any) => Promise<any>;
getSession: (data: any) => Promise<any>;
verifyEmail: (data: any) => Promise<any>;
forgetPassword: (data: any) => Promise<any>;
resetPassword: (data: any) => Promise<any>;
linkSocialAccount: (data: any) => Promise<any>;
unlinkSocialAccount: (data: any) => Promise<any>;
updateUser: (data: any) => Promise<any>;
deleteUser: (data: any) => Promise<any>;
}
//# sourceMappingURL=auth.type.d.ts.map