Integration guide

This guide takes a game from nothing to protected logins. It has five parts: register the game, connect Meta, add the login to the game, check tickets on your game server, and test.

The Unity SDK (0.2) does parts 3 and 5 for you and adds the device checks. It has been tested against Wyrden's servers and, for its native part, against real attacks in Linux; its tests on the headset are under way. Parts 3 and 5 below also describe the HTTP API, for a game that integrates by hand.

1. Register your game

  1. Create an account and confirm your email address.
  2. In the dashboard, add a game. You need:
    • the package name (for example com.yourstudio.yourgame), and
    • the SHA-256 fingerprint of each signing certificate you ship with. For an Android keystore: keytool -list -v -keystore your.keystore and copy the SHA256 line.
  3. Choose a plan and a preset. Start with Monitor: it logs everything and blocks nothing.

Registration comes first because Wyrden binds your licence to these two values. It serves a session only when Meta attests that the app is your package, signed with one of your certificates. A copy of your licence in another app gets nothing back.

Each game has a production licence. On the Full plan it also has a working staging licence with a separate configuration, so you can try a change in staging first. On the other plans the staging licence is shown but switched off: a game that uses it is told protection is off and runs without Wyrden.

If you change your signing certificate later, an owner or admin can replace the registered fingerprints on the game's Setup page. Builds signed with a certificate you remove are refused from then on.

Your SDK package

Wyrden makes the SDK for each game separately. On the Setup page, choose Make a new package; it is usually ready in under a minute. The package carries the game's licence IDs and its own seed, and it is signed. Check the SHA-256 the page shows against the file you downloaded.

The build plugin checks the package before every build and refuses one that was changed in any way, or one signed by a key Wyrden has revoked. A copy of your package used in another app gets nothing from Wyrden: the server serves only your package name, signed with your certificates. Wyrden keeps a record of each package so a leaked copy can be traced back to the game it was made for.

You can have up to 20 packages made a day. A file can be downloaded for 90 days; make a new package any time after that.

2. Connect Meta

Wyrden verifies each attestation token with Meta on your behalf, which needs your app's credentials.

  1. In the Meta developer dashboard, open your app and note the App ID and App Secret.
  2. In Wyrden's dashboard, open the game's Setup page and enter them under Meta credentials.

They are encrypted before they are stored and can never be read back, only replaced.

In Meta's Data Use Checkup, request:

  • User ID, so Wyrden can confirm with Meta that a player is who the game says they are. Without it Wyrden cannot verify identity, and flags do not count against a player whose identity was not verified.
  • In-app purchases and/or downloadable content, if you want the ownership check.
  • Device Ban, only if you want device bans. That feature stays off until Meta approves it.

Requirements from Meta: Meta Platform SDK v55 or later (v56 for Unreal), on Quest 2, Quest Pro, Quest 3 or Quest 3S. Quest 2 and Quest Pro are supported by Meta's SDK up to v213.

3. Add the login to your game

The game makes three calls. All are HTTPS POST with a JSON body to https://api.wyrden.co.uk.

3.1 Ask for a nonce

POST https://api.wyrden.co.uk/v1/session/nonce
{"licence": "wl_...", "user_id": "1234567890", "mode": "ranked"}

licence is the licence's public ID from the Setup page. user_id is the player's Meta user ID. mode is your own name for the game mode (lower-case letters, digits, - and _); it selects the policy and is written into the ticket.

{"status": "ok", "session_id": "ses_...", "nonce": "…43 characters…", "expires_in": 120, "game_key": "…"}

If status is unprotected, your licence has been suspended or revoked. Carry on without Wyrden: your players must not be locked out.

Keep game_key_id from this reply: if you send a client_key with the attestation, send game_key_id with it.

3.2 Have Meta sign it

Pass the nonce to Meta's Attestation API, and ask Meta for a user proof. In Unity, with the Meta Platform SDK:

