.NET SDK

Official SDKs

.NET SDK

The official .NET client targets .NET 6, 7, 8, 9, and 10. Zero dependencies.

Installation

Package Manager
dotnet add package PermitCore.Client

Quick start — validate on every launch

C#
using PermitCore;

var client = new PermitCoreClient("https://api.permitcore.dev");
var result = await client.ValidateAsync("PERMIT-XXXX-XXXX-XXXX-XXXX");

if (!result.IsValid)
{
    MessageBox.Show($"License invalid: {result.Message}");
    Application.Exit();
    return;
}

// Unlock features based on flags
if (result.HasFeature("export")) EnableExportMenu();
if (result.IsTrial)
    ShowTrialBanner($"{result.TrialDaysRemaining} days remaining");

// Warn if vendor subscription is expiring
if (result.VendorWarning is not null)
    ShowStatusWarning(result.VendorWarning);

Activation (first install)

C#
// Call once when the user first installs on a new machine
var result = await client.ActivateAsync(
    licenseKey:  "PERMIT-XXXX-XXXX-XXXX-XXXX",
    deviceId:    PermitCoreClient.GetHardwareId(), // auto-generated HWID
    deviceName:  Environment.MachineName
);

if (result.IsValid)
    SaveActivationSuccess();
else
    ShowError($"Could not activate: {result.Message}");

Offline mode

When the server is unreachable, the SDK automatically returns the last cached response for offlineGraceDays days. Enable/disable in options:

C#
var client = new PermitCoreClient(new PermitCoreOptions
{
    BaseUrl            = "https://api.permitcore.dev",
    EnableOfflineCache = true,  // default
});

var result = await client.ValidateAsync(key);
if (result.IsOffline)
    ShowStatusBar("Running in offline mode");

Floating licenses

Check out a seat when the session starts. While running, heartbeat about every four minutes and handle failed heartbeats. Stop using a rejected session. Cancel the heartbeat loop and await checkin during normal shutdown; process-exit callbacks may not finish network calls. See floating-session lifecycle.