Initial commit
This commit is contained in:
15
src/shared/infrastructure/crypto/BcryptService.ts
Normal file
15
src/shared/infrastructure/crypto/BcryptService.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import bcrypt from "bcrypt";
|
||||
import { uuidv7 } from "uuidv7";
|
||||
import type { ICryptoService } from "@/shared/application/ports/ICryptoService.js";
|
||||
|
||||
export class BcryptService implements ICryptoService {
|
||||
hashPassword(password: string): Promise<string> {
|
||||
return bcrypt.hash(password, 10);
|
||||
}
|
||||
comparePassword(password: string, hash: string): Promise<boolean> {
|
||||
return bcrypt.compare(password, hash);
|
||||
}
|
||||
randomId(): string {
|
||||
return uuidv7();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user