This commit is contained in:
roma-dxunvrs
2025-11-30 12:38:46 +03:00
commit 27466a255f
17 changed files with 250 additions and 0 deletions

17
app/utils/bcrypt_utils.py Normal file
View File

@@ -0,0 +1,17 @@
import bcrypt
def hash_password(
password: str
) -> bytes:
salt = bcrypt.gensalt()
pwd_bytes: bytes = password.encode()
return bcrypt.hashpw(pwd_bytes, salt)
def validate_password(
password: str,
hashed_password: bytes
) -> bool:
return bcrypt.checkpw(
password=password.encode(),
hashed_password=hashed_password
)