// Sketch. Check the names against the Platform SDK version you ship.
Oculus.Platform.DeviceApplicationIntegrity.GetIntegrityToken(nonce).OnComplete(msg =>
{
    if (msg.IsError) { /* retry with back-off; do not treat as a pass */ return; }
    string attestationToken = msg.Data;
});

Oculus.Platform.Users.GetUserProof().OnComplete(msg =>
{
    if (msg.IsError) { return; }
    string userProof = msg.Data.Value;
});

Meta limits each device to 100 attestation requests an hour and 200 a day. Attest once per session.

3.3 Present the token

POST https://api.wyrden.co.uk/v1/session/attest
{
  "licence": "wl_...",
  "session_id": "ses_...",
  "user_id": "1234567890",
  "mode": "ranked",
  "token": "…attestation token…",
  "user_proof": "…user proof…"
}

mode must be the mode you asked the nonce for. Changing it between the two calls is refused.

If the login is allowed:

{"status": "ok", "ticket": "w1.…", "ticket_expires_at": 1795000000}

Give the ticket to your game server when the player connects.

If it is not:

{"status": "denied"}

A denial carries no reason, on purpose. Do not try to show one. Two exceptions:

  • message may be present. It is text you wrote in the dashboard for the security patch check, telling the player to update their headset. Show it.
  • ban is present when the player or device is banned: {"kind": "temp", "until": 1795000000, "appeal_code": "ABCD-EFGH-JKLM", "appeal_url": "…"}. Show the player how long the ban lasts, the code, and the address. A ban is a decision the player has a right to contest.

status: "unavailable" (HTTP 503) means nothing was decided, usually because Meta could not be reached. Try again with the same nonce and token within its two minutes. It is not a detection. If the reply also carries "retry": "new_nonce", that nonce can no longer work (it was issued just before a failover inside Wyrden): start again from a new nonce. If no reply arrived at all, also start again from a new nonce: the first attempt may have used the nonce, and presenting it again looks like a replay. The SDK does all of this for you.

status: "unregistered_device" comes only with the staging licence, on a headset not registered for development. Show the pairing_code it carries; see development headsets.

4. Check tickets on your game server

This step is what makes the rest count. A client that skips Wyrden entirely simply has no ticket.

Your game server must:

  1. refuse a player who presents no ticket,
  2. verify the ticket's signature with Wyrden's public key,
  3. check that the ticket is for this game and environment, has not expired, and has not been used before,
  4. check that it belongs to the player who is connecting and to the mode being joined,
  5. remove a player when Wyrden says so.

A Go library, wyrden.co.uk/gameserver, does all of this. It is written and tested; publishing it so that go get can fetch it is in preparation. It also follows licence and key changes by itself: when the licence is suspended it admits players without tickets within seconds, and when the ticket key is replaced it fetches the new one.

wy := gameserver.New(gameserver.Options{
    BaseURL: "https://api.wyrden.co.uk",
    APIKey:  os.Getenv("WYRDEN_GAMESERVER_KEY"), // from the dashboard, Setup page
    OnKick: func(sessionID, reason string) {
        // Remove the player. Never show them the reason.
    },
    OnWarn: func(sessionID, message string) {
        // A penalty ladder's warning: show the player your message.
    },
    OnRestrict: func(sessionID string) {
        // Restricted play from now on, such as a cheater-only lobby next match.
    },
})
if err := wy.Refresh(ctx); err != nil { /* see "If Wyrden is unreachable" */ }
go wy.Run(ctx)

// When a player connects:
adm, err := wy.Admit(ctx, ticketFromClient, playerMetaUserID, lobbyMode)
if err != nil {
    // Refuse the connection.
}
// adm.Restricted, adm.TrustTier and adm.Modded are there for your matchmaking.

// When the player leaves:
wy.EndSession(ctx, adm)

