UNPKG

@wikiccu/nest-auth

Version:

A comprehensive authentication package for NestJS applications with Prisma and PostgreSQL

51 lines (50 loc) 2.57 kB
import { JwtService } from '@nestjs/jwt'; import { PrismaService } from './prisma.service'; import { EmailService } from './email.service'; import { PasswordService } from './password.service'; import { TokenService } from './token.service'; import { ConfigService } from '@nestjs/config'; import { AuthUser, LoginResponse, RegisterResponse, PasswordResetResponse, EmailVerificationResponse, RefreshTokenResponse, CreateUserDto, UpdateUserDto, LoginDto, ForgotPasswordDto, ResetPasswordDto, ChangePasswordDto, VerifyEmailDto, ResendVerificationDto, RefreshTokenDto, LogoutDto, SessionInfo } from '../types'; import { RegisterDto } from '../dto/auth.dto'; export declare class AuthService { private readonly prisma; private readonly jwtService; private readonly emailService; private readonly passwordService; private readonly tokenService; private readonly configService; constructor(prisma: PrismaService, jwtService: JwtService, emailService: EmailService, passwordService: PasswordService, tokenService: TokenService, configService: ConfigService); register(registerDto: RegisterDto): Promise<RegisterResponse>; login(loginDto: LoginDto, sessionInfo?: SessionInfo): Promise<LoginResponse>; refreshToken(refreshTokenDto: RefreshTokenDto): Promise<RefreshTokenResponse>; logout(logoutDto: LogoutDto): Promise<{ message: string; }>; forgotPassword(forgotPasswordDto: ForgotPasswordDto): Promise<PasswordResetResponse>; resetPassword(resetPasswordDto: ResetPasswordDto): Promise<{ message: string; }>; changePassword(userId: string, changePasswordDto: ChangePasswordDto): Promise<{ message: string; }>; verifyEmail(verifyEmailDto: VerifyEmailDto): Promise<EmailVerificationResponse>; resendVerification(resendVerificationDto: ResendVerificationDto): Promise<EmailVerificationResponse>; getProfile(userId: string): Promise<AuthUser>; updateProfile(userId: string, updateUserDto: UpdateUserDto): Promise<AuthUser>; createUser(createUserDto: CreateUserDto): Promise<AuthUser>; updateUser(userId: string, updateUserDto: UpdateUserDto): Promise<AuthUser>; deleteUser(userId: string): Promise<{ message: string; }>; getUsers(page?: number, limit?: number): Promise<{ users: AuthUser[]; total: number; page: number; limit: number; }>; private generateAccessToken; private getTokenExpirationTime; private sendEmailVerification; private sendPasswordResetEmail; private mapToAuthUser; }