from fastapi import FastAPI from pydantic import BaseModel from rectes.redis_db import redis from rectes.utils import get_new_key app = FastAPI() class Secret(BaseModel): data: str @app.post("/secret") async def set_secret(data: Secret): new_key = await get_new_key() await redis.setex(new_key, 60 * 60 * 24, data.data) return { "status": "saved", "retrieval_url": f"/secret/{new_key}", }