Spaces:
Build error
Build error
File size: 1,011 Bytes
1bd7131 e39877e 1bd7131 e39877e 1bd7131 e39877e 1bd7131 e39877e 1bd7131 e39877e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
"""
Core Security Utilities
Note: Secret key authentication has been replaced with Google OAuth.
The bcrypt functions below are kept for potential future use (e.g., admin passwords).
"""
import bcrypt
def verify_password(plain_password: str, hashed_password: str) -> bool:
"""
Verify a password against a bcrypt hash.
Note: This is no longer used for user authentication (moved to Google OAuth).
Kept for potential admin/internal use cases.
"""
if isinstance(hashed_password, str):
hashed_password = hashed_password.encode('utf-8')
return bcrypt.checkpw(plain_password.encode('utf-8'), hashed_password)
def get_password_hash(password: str) -> str:
"""
Hash a password using bcrypt.
Note: This is no longer used for user authentication (moved to Google OAuth).
Kept for potential admin/internal use cases.
"""
salt = bcrypt.gensalt(rounds=12)
hashed = bcrypt.hashpw(password.encode('utf-8'), salt)
return hashed.decode('utf-8')
|