#pragma once
#include <array>
#include <string>
#include <string_view>
namespace nethack_mcp
{
/// Create a canonical UUIDv7 using the operating system random source.
std::string makeGameId();
/// Check the canonical lowercase UUIDv7 spelling used by public paths.
bool validGameId(std::string_view game_id);
/// Mint a one-time 256-bit bearer token encoded as base64url.
std::string makeControlToken();
/// Create a salted SHA-256 digest for an in-memory control token check.
std::array<unsigned char, 32> hashControlToken(
const std::array<unsigned char, 32>& salt, std::string_view token);
/// Compare token digests without data-dependent early exit.
bool secureDigestEqual(const std::array<unsigned char, 32>& left,
const std::array<unsigned char, 32>& right);
/// Fill a fixed-size buffer from the operating system random source.
bool secureRandom(void* destination, std::size_t size);
} // namespace nethack_mcp