getOption('site_id', null, 'lettersail'));
$challenge = (new Altcha(hmacSignatureSecret: $secret))->createChallenge(
new CreateChallengeOptions(
algorithm: new Pbkdf2(),
cost: 2000,
counter: random_int(1000, 2000),
expiresAt: time() + 1200,
)
)->toArray();
$stamp = (string) (int) (microtime(true) * 1000);
setcookie('ls_t', $stamp . '.' . hash_hmac('sha256', $stamp, $secret), [
'expires' => time() + 86400,
'path' => '/',
'secure' => true,
'httponly' => true,
'samesite' => 'Lax',
]);
while (ob_get_level()) {
ob_end_clean();
}
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: no-store');
header('X-Robots-Tag: noindex');
echo json_encode($challenge, JSON_UNESCAPED_UNICODE);
exit;