SDKs
Client SDK
valkyr-client, the optional user mode client SDK: signed session heartbeats, build attestation and a few integrity hints, with exactly what it sends.
valkyr-client is optional. It lives inside your game client, runs in user mode, needs no admin rights and installs nothing. It gives the server three things the server cannot measure itself:
- A signed session. Fresh Ed25519 keys per session, rotated on a schedule, answering server nonces, so heartbeats cannot be forged or replayed.
- Build attestation. The hash of the game build and one root hash over the game's own files, checked against the builds you allow.
- Integrity hints. A debugger attached, hardware breakpoints, a preload library, wall clock jumps, the game's code section changing in memory.
The server never trusts it more than its own evidence: client signals enter as client.* flags, and a verdict built only from them is capped at review.
The handshake
The client says hello, the server answers with a challenge, the client sends a signed heartbeat, the server verifies it and reports problems. In a real game the JSON travels over your own network channel to the game server, which relays it to valkyr-server (POST /v1/ and POST /v1/).
fn main() { let build_hash = Hex32([0x42; 32]); let manifest_root = Hex32([0x24; 32]); // Client side: session key and signal collector. let mut client = ClientSession::new(ClientConfig { build_hash, manifest_root, rotate_every: 2, }) .expect("os random generator"); let mut collector = SignalCollector::new(SignalConfig::default()); let mut scheduler = Scheduler::new(Duration::from_secs(10), 25); // 1. Client -> server: hello. let hello_json = serde_json::to_string(&client.hello()).unwrap(); println!("hello: {hello_json}"); // Server side: accept the hello. let hello: Hello = serde_json::from_str(&hello_json).unwrap(); let config = VerifierConfig { allowed_builds: vec![build_hash], expected_manifest_root: Some(manifest_root), rotate_after: 2, ..VerifierConfig::default() }; let mut server = SessionVerifier::new(&hello, config, wall_ms()).expect("hello accepted"); for round in 1..=3 { // 2. Server -> client: challenge. let challenge_json = serde_json::to_string(&server.issue_challenge(wall_ms()).unwrap()).unwrap(); println!("challenge {round}: {challenge_json}"); // 3. Client -> server: signed heartbeat. let challenge: Challenge = serde_json::from_str(&challenge_json).unwrap(); client.handle_challenge(&challenge); collector .clock_mut() .observe_server_time(challenge.server_time_ms); let signals = collector.collect(); let heartbeat = client.heartbeat(signals, code_hash()).unwrap(); let heartbeat_json = serde_json::to_string(&heartbeat).unwrap(); println!("heartbeat {round}: {heartbeat_json}"); // 4. Server verifies. let heartbeat: Heartbeat = serde_json::from_str(&heartbeat_json).unwrap(); let report: HeartbeatReport = server.verify(&heartbeat, wall_ms()); println!( "report {round}: {}", serde_json::to_string(&report).unwrap() ); for p in &report.problems { println!(" problem: {p}"); } println!( " next check in {:?} (a real game would wait)", scheduler.next_delay() ); } // A replayed heartbeat is refused. let challenge = server.issue_challenge(wall_ms()).unwrap(); client.handle_challenge(&challenge); let hb = client.heartbeat(collector.collect(), None).unwrap(); assert!(server.verify(&hb, wall_ms()).ok); let replay = server.verify(&hb, wall_ms()); println!("replay: ok={} problems={:?}", replay.ok, replay.problems);}
Run it with cargo run -p valkyr-client --example heartbeat.
Exactly what is sent
This table is part of the crate documentation and is included here as written:
game enables them in [`signals::SignalConfig`]. | Field | Default | What is sent ||---|---|---|| `client_key`, `next_key` | always | random ed25519 public keys, fresh per session, not tied to the machine or the user || `build_hash` | always | SHA-256 of the game build, chosen by the game || `manifest_root` | always | one SHA-256 over the game's own listed files (paths, sizes, hashes stay local) || `code_hash` | when the game passes it | SHA-256 of the game's own in memory code section || `client_time_ms`, `monotonic_ms` | always | wall clock and time since session start || `signals.debugger` | on | one state: a debugger is attached to the game process || `signals.hardware_breakpoints` | on | one state: debug registers set on the collecting thread || `signals.timing_anomaly` | on | one state from timing a fixed workload || `signals.hypervisor` | on | one state from CPUID, a hint only, never treated as cheating || `signals.preload_env` | on | one state: `LD_PRELOAD` / `DYLD_INSERT_LIBRARIES` is set for the game; the value is not sent || `signals.unexpected_modules` | **opt in** | a count and the SHA-256 of each unexpected module *file name*; never paths, never the allowed modules || `signals.overlay_windows` | **opt in** | for each window covering the game: SHA-256 of a per session random salt plus the title (the title itself is never sent and cannot be correlated across sessions), and four flags (topmost, layered, click through, same process) || `signals.clock` | on | one state, a count of wall clock jumps, the largest jump, and the client to server speed ratio || `signals.code_drift` | on | one state: the game's code section changed since startup | Nothing else is collected: no hardware identifiers, no user names, noprocess lists, no file lists outside the manifest, no screenshots.
Nothing else is collected: no hardware identifiers, no user names, no process lists, no file lists outside the manifest, no screenshots. See Privacy.
Session settings
| Option | Type | Default | Description |
|---|---|---|---|
client. | Vec<Hex32> | [] | Allowed build hashes (hex). Empty accepts any build. |
client. | Option<Hex32> | unset | Expected manifest root (hex). |
client. | u64 | 30000 | Maximum time between two heartbeats. |
client. | u64 | 0 | Required key rotation period in heartbeats (0: none). |
client. | u64 | 2000 | Allowed wall against monotonic clock drift between heartbeats. |
client. | u64 | 30000 | Server time span before the clock speed ratio is judged. |
client. | u64 | 100000 | Allowed speed ratio deviation, parts per million. |
client. | usize | 4 | Outstanding nonces per session. |
client. | u64 | 60000 | Maximum nonce age. |
Generated from crates/
From other languages
The C ABI exposes the same client session (valkyr_, valkyr_, valkyr_, valkyr_) and the manifest helpers. See the C, C++ and C# pages.