UNPKG

nest-authify

Version:

Complete authentication and authorization package for NestJS - Monolith and Microservices ready with OAuth, JWT, Redis sessions

21 lines (20 loc) 1.05 kB
import { JwtService } from '@nestjs/jwt'; import { ISessionStore } from '../core/interfaces/session-store.interface'; import { AuthSession, JwtPayload } from '../core/types/auth-session.interface'; export declare abstract class BaseAuthService { protected readonly jwtService: JwtService; protected readonly sessionStore?: ISessionStore; constructor(jwtService: JwtService, sessionStore?: ISessionStore); protected generateSessionId(): string; createJwt(user: any, expiresIn?: string, sessionId?: string): Promise<string>; createRefreshToken(user: any, expiresIn?: string, sessionId?: string): Promise<string>; createSession(user: any, options?: any): Promise<AuthSession>; verifyToken(token: string): Promise<JwtPayload>; refreshAccessToken(refreshToken: string): Promise<{ accessToken: string; }>; revokeSession(sessionId: string): Promise<void>; revokeAllUserSessions(userId: string): Promise<void>; private parseTTL; protected abstract getUserById(userId: string): Promise<any>; }