Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

493 B
Raw Blame
import type { Context, Next } from "hono";
import { ApiError } from "../errors/api-error";

/** Sensitive account operations cannot inherit the owner's privileges from an API key. */
export async function requireUserSession(c: Context, next: Next) {
  if (c.get("apiKey") || !c.get("session") || !c.get("user")) {
    throw new ApiError(403, {
      message: "A user session is required",
      code: "SESSION_REQUIRED",
    });
  }
  c.header("Cache-Control", "no-store");
  return next();
}