Files
g-butandClaude Opus 4.5 1c7abeebac docs(claude): add global standards reference and update date
- Add @~/.claude/CLAUDE.md import for global engineering standards
- Update Last Updated date to 2026-01-23

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 15:22:36 +01:00

33 lines
872 B
TypeScript

import { createErrorResponse } from '@/lib/schemas/errors';
const API_KEY = process.env.API_KEY || 'development-key';
export async function validateApiKey(req: Request) {
// Skip validation during build time or static generation
if (
process.env.NEXT_PHASE === 'phase-production-build' ||
process.env.NEXT_PHASE === 'phase-static-generation'
) {
return;
}
const apiKey = req.headers.get('x-api-key');
if (!apiKey) {
return new Response(
JSON.stringify(createErrorResponse('API key is required', 'UNAUTHORIZED')),
{
status: 401,
headers: { 'Content-Type': 'application/json' },
},
);
}
if (apiKey !== API_KEY) {
return new Response(JSON.stringify(createErrorResponse('Invalid API key', 'UNAUTHORIZED')), {
status: 401,
headers: { 'Content-Type': 'application/json' },
});
}
}