82 lines
2.6 KiB
TypeScript
82 lines
2.6 KiB
TypeScript
import { ConfigService } from '@nestjs/config';
|
|
import { JwtService } from '@nestjs/jwt';
|
|
import { Repository } from 'typeorm';
|
|
import { AuthOtp } from './entities/auth-otp.entity';
|
|
import { UserSession } from './entities/user-session.entity';
|
|
import { UserLevel } from '../users/enums/user-level.enum';
|
|
import { UserRole } from '../users/enums/user-role.enum';
|
|
import { UsersService } from '../users/users.service';
|
|
import { LoginPasswordDto } from './dto/login-password.dto';
|
|
import { RegisterPasswordDto } from './dto/register-password.dto';
|
|
import { SmsService } from './sms.service';
|
|
export declare class AuthService {
|
|
private readonly usersService;
|
|
private readonly jwtService;
|
|
private readonly configService;
|
|
private readonly smsService;
|
|
private readonly authOtpsRepository;
|
|
private readonly userSessionsRepository;
|
|
constructor(usersService: UsersService, jwtService: JwtService, configService: ConfigService, smsService: SmsService, authOtpsRepository: Repository<AuthOtp>, userSessionsRepository: Repository<UserSession>);
|
|
requestOtp(phone: string, fullName?: string): Promise<{
|
|
message: string;
|
|
expiresInSeconds: number;
|
|
phone: string;
|
|
smsSent: boolean;
|
|
otpPreview: string | undefined;
|
|
}>;
|
|
registerWithPassword(dto: RegisterPasswordDto): Promise<{
|
|
accessToken: string;
|
|
refreshToken: string;
|
|
user: {
|
|
id: string;
|
|
phone: string;
|
|
fullName: string;
|
|
role: UserRole;
|
|
level: UserLevel;
|
|
};
|
|
}>;
|
|
loginWithPassword(dto: LoginPasswordDto): Promise<{
|
|
accessToken: string;
|
|
refreshToken: string;
|
|
user: {
|
|
id: string;
|
|
phone: string;
|
|
fullName: string;
|
|
role: UserRole;
|
|
level: UserLevel;
|
|
};
|
|
}>;
|
|
verifyOtp(phone: string, otp: string): Promise<{
|
|
accessToken: string;
|
|
refreshToken: string;
|
|
user: {
|
|
id: string;
|
|
phone: string;
|
|
fullName: string;
|
|
role: UserRole;
|
|
level: UserLevel;
|
|
};
|
|
}>;
|
|
refreshToken(refreshToken: string): Promise<{
|
|
accessToken: string;
|
|
refreshToken: string;
|
|
user: {
|
|
id: string;
|
|
phone: string;
|
|
fullName: string;
|
|
role: UserRole;
|
|
level: UserLevel;
|
|
};
|
|
}>;
|
|
logout(userId: string): Promise<{
|
|
message: string;
|
|
}>;
|
|
private issueTokens;
|
|
private storeRefreshToken;
|
|
private generateOtp;
|
|
private resolvePermissions;
|
|
private findUserById;
|
|
private findMatchingSession;
|
|
private parseDurationToMs;
|
|
}
|