Coverage for auth\hash_password.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.1.0, created at 2023-02-05 19:00 +0800

1from passlib.context import CryptContext 

2 

3pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") 

4 

5 

6class HashPassword: 

7 def create_hash(self, password: str) -> str: 

8 return pwd_context.hash(password) 

9 

10 def verify_hash(self, plain_password: str, hashed_password: str) -> bool: 

11 return pwd_context.verify(plain_password, hashed_password)