@wikiccu/nest-auth
Version:
A comprehensive authentication package for NestJS applications with Prisma and PostgreSQL
113 lines (112 loc) • 2.41 kB
TypeScript
export interface AuthUser {
id: string;
email: string;
username?: string;
firstName?: string;
lastName?: string;
isEmailVerified: boolean;
isActive: boolean;
roles: string[];
permissions: string[];
}
export interface JwtPayload {
sub: string;
email: string;
username?: string;
roles: string[];
permissions: string[];
iat?: number;
exp?: number;
}
export interface LoginResponse {
user: AuthUser;
accessToken: string;
refreshToken: string;
expiresIn: number;
}
export interface RegisterResponse {
user: AuthUser;
message: string;
}
export interface PasswordResetResponse {
message: string;
}
export interface EmailVerificationResponse {
message: string;
}
export interface RefreshTokenResponse {
accessToken: string;
refreshToken: string;
expiresIn: number;
}
export interface AuthConfig {
jwtSecret: string;
jwtExpiresIn: string;
refreshTokenExpiresIn: string;
passwordResetTokenExpiresIn: string;
emailVerificationTokenExpiresIn: string;
bcryptRounds: number;
maxLoginAttempts: number;
lockoutDuration: number;
emailFrom: string;
emailFromName: string;
frontendUrl: string;
}
export interface EmailTemplate {
subject: string;
html: string;
text: string;
}
export interface RateLimitConfig {
windowMs: number;
maxRequests: number;
message: string;
}
export interface SessionInfo {
ipAddress?: string;
userAgent?: string;
}
export interface CreateUserDto {
email: string;
password: string;
username?: string;
firstName?: string;
lastName?: string;
roles?: string[];
}
export interface UpdateUserDto {
email?: string;
username?: string;
firstName?: string;
lastName?: string;
isActive?: boolean;
roles?: string[];
}
export interface ChangePasswordDto {
currentPassword: string;
newPassword: string;
}
export interface ForgotPasswordDto {
email: string;
}
export interface ResetPasswordDto {
token: string;
newPassword: string;
}
export interface VerifyEmailDto {
token: string;
}
export interface ResendVerificationDto {
email: string;
}
export interface LoginDto {
email: string;
password: string;
rememberMe?: boolean;
}
export interface RefreshTokenDto {
refreshToken: string;
}
export interface LogoutDto {
refreshToken: string;
}