Files
dmail-api/src/modules/utils/services/password.service.ts
T
morteza 1f1ab7c85d
Build and Deploy Docker Images / build_and_deploy (push) Has been cancelled
remove bucrypt
2026-05-31 15:50:06 +03:30

16 lines
434 B
TypeScript
Executable File

import { Injectable } from "@nestjs/common";
import * as bcrypt from "bcryptjs";
@Injectable()
export class PasswordService {
private readonly saltRounds = 12;
async hashPassword(password: string): Promise<string> {
return bcrypt.hash(password, this.saltRounds);
}
async comparePasswords(plainPassword: string, hashedPassword: string): Promise<boolean> {
return bcrypt.compare(plainPassword, hashedPassword);
}
}