12 lines
329 B
TypeScript
12 lines
329 B
TypeScript
|
|
import * as bcrypt from 'bcrypt'
|
||
|
|
|
||
|
|
export class PasswordUtil {
|
||
|
|
static async hash(password: string, saltRounds = 10): Promise<string> {
|
||
|
|
return bcrypt.hash(password, saltRounds)
|
||
|
|
}
|
||
|
|
|
||
|
|
static async compare(password: string, hashedPassword: string): Promise<boolean> {
|
||
|
|
return bcrypt.compare(password, hashedPassword)
|
||
|
|
}
|
||
|
|
}
|