Clavem

Activate and deactivate devices from an Unreal Engine game

Activation in Unreal is one POST per PC, sent when the player enters a key. Send a hashed fingerprint so a reinstall reuses the same seat, store the instance id, and show the server's sentence when the device limit is reached.

What activation does

Activation ties one license key to one PC. Clavem answers with an instance.id and a signed token; the key, the instance id and the token go into the file from the validation guide, and every later launch validates with that id. A product’s device limit decides how many PCs can be active at once. The default is 3.

The snippets follow the Unreal Engine 5.0 API reference and were not compiled in an engine project. The fingerprint hashing was run as plain C++ with the same Monocypher call.

A fingerprint from the login id

instance_name is for people: it is what the buyer sees on the device page. fingerprint is for machines. Activating again with a fingerprint that is already active returns the same seat instead of a new one, which is what makes a reinstall free.

The 5.0 reference marks FPlatformMisc::GetMachineId as deprecated in favor of GetLoginId, described as a unique string associated with the login account of the current machine. The reference does not say what that string is on each platform, so treat it as possibly different for two OS users on one PC, and test it (below). Send a hash, not the raw value. Monocypher is already in your module for token verification, and it includes BLAKE2b.

static FString Fingerprint()
{
	// Never change this prefix after shipping: every player would look like a new device.
	const FString Text = TEXT("com.example.inkwell:") + FPlatformMisc::GetLoginId();
	const FTCHARToUTF8 Utf8(*Text);
	uint8 Hash[32];
	crypto_blake2b(Hash, sizeof(Hash), reinterpret_cast<const uint8*>(Utf8.Get()), Utf8.Length());
	return BytesToHex(Hash, sizeof(Hash)); // 64 hex characters, under the 200 allowed
}

My plain C++ run of the same call gave a stable 64-character result for the same input and a different one for a changed input.

Activate and deactivate

void UClavemLicenseSubsystem::Activate(const FString& RawKey)
{
	const FString Key = RawKey.TrimStartAndEnd();
	TSharedRef<FJsonObject> Body = MakeShared<FJsonObject>();
	Body->SetStringField(TEXT("license_key"), Key);
	Body->SetStringField(TEXT("instance_name"), FPlatformProcess::ComputerName());
	Body->SetStringField(TEXT("fingerprint"), Fingerprint());
	FString Payload;
	FJsonSerializer::Serialize(Body, TJsonWriterFactory<>::Create(&Payload));

	TSharedRef<IHttpRequest, ESPMode::ThreadSafe> Request = FHttpModule::Get().CreateRequest();
	Request->SetURL(TEXT("https://clavem.io/v1/licenses/activate"));
	Request->SetVerb(TEXT("POST"));
	Request->SetHeader(TEXT("Content-Type"), TEXT("application/json"));
	Request->SetContentAsString(Payload);
	Request->SetTimeout(8.f);
	Request->OnProcessRequestComplete().BindWeakLambda(this, [this, Key](FHttpRequestPtr, FHttpResponsePtr Response, bool bConnected)
	{
		const int32 Status = (bConnected && Response.IsValid()) ? Response->GetResponseCode() : 0;
		TSharedPtr<FJsonObject> Json;
		if (Status > 0) { FJsonSerializer::Deserialize(TJsonReaderFactory<>::Create(Response->GetContentAsString()), Json); }

		bool bActivated = false;
		if (Json.IsValid()) { Json->TryGetBoolField(TEXT("activated"), bActivated); }
		if (!bActivated)
		{
			FString Message = TEXT("Could not reach the license server. Check the connection and try again.");
			const TSharedPtr<FJsonObject>* Lic = nullptr;
			int32 Limit = 0, Used = 0;
			if (Json.IsValid() && Status == 400 && Json->TryGetObjectField(TEXT("license_key"), Lic)
				&& (*Lic)->TryGetNumberField(TEXT("activation_limit"), Limit) && (*Lic)->TryGetNumberField(TEXT("activation_usage"), Used) && Used >= Limit)
			{
				Message = FString::Printf(TEXT("All %d devices for this key are in use. Free one at clavem.io/licenses/manage."), Limit);
			}
			else if (Json.IsValid())
			{
				Json->TryGetStringField(TEXT("error"), Message);
			}
			OnActivateResult.Broadcast(false, Message);
			return;
		}

		FClavemSaved Saved;
		Saved.Key = Key;
		const TSharedPtr<FJsonObject>* Instance = nullptr;
		if (Json->TryGetObjectField(TEXT("instance"), Instance)) { (*Instance)->TryGetStringField(TEXT("id"), Saved.InstanceId); }
		Json->TryGetStringField(TEXT("token"), Saved.Token);
		SaveSaved(Saved);
		OnActivateResult.Broadcast(true, FString());
		Validate();
	});
	Request->ProcessRequest();
}

void UClavemLicenseSubsystem::Deactivate()
{
	FClavemSaved Saved;
	if (!LoadSaved(Saved)) { return; }
	// Build {"license_key", "instance_id"} as above and POST it to /v1/licenses/deactivate.
	// Clear the file on 200, and also on 404 (the instance is already gone). Keep it on no answer.
}

OnActivateResult is a dynamic multicast delegate with a bool and an FString, declared BlueprintAssignable, so a widget can bind to it.

What comes back

Result Meaning Show
200, activated: true Seat taken or reused Nothing: continue
400, limit reached Body holds license_key.activation_limit and activation_usage How many devices, and where to free one
400, disabled or expired The error sentence The sentence
404 license_key not found. Ask the player to check the key
429 or 503 Rate limit or a short outage Try again in a minute
No answer Offline Connect once to activate

The limit-reached body keeps the documented shape: activated: false, the error sentence, and a license_key object. A null limit means unlimited, so it never triggers that branch.

Check it on every platform you ship

Run this on each target before release. Activate the same key twice in a row and compare the two instance.id values and activation_usage. If the id differs or the count goes up, the fingerprint is not stable on that platform. Also activate from the editor and from a packaged build on one PC; they should share one seat.

Unreal specifics

  • Cloned disks and VM images carry whatever the operating system stored, so clones can share a fingerprint, and therefore one seat.
  • Editor plugins should hold this code in an editor subsystem instead of a game-instance subsystem, so the check runs in the editor and not in the game.
  • Deactivate only from a button, such as “Deactivate this PC”. Doing it in Deinitialize needs the network at the moment the player quits, and re-activating with the same fingerprint returns the same seat anyway.
  • Do not hide the limit error. Buyers who changed PCs can free a seat themselves at /licenses/manage without contacting you.

Doing this with Clavem

The request and response fields are in the API reference. The device limit is set per product, and a license can have its own limit.

Questions

Does the editor use a seat?

Only if someone activates inside it. Activation is a call you trigger from a menu, so opening the project or starting Play In Editor does not spend a seat. The same PC should send the same fingerprint from the editor and from a packaged build, and the test below checks that.

What if the player reinstalls the operating system?

The platform may then return a different login id, in which case the next activation counts as a new device. Test it on your targets. The player frees the old seat on the device page at clavem.io/licenses/manage.

Sources

  1. Unreal Engine 5.0 API reference, FGenericPlatformMisc::GetLoginId (checked November 2026)
  2. Unreal Engine 5.0 API reference, FGenericPlatformMisc::GetMachineId, deprecated (checked November 2026)