Spaces:
Paused
Paused
| """ | |
| Authentication utilities | |
| """ | |
| from jose import jwt | |
| from passlib.context import CryptContext | |
| pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") | |
| def create_token(data: dict, secret: str, algorithm: str = "HS256"): | |
| return jwt.encode(data, secret, algorithm=algorithm) | |
| def verify_token(token: str, secret: str, algorithm: str = "HS256"): | |
| return jwt.decode(token, secret, algorithms=[algorithm]) |