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