Spaces:
Paused
Paused
File size: 419 Bytes
ac9cdec | 1 2 3 4 5 6 7 8 9 10 11 12 13 | """
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]) |