| from passlib.context import CryptContext | |
| from jose import jwt | |
| from datetime import datetime, timedelta | |
| from app.core.config import JWT_SECRET | |
| pwd = CryptContext(schemes=["bcrypt"]) | |
| def hash_password(p): return pwd.hash(p) | |
| def verify(p, h): return pwd.verify(p, h) | |
| def create_token(data): | |
| return jwt.encode({**data, "exp": datetime.utcnow()+timedelta(days=7)}, JWT_SECRET, algorithm="HS256") | |