Tell Wyrden when a player leaves. A session that just stops answering heartbeats looks like a player blocking them, which counts a little against the player. The library sends a call again by itself when Wyrden answers "too many requests" or "unavailable", after the wait Wyrden asks for.

Your own evidence and reports

On the Full plan your game server can add evidence of its own. It always names the player by the Admission of the connection the traffic came from, never by a player named inside a message, so one player cannot make another look like the cheater.

// A flag with a code you choose. Its action is set per code in the dashboard.
wy.Flag(ctx, adm, "speed_hack", map[string]any{"speed": 41})

// Events for your custom rules, such as "coins gained in a minute above 5000".
fired, err := wy.Events(ctx, adm, gameserver.Event{Name: "coins_gained", Value: 250})

// A player's report of another, from a menu your server handles (Basic and Full).
wy.Report(ctx, reporterAdm, reportedAdm, "cheating", "")

Reports never penalise anyone on their own. They open a case for your moderators, and count only next to evidence from a check. The SDK can also send a report straight from the game, signed with the player's session key.

Network protection

On the Full plan, the library's netguard package checks every message a player sends before your server acts on it. You declare your message types; it drops what does not fit and reports to Wyrden what that says about the player, and your configuration decides what happens next.

guard := netguard.New(wy, netguard.Options{
    Rules: map[string]netguard.Rule{
        "input":       {MaxBytes: 128, PerSecond: 20, Burst: 40, Validate: checkInput},
        "chat":        {MaxBytes: 300, PerSecond: 2},
        "start_match": {HostOnly: true},
    },
    RequireSignature: true,
})

// When a player is admitted:
peer := guard.Join(adm)
guard.SetHost(lobbyID, peer) // only your server decides who hosts

// For every message:
if v := guard.Check(peer, lobbyID, netguard.Message{Type: t, Payload: d, Seq: seq, MAC: mac}); !v.Allow {
    return // dropped
}

It refuses messages from connections with no admission, of types you did not declare, over their size, failing your validator, beyond their rate, and host-only messages from anyone but the host. With RequireSignature, each message must be signed with the player's session key: in the game, var (seq, mac) = WyrdenSdk.SignTraffic(type, payloadBytes); and send both with the message. The server opens the key from the ticket, so a message cannot be forged for another player, and a sequence number seen before is refused, so nothing can be sent twice. Players without a key (Wyrden was unreachable, or protection is off) are not held to signing.

Reports are sent in the background, at most one of each code per player every 30 seconds; checking a message never waits on the network. Unsigned, forged and replayed messages are dropped without a report, since someone else could have sent them.

Session replay

On the Full plan your game server can keep a few seconds of each player's head and hand positions, so a moderator can watch a flagged session in 3D on the dashboard. It is off until an owner or admin turns it on (Privacy page), and a game marked as played by children never keeps replays.

rec := motion.New(wy, motion.Options{})
go rec.Run(ctx)

// When a player is admitted and when they leave:
rec.Join(adm)
defer rec.Leave(adm)

// As your netcode receives each player's tracked poses (metres and unit
// quaternions, in your game's own axes; a hand that is not tracked is the
// zero Pose):
rec.Pose(adm, motion.Frame{Head: head, Left: left, Right: right})

// Your game's key moments, shown on the replay's timeline:
rec.Event(adm, motion.Event{Name: "shot", Value: 1})

The recorder also feeds behavioral detection, when it is on: each frame is judged against your human limits as it arrives, keeping only the frame before, and a broken limit is reported (see the configuration reference). For that, give it every frame your netcode receives, in the player's play area (tracking space), not the game world.

With replays off the recorder keeps nothing. With them on it keeps only the last few seconds of each player, in your server's memory, at the rate you chose. When Wyrden flags a session it asks your servers for that session's replay: the recorder keeps recording for the seconds you chose after the flag, then sends the seconds before and after it, once. Nothing else leaves your server. Replays are kept as long as flags, and erased with a player's other records.

