chore: first commit
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import * as bcrypt from "bcrypt";
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user