/**
 * POST /api/auth/check — validate an X-Forge-Token.
 *
 * Used by other Forge processes (e.g. bridge-standalone) to verify a
 * token without re-implementing the token store. Returns 200 on valid,
 * 401 otherwise. Body is ignored — the token must be in the
 * X-Forge-Token header (or forge-api-token cookie).
 */

import { NextResponse } from 'next/server';
import { isValidToken } from '../verify/route';

export async function POST(req: Request) {
  if (!isValidToken(req)) {
    return NextResponse.json({ ok: false }, { status: 401 });
  }
  return NextResponse.json({ ok: true });
}