A server written in C#

A Unity dedicated server, or any .NET server, uses the C# library in the SDK package (assembly Wyrden.Server). It does what the Go library does, with the same names in C#:

using Wyrden.Server;

var wy = new WyrdenServer(new WyrdenServerOptions
{
    ApiBase = "https://api.wyrden.co.uk",
    ApiKey = Environment.GetEnvironmentVariable("WYRDEN_GAMESERVER_KEY"),
    OnKick = (sessionId, reason) => { /* remove the player; never show the reason */ },
    OnWarn = (sessionId, message) => { /* show the studio's message */ },
    OnRestrict = sessionId => { /* restricted play from now on */ },
});
await wy.RefreshAsync();
_ = wy.RunAsync(shutdown.Token);

// When a player connects:
var r = await wy.AdmitAsync(ticketFromClient, playerMetaUserId, lobbyMode);
if (!r.Admitted) { /* refuse the connection; r.Error says why, for your logs */ }

// Your evidence, as in Go: FlagAsync, EventsAsync, ReportAsync.
// When the player leaves:
await wy.EndSessionAsync(r.Admission);

NetGuard and MotionRecorder are the C# versions of netguard and motion. The library verifies tickets with its own Ed25519 code, so it runs on Unity's Mono and IL2CPP as well as .NET. For other languages the ticket format is small and fixed; the API reference specifies it.

If Wyrden is unreachable

Tickets are verified offline, so players who already hold one are unaffected. A player can only lack a ticket legitimately while Wyrden is down, or while Meta's verification is, so that Wyrden can issue no tickets. For that case you choose, per game mode, in the dashboard: allow (admit without a ticket) or block. The library applies your choice once it has been unable to reach Wyrden for 60 seconds, or once Wyrden has told it Meta has been failing for 30.

If you have no game server

Use your netcode provider's authentication hook to check the ticket. For Photon there is an add-on that does it.

Photon

