Agents / core /auth.py
Skydata001's picture
Create core/auth.py
ac9cdec verified
Raw
History Blame Contribute Delete
419 Bytes
"""
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])