KeyMint 1.6.0
See the version list below for details.
dotnet add package KeyMint --version 1.6.0
NuGet\Install-Package KeyMint -Version 1.6.0
<PackageReference Include="KeyMint" Version="1.6.0" />
<PackageVersion Include="KeyMint" Version="1.6.0" />
<PackageReference Include="KeyMint" />
paket add KeyMint --version 1.6.0
#r "nuget: KeyMint, 1.6.0"
#:package KeyMint@1.6.0
#addin nuget:?package=KeyMint&version=1.6.0
#tool nuget:?package=KeyMint&version=1.6.0
Keymint .NET
A professional, production-ready SDK for integrating with the Keymint API in C# and other .NET languages. Provides robust, async-first access to all major Keymint features, with strong typing and modern error handling.
Requires .NET 8 or later.
Features
- Async/await: All API calls are asynchronous.
- Strongly typed: Full support for .NET types and JSON serialization.
- Consistent error handling: All API errors are returned as structured
KeyMintResultobjects. - Machine Identity: Built-in utilities for hardware fingerprinting and stable installation IDs.
Installation
Add the SDK to your project:
dotnet add package KeyMint
Usage
using KeyMint.Services;
var apiKey = Environment.GetEnvironmentVariable("KEYMINT_API_KEY");
var productId = Environment.GetEnvironmentVariable("KEYMINT_PRODUCT_ID");
var client = new KeyMintSDK(apiKey);
// 1. Get a stable, unique ID for this machine
var hostId = KeyMintIdentity.GetOrCreateInstallationId();
// 2. Create a key authorized only for this machine
var result = await client.CreateKey(new CreateKeyParams {
ProductId = productId,
AllowedHosts = new List<string> { hostId }
});
if (result.IsSuccess) {
Console.WriteLine($"Created Key: {result.Data.Key}");
}
License Expiry
ActivateKey and FloatingCheckout return ExpirationDate: when the license expires, as a UTC DateTimeOffset?, or null if it never expires. On FloatingCheckout this is separate from ExpiresAt, which is the floating seat lease.
var activation = await client.ActivateKey(new ActivateKeyParams {
ProductId = productId,
LicenseKey = licenseKey,
HostId = hostId
});
if (activation.IsSuccess) {
var expiry = activation.Data.ExpirationDate;
if (expiry is null) {
Console.WriteLine("License never expires.");
} else {
var daysLeft = Math.Max(0, (int)Math.Ceiling((expiry.Value - DateTimeOffset.UtcNow).TotalDays));
Console.WriteLine($"License expires {expiry.Value:yyyy-MM-dd} ({daysLeft} days left).");
}
// Persist the last value you received (e.g. in your app settings).
}
Store the last ExpirationDate you received. An expired license fails activation with the same generic error as an invalid key, so the stored date is what lets your app tell the user the license expired on that date instead of calling the key invalid.
Machine Identity
Keymint provides utilities to uniquely identify machines for node-locking:
KeyMintIdentity.GetOrCreateInstallationId(): Recommended. Generates a stable UUID anchored to hardware and persists it to~/.keymint/installation-id.KeyMintIdentity.GetMachineId(): Generates a SHA-256 fingerprint based on BIOS UUID, OS machine ID, and MAC address.
API Methods
License Key Management
| Method | Description |
|---|---|
CreateKey |
Creates a new license key. |
ActivateKey |
Activates a license key for a device. |
DeactivateKey |
Deactivates a device from a license key. |
GetKey |
Retrieves detailed information about a key. |
BlockKey |
Blocks a license key. |
UnblockKey |
Unblocks a previously blocked license key. |
UpdateKey |
Updates an existing license key. |
SignKey |
Signs a key for offline (air-gapped) validation using an admin API key. |
FloatingCheckout |
Checks out a floating license seat. |
FloatingHeartbeat |
Sends a heartbeat to keep a session alive. |
FloatingCheckin |
Checks in a session, releasing the seat. |
Customer Management
| Method | Description |
|---|---|
CreateCustomer |
Creates a new customer. |
GetAllCustomers |
Retrieves all customers. |
GetCustomerById |
Gets a specific customer by ID. |
GetCustomerWithKeys |
Gets a customer along with their license keys. |
UpdateCustomer |
Updates an existing customer's information. |
ToggleCustomerStatus |
Toggles a customer's active status. |
DeleteCustomer |
Permanently deletes a customer and their keys. |
Webhook Verification
| Method | Description |
|---|---|
VerifyWebhookSignature |
Verifies the signature of a webhook request payload. |
Idempotency
All mutating SDK methods support idempotency keys to safely retry requests in case of network drops. Pass a RequestOptions instance as the optional second argument:
var result = await client.CreateKey(new CreateKeyParams {
ProductId = productId,
}, new RequestOptions {
IdempotencyKey = "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"
});
License
MIT
Support
For help, see Keymint API docs or open an issue.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Logging (>= 9.0.8)
-
net9.0
- Microsoft.Extensions.Logging (>= 9.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.