UNPKG

@katalysttech/auth

Version:

A flexible authentication module for NestJS applications with JWT and refresh token support

28 lines (27 loc) 1.42 kB
import { JwtService } from "@nestjs/jwt"; import { AuthOptions, AuthTokens, PasswordResetPayload } from "./interfaces"; import { PasswordService } from "./services/password.service"; import { RefreshTokenService } from "./services/refresh-token.service"; export declare class AuthService { private readonly options; private readonly jwtService; private readonly passwordService; private readonly refreshTokenService; constructor(options: AuthOptions, jwtService: JwtService, passwordService: PasswordService, refreshTokenService: RefreshTokenService); login(username: string, password: string): Promise<AuthTokens>; loginWithLinkedIn(email: string, linkedInId: string): Promise<AuthTokens>; loginWithGoogle(email: string, googleId: string): Promise<AuthTokens>; refreshToken(refreshToken: string): Promise<AuthTokens>; validateToken(token: string): Promise<any>; private generateTokens; private getExpiresInSeconds; logout(refreshToken: string): Promise<void>; logoutAll(userId: string | number): Promise<void>; getActiveSessions(userId: string | number): Promise<any[]>; revokeSession(userId: string | number, sessionId: string): Promise<void>; generatePasswordResetToken(payload: PasswordResetPayload): Promise<{ resetToken: string; expiresIn: number; }>; resetPassword(resetToken: string, newPassword: string): Promise<void>; }