Download backend/app/core/security.py from andevs/editzz: direct link, hf CLI and curl.
- Browser
- Download file 399 Bytes
-
https://huggingface.co/spaces/andevs/editzz/resolve/main/backend/app/core/security.py
- Command line
-
hf download hf://spaces/andevs/editzz/backend/app/core/security.py
-
curl -L -o security.py https://huggingface.co/spaces/andevs/editzz/resolve/main/backend/app/core/security.py
399 Bytes
| 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") | |