Files
qtalker---/backend/app/security.py

16 lines
368 B
Python

from argon2 import PasswordHasher
from argon2.exceptions import VerificationError
_hasher = PasswordHasher()
def hash_password(password: str) -> str:
return _hasher.hash(password)
def verify_password(password: str, password_hash: str) -> bool:
try:
return _hasher.verify(password_hash, password)
except VerificationError:
return False