<?php
/**
 * CSRF token generation endpoint
 */
require_once 'CsrfProtection.php';

header('Content-Type: application/json');

try {
    $token = CsrfProtection::generateToken();
    echo json_encode(['token' => $token]);
} catch (Exception $e) {
    http_response_code(500);
    echo json_encode(['error' => 'Failed to generate CSRF token']);
}
?>
