AstraGuard.SDK 2.2.3

There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package AstraGuard.SDK --version 2.2.3
                    
NuGet\Install-Package AstraGuard.SDK -Version 2.2.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AstraGuard.SDK" Version="2.2.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AstraGuard.SDK" Version="2.2.3" />
                    
Directory.Packages.props
<PackageReference Include="AstraGuard.SDK" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AstraGuard.SDK --version 2.2.3
                    
#r "nuget: AstraGuard.SDK, 2.2.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AstraGuard.SDK@2.2.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AstraGuard.SDK&version=2.2.3
                    
Install as a Cake Addin
#tool nuget:?package=AstraGuard.SDK&version=2.2.3
                    
Install as a Cake Tool

AstraGuard.SDK — .NET License Management

The official .NET SDK for integrating AstraGuard license management into your applications.

Quick Start

Installation

dotnet add package AstraGuard.SDK

Basic Usage

using AstraGuard.SDK;

var guard = new AstraGuardClient(
    apiUrl: "https://api.astraguard.io",
    productId: "YOUR-PRODUCT-ID"
);

// Verify license or exit automatically
await guard.VerifyOrExit(userLicenseKey);

// Your application code runs here - license is valid!
RunYourApplication();

Features

Feature Description
License Validation Validate license keys with hardware binding
HWID Binding Lock licenses to specific devices automatically
Cloud Configuration Remote feature toggles and runtime settings
Security Protections Comprehensive tamper and analysis protection
Heartbeat Monitoring Continuous license validation during runtime
Event System React to license and security events

Usage Examples

1. Simple Protection

var guard = new AstraGuardClient("https://api.astraguard.io", "PRODUCT-ID");
await guard.VerifyOrExit(licenseKey);
Console.WriteLine("Licensed application running!");

2. Advanced Integration

var guard = new AstraGuardClient("https://api.astraguard.io", "PRODUCT-ID");

// Enable protections
guard.EnableProtections();

// Event handlers
guard.OnLicenseInvalid += (s, e) => HandleInvalidLicense();
guard.OnCloudConfigUpdated += (s, config) => UpdateFeatures(config);

// Verify license
var result = await guard.VerifyLicense(licenseKey);
if (!result.Valid)
{
    Console.WriteLine($"Invalid: {result.Error}");
    return;
}

// Start continuous validation
guard.StartHeartbeat(TimeSpan.FromMinutes(5));

RunApp();

guard.StopHeartbeat();
guard.Dispose();

3. Cloud Configuration

⚠️ Security Notice: Cloud Variables are stored as plain strings in process memory after retrieval. They are suitable for configuration values (MOTD, URLs, feature labels) but not for security-critical gates. A memory scanner can read and modify these values at runtime. Do not use GetCloudVariable() as the sole check for unlocking paid features or sensitive access.

// Check maintenance mode
if (guard.IsMaintenanceMode())
{
    Console.WriteLine("App is in maintenance");
    return;
}

// Get remote variables (use for config, not security gates)
string? motd = guard.GetCloudVariable("motd");
bool premium = guard.GetCloudVariable("premium_mode") == "true"; // ← Not tamper-proof alone

// Access all variables
foreach (var kvp in guard.CloudConfig)
{
    Console.WriteLine($"{kvp.Key} = {kvp.Value}");
}

4. Custom HWID

// Use auto-generated HWID
await guard.VerifyLicense(licenseKey);

// Or provide custom HWID
await guard.VerifyLicense(licenseKey, "MY-CUSTOM-DEVICE-ID");

// Get the auto-generated HWID
string hwid = AstraGuardClient.GetMachineId();

API Reference

AstraGuardClient

Constructor
AstraGuardClient(string apiUrl, string productId)
Methods
Method Description
VerifyLicense(key, hwid?) Validate a license key
VerifyOrExit(key, hwid?, message?) Validate or terminate application
StartHeartbeat(interval?, onInvalid?) Start continuous validation
StopHeartbeat() Stop continuous validation
EnableProtections() Enable all security protections
GetCloudVariable(key) Get a remote configuration value
IsMaintenanceMode() Check if kill switch is active
GetMachineId() Get the device hardware ID
Properties
Property Type Description
CloudConfig Dictionary<string, string> All cloud variables
CurrentLicense LicenseDetails? Current license info
Events
Event Description
OnLicenseInvalid Fired when license becomes invalid
OnCloudConfigUpdated Fired when cloud config changes

Error Handling

var result = await guard.VerifyLicense(licenseKey);

if (!result.Valid)
{
    switch (result.Error)
    {
        case "Key not found":
            Console.WriteLine("Invalid license key");
            break;
        case "Key is revoked":
            Console.WriteLine("License has been revoked");
            break;
        case "HWID mismatch":
            Console.WriteLine("License bound to another device");
            break;
        default:
            Console.WriteLine($"Error: {result.Error}");
            break;
    }
}

Requirements

  • .NET 8.0 or later
  • Newtonsoft.Json >= 13.0.3

Support

License

MIT License


Made with ❤️ by AstraGuard

Product 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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.4 125 5/16/2026
Loading failed