The Photon add-on (on Basic and Full, chosen with the game's plan) puts Wyrden in front of Photon's own login. Photon's custom authentication calls Wyrden's login gate when a client connects; the gate checks the client's Wyrden ticket, that it belongs to the player and the mode, and that the session still runs, and answers Photon in Photon's format.

  1. On the Setup page, make a Photon key for the game and environment. The dashboard then shows the address to enter in Photon's dashboard as the custom authentication URL, https://api.wyrden.co.uk/v1/photon/auth?key=…. The key opens the Photon endpoints and nothing else.
  2. In the game, log in through Wyrden first, then connect to Photon with the ticket. The package's Photon sample (Package Manager, Samples) shows PUN 2 and Fusion 2; the core of it is:
var login = await WyrdenSdk.LoginAsync(metaUserId, mode);
var auth = new AuthenticationValues { AuthType = CustomAuthenticationType.Custom };
foreach (var kv in PhotonGate.Parameters(login.Ticket, metaUserId, mode)) auth.AddAuthParameter(kv.Key, kv.Value);
// Fusion 2: new StartGameArgs { …, AuthValues = auth }. PUN 2: PhotonNetwork.AuthValues = auth.

A player who passes gets the Meta user ID as their Photon user ID, fixed by Photon from then on, and an AuthCookie, which Photon keeps from clients and hands to webhooks and plugins: ws is the Wyrden session, tk its traffic key sealed for your servers, with the mode and trust tier. A ticket opens up to 20 Photon connections, for reconnects. With the licence suspended or the add-on off, the gate lets everyone through. In Photon's dashboard, choose what happens when the gate cannot be reached: letting players in matches Wyrden's default outage rule.

  1. Optionally, set Photon's webhooks to https://api.wyrden.co.uk/v1/photon/webhook with the custom header X-Wyrden-Key set to the key, and paths /beforejoin, /join and /leave. Wyrden then refuses a BeforeJoin from a player whose session has ended, for example after a ban. (Photon adds the BeforeJoin path on request.)

On Photon's public cloud no server code of yours runs in a room, so Wyrden cannot take a player out of a room they are already in: a removal takes effect when they next connect or join a room, and the SDK ends the session in an honest client at once. With Photon Enterprise Cloud or a self-hosted Photon Server, run Wyrden's server plugin (in the repository as sdk/photon-plugin): it also removes the player from the room within seconds and runs every event through the network guard. A Fusion dedicated server can use the C# library directly.

A game server's view of a session

wy.SessionLiveAsync(sessionId) in C#, and POST /v1/gs/session/status for any language, say whether a session of your game is still live.

5. Heartbeats

With the heartbeat check on, the reply to a successful login includes a challenge:

"heartbeat": {"id": "hb_…", "seed": "…", "kind": "ping", "wait_ms": 21000, "timeout_ms": 10000}

The game waits wait_ms, then answers at POST /v1/session/heartbeat, and receives the next challenge. Answers are keyed with a secret agreed for that session, so they cannot be produced by anyone else or replayed. The SDK will do this for you; the API reference has the details if you integrate by hand.

Device checks

With the SDK, an Android build carries libwyrden, a small native library (about 50 KB) that the SDK calls on a background thread. It gathers evidence for seven checks: root detection, file integrity, memory integrity, hook detection, decoys, clock checks and protected values. Nothing on the headset decides anything: the evidence is sealed for your game's session and Wyrden's servers judge it against your configuration.

What you do:

  1. Build an APK for arm64-v8a with the SDK package in Packages/. The build plugin lists the device checks in the build's manifest.
  2. Set WYRDEN_MANAGEMENT_KEY on the build machine (a Full plan API key). After the build, the plugin reads the finished APK and uploads the build's tables: a hash of every part of its native libraries and its IL2CPP metadata. Without the tables Wyrden cannot check the build's files and code, and its players get only the other checks. If you export a Gradle project instead of an APK, run Wyrden.Build.BuildPlugin.UploadTables on the APK you sign.
  3. Give each build a new version code. A manifest is matched to logins by the version Meta attests.
  4. Keep valuable numbers in protected values (below).

File and code challenges. At every login Wyrden picks a part of every file the build lists, and of the code of libil2cpp.so (your game and the SDK) and libwyrden.so, with a fresh seed. The headset hashes those bytes as the system loaded them, or as the code sits in memory, and answers; Wyrden works out the right answer from the build's tables. A file or library up to 4 MiB is checked whole at every login; a larger one is sampled, and each heartbeat checks up to 8 MiB more. A wrong answer blocks the login, or kicks during play after the kick delay. So does a native library in the app's own files that the build does not have (a repacked app).

Protected values. For numbers a cheat would edit in memory, use the SDK's types instead of int, long, float and double:

using Wyrden;

ProtectedInt ammo = 30;      // converts to and from int
ammo--;                      // the operators an int has
int left = ammo;             // each read checks the value
ProtectedFloat health = 100f;

Each value is kept encoded with its own key and a check, next to a plain copy that a memory scanner finds first. An edit of either is noticed when the game next reads the value: the game gets the true value back, nothing happens on screen, and the edit is reported with the next evidence. Reading one costs a few nanoseconds.

Decoys need nothing from you: the SDK carries switches and functions with the names a cheat writer looks for. Nothing reads them to decide anything, so a change to one can only be tampering.

Do no harm. The SDK catches every error and carries on; it never crashes, shows a message or stops the game. Its checks run off the main thread within a CPU budget, every native call has a time limit, and its own time on the main thread is measured. The game's Analytics page shows your players' frame times, the SDK's share of each frame (its budget is 0.5 ms) and any errors the SDK caught. If an SDK release ever harms games, Wyrden can put that version into passive mode from its side: the SDK stops running its checks at the next login, with no game update, and nothing is held against your players meanwhile.

Scatter (Full plan). Switch it on, and choose a density, on the game's Builds page. At each Android build the plugin then weaves small checks into the start of methods of your own code, chosen afresh with the build's own seed, after Unity compiles your scripts and before IL2CPP turns them into native code. Each check writes a token when its code runs; Wyrden asks the SDK which have run and checks their tokens. Checks are also placed where your code calls WyrdenSdk.LoginAsync, so they always run before a login: call it from your own code. Some checks watch a canary value or a decoy switch with a tempting name. Nothing to write: list namespaces or types to leave alone (hot inner loops, generated code) on the same page. Each build's checks are listed beside it, for you only. Light weaves about one method in twenty, medium one in eight, heavy one in three; the Analytics page shows what it costs your players.

What to expect. The device checks are evidence of the weakest kind, because the headset belongs to the player; their default weights are lower than Meta's claims and the server's own observations. See what Wyrden cannot do.

6. Test before you enforce

  1. On the Full plan, use the staging licence in development builds. Its sessions are marked as development in the dashboard and it has its own configuration. On the Free and Basic plans, develop against the production licence: register your debug keystore's fingerprint next to your release one, and on Basic add your own test accounts to the allowlist so a sideloaded build is logged but not blocked.
  2. Leave the preset on Monitor and play. Watch the flags feed. A clean build should produce no flags.
  3. Move one check at a time to dry run, then to enforce. Dry run logs what would have happened and enforces nothing.
  4. Before saving a stricter rule, use Preview to see how many of last week's players it would have affected.
  5. Know where the kill switch is. It turns one check off everywhere within seconds, with no game update.
  6. Before switching on automatic bans, decide how they should behave: the trust score, a penalty ladder that warns first, ban waves, and whether permanent bans wait for a moderator (they do unless you change it). Each has a dry run except ban waves and device bans. The protection score shows which known attacks your configuration stops, and the accuracy score each check's false-positive rate.

Development headsets

A build that uses the staging licence is served only on headsets registered for the game, so a development build that leaks is of no use to anyone else.

  1. Run the development build on the headset. The first time, the login answers unregistered_device with a pairing code such as ABCD-EFGH. Show it on screen.
  2. On the game's Setup page, under Development headsets, enter the code and a name for the headset. A developer, admin or owner can do this. The code lasts 15 minutes and works once.
  3. Start the build again. The headset is served, and its sessions are marked as development.

A registration lasts 30 days, because Meta gives each app a new identifier for a headset at least that often. When it ends, the build shows a new code. A game can register up to 100 headsets, and removing one stops development builds on it within seconds. The production licence never asks for a registration.

Keys

Each game has two keys, and Wyrden keeps both private halves sealed on its servers. You never handle them. An owner or admin can replace either on the Setup page, if it might have leaked or as a routine. Each replacement is written to the audit log.

Key Does When it is replaced
Ticket key (Ed25519) Signs the session tickets your game servers check New tickets use the new key at once. The old public key stays in /v1/gs/config for 65 minutes, so tickets already issued stay valid until they expire. Game servers using the library pick up the new key by themselves.
Game key (X25519) Agrees each session's keys with the game New logins use the new key. A login that started on the old key still completes for 10 minutes. Sessions in progress are not affected.

If your licence is suspended

If Wyrden suspends or revokes a licence under the terms, protection stops within seconds: the game is told to run without Wyrden, game servers admit players without tickets, and nothing is enforced on sessions in progress. Your players are not locked out.

The game's dashboard becomes read-only. You can still read everything, download what you have, delete a player's data and change the plan. A suspension can be lifted. A revoked licence cannot: Wyrden can issue a new one, which needs a new SDK package because the licence ID changes.

What to tell your players

You are the controller of your players' data and Wyrden processes it for you. Link the player privacy notice from your own privacy policy, and tell players that an anticheat is in use. If a player is banned, show them the appeal code and the appeals address.