add user password hasher and depebdency
This commit is contained in:
0
api/infrastructure/security/__init__.py
Normal file
0
api/infrastructure/security/__init__.py
Normal file
13
api/infrastructure/security/password_hasher.py
Normal file
13
api/infrastructure/security/password_hasher.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from passlib.handlers.pbkdf2 import pbkdf2_sha256
|
||||
|
||||
from api.application.protocols.password_hasher import PasswordHasher
|
||||
|
||||
|
||||
class Pbkdf2PasswordHasher(PasswordHasher):
|
||||
@staticmethod
|
||||
def hash_password(password: str) -> str:
|
||||
return pbkdf2_sha256.hash(password)
|
||||
|
||||
@staticmethod
|
||||
def verify_password(password: str, hashed_password: str) -> bool:
|
||||
return pbkdf2_sha256.verify(password, hashed_password)
|
Reference in New Issue
Block a user