Files
chat-frontend/backend/app/core/security.py

14 lines
375 B
Python

from argon2 import PasswordHasher
from argon2.exceptions import VerifyMismatchError
ph = PasswordHasher()
def verify_password(plain_password: str, hashed_password: str) -> bool:
try:
return ph.verify(hashed_password, plain_password)
except VerifyMismatchError:
return False
def get_password_hash(password: str) -> str:
return ph.hash(password)