import jwt
import time

# 🔐 Chaves consistentes e seguras com o docker-compose
api_key = "devkey"
api_secret = "Wd93fG7mZqtLxJKeB5yNcVu2QXwPgRaA6TYKhEZ0MnsUobvJ3cLF18rD9AxGt4yW"  # ✔️ mínimo 32 caracteres

room_name = "sala_teste"
identity = "GRFAdmin"
agora = int(time.time())

payload = {
    "iss": api_key,
    "sub": identity,
    "aud": "livekit",
    "nbf": agora,
    "exp": agora + 3600,  # válido por 1 hora
    "room": room_name,
    "video": {
        "roomCreate": True,
        "canPublish": True,
        "canSubscribe": True
    }
}

token = jwt.encode(payload, api_secret, algorithm="HS256")
print(token)
