using System;
namespace VanadiumGuard.Protocol
{
///
/// A server-issued request for the client to hash a region of its own memory.
///
/// This is the anti-tamper primitive a stubbed-out guard cannot fake. The server picks
/// the module, offset and salt at random every time, so a valid answer requires actually
/// reading the live image, and a captured answer fails against the next salt.
///
///
public sealed class MemoryChallenge
{
public string ChallengeId { get; set; } = string.Empty;
/// Module base name, e.g. GameAssembly.dll. Must be on the policy allowlist.
public string Module { get; set; } = string.Empty;
/// Offset from the module base address.
public uint Rva { get; set; }
/// Bytes to hash. Clamped to ProtocolConstants.MaxChallengeReadLength.
public int Length { get; set; }
/// Hex salt prefixed to the bytes before hashing. Never reused.
public string Salt { get; set; } = string.Empty;
public DateTimeOffset IssuedUtc { get; set; }
}
/// The client reply to a .
public sealed class ChallengeAnswer
{
public string ChallengeId { get; set; } = string.Empty;
/// Lowercase hex SHA-256 over salt bytes followed by the memory bytes.
public string Hash { get; set; } = string.Empty;
/// False when the client could not resolve the module or read the region.
public bool Readable { get; set; }
/// Populated when Readable is false.
public string? Error { get; set; }
}
}