forked from Yara724/api
Initial commit after migration to gitea
This commit is contained in:
14
src/utils/hash/hash.service.ts
Normal file
14
src/utils/hash/hash.service.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import * as bcrypt from "bcrypt";
|
||||
|
||||
@Injectable()
|
||||
export class HashService {
|
||||
async hash(password: string): Promise<string> {
|
||||
const salt = await bcrypt.genSalt(10);
|
||||
return bcrypt.hash(password, salt);
|
||||
}
|
||||
|
||||
async compare(password: string, hash: string) {
|
||||
return bcrypt.compare(password, hash);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user