import logIP from "@/app/www/media/logIP";
import validateMillis from "@/app/www/media/validateMillis";
import { getTotem } from "@/app/www/logic/avatar";

export const POST = logIP(
  validateMillis(async (req) => {
    const { avatarID, avatarCipher } = await req.json();

    const totem = await getTotem(avatarID, avatarCipher);
    if (totem) {
      return Response.json(totem);
    } else {
      return new Response(undefined, { status: 403 });
    }
  }),
);
