namespace VanadiumGuard.Server.Hosting
{
/// Bound from the Guard section of appsettings.json.
public sealed class GuardServerOptions
{
public string PolicyDirectory { get; set; } = "policies";
public string ReferenceImageDirectory { get; set; } = "builds";
/// Where the machine link table and hardware ban list are kept.
public string BanDirectory { get; set; } = "bans";
///
/// Whether a client that cannot identify its machine may open a session. Left on by
/// default: locked-down and unusual machines legitimately fail to produce an
/// identity, and refusing them would turn a hardware ban feature into a hardware
/// allow-list nobody asked for. The refusal is still recorded either way.
///
public bool AllowUnidentifiedMachines { get; set; } = true;
///
/// Whether a session may open without a TPM-backed device key. Left on by default:
/// plenty of machines have no TPM, have it switched off in firmware, or run a
/// provider that refuses to create keys, and none of that is cheating. Turning this
/// off is a hardware requirement for playing, not an anti-cheat tweak.
///
public bool RequireDeviceAttestation { get; set; } = false;
///
/// Shared secret for the internal endpoints the game server calls. These endpoints
/// expose per-player risk data, so they must never be reachable by a game client.
///
public string InternalApiKey { get; set; } = string.Empty;
///
/// Shared HMAC secret for the game's JWTs. The AC service validates the player's
/// game token at session open with the SAME secret and issuer the game server uses,
/// so it authenticates without a callback. Must match the game server exactly.
///
public string JwtSecret { get; set; } = string.Empty;
/// Issuer the game server stamps on its JWTs. Must match exactly.
public string JwtIssuer { get; set; } = string.Empty;
///
/// Allow a session to open with no valid player token, tied to the machine instead of
/// an account. This exists because the guard mod is not yet wired to hand over the
/// player's game token; with it on, the guard still connects, reports, and is subject
/// to hardware bans - it just cannot be attributed to a specific account until the
/// token is supplied. Turn it OFF once the client sends a token, so every session is
/// player-attributed and no one can report anonymously.
///
public bool AllowAnonymousSessions { get; set; } = false;
/// Silence beyond this is treated as the guard having gone away.
public int SessionIdleTimeoutSeconds { get; set; } = 90;
public int MissedHeartbeatsBeforeSilent { get; set; } = 3;
}
}