AstraGuard.SDK
1.0.0
dotnet add package AstraGuard.SDK --version 1.0.0
NuGet\Install-Package AstraGuard.SDK -Version 1.0.0
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="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AstraGuard.SDK" Version="1.0.0" />
<PackageReference Include="AstraGuard.SDK" />
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 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AstraGuard.SDK, 1.0.0"
#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@1.0.0
#: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=1.0.0
#tool nuget:?package=AstraGuard.SDK&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
🛡️ AstraGuard.SDK - Stripe for Software Licensing
The modern .NET SDK for protecting your applications with license management.
🚀 Quick Start
Installation
dotnet add package AstraGuard.SDK
Basic Usage (One-Liner)
using AstraGuard.SDK;
var guard = new AstraGuardClient(
apiUrl: "https://api.astraguard.io",
productId: "YOUR-PRODUCT-ID"
);
// One-liner protection: Verify license or exit automatically
await guard.VerifyOrExit(userLicenseKey);
// ✅ Your application code runs here - license is valid!
RunYourApplication();
That's it! Your application is now protected.
📦 Features
✅ License Validation
- HWID Binding: Lock licenses to specific devices
- Auto-Verification: Automatic hardware ID generation
- Instant Validation: Fast API verification
📡 Cloud Configuration
- Remote Control: Change settings without redistributing
- Kill Switch: Emergency shutdown capability
- Feature Toggles: Enable/disable features remotely
- Live Updates: Configuration updates during runtime
🔒 Security Features
- Anti-Debug: Detect and block debuggers
- Code Integrity: Detect file tampering
- Heartbeat Monitoring: Continuous license validation
- Event Handlers: React to security events
🎯 Developer-Friendly
- One-Liner Protection: Minimal integration code
- Full Control: Advanced API for custom workflows
- Type-Safe: Full C# type safety
- Well-Documented: Comprehensive examples
💡 Usage Examples
1. Basic Protection
var guard = new AstraGuardClient("https://api.astraguard.io", "PRODUCT-ID");
// Simple verify and exit
await guard.VerifyOrExit(licenseKey);
// Your app runs here
Console.WriteLine("✅ Licensed application running!");
2. Advanced Protection with All Features
var guard = new AstraGuardClient("https://api.astraguard.io", "PRODUCT-ID");
// Enable security features
guard.EnableAntiDebug();
// guard.EnableCodeIntegrity("YOUR-EXECUTABLE-HASH");
// Event handlers
guard.OnLicenseInvalid += (s, e) => Console.WriteLine("License invalid!");
guard.OnCloudConfigUpdated += (s, config) => UpdateFeatures(config);
// Verify license
var result = await guard.VerifyLicense(licenseKey);
if (!result.Valid)
{
Console.WriteLine($"Invalid: {result.Error}");
return;
}
// Start heartbeat for continuous validation
guard.StartHeartbeat(TimeSpan.FromMinutes(5));
// Your application
RunApp();
// Cleanup
guard.StopHeartbeat();
guard.Dispose();
3. Cloud Configuration
// Check maintenance mode (kill switch)
if (guard.IsMaintenanceMode())
{
Console.WriteLine("App is in maintenance - exiting");
return;
}
// Get custom variables
string? motd = guard.GetCloudVariable("motd");
Console.WriteLine($"Message: {motd}");
// Feature toggles
bool premiumEnabled = guard.GetCloudVariable("premium_mode") == "true";
if (premiumEnabled)
{
EnablePremiumFeatures();
}
// 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
string customHwid = "MY-CUSTOM-DEVICE-ID";
await guard.VerifyLicense(licenseKey, customHwid);
// Get the auto-generated HWID
string hwid = AstraGuardClient.GetMachineId();
Console.WriteLine($"Device ID: {hwid}");
🌐 Cloud Configuration Examples
Set these in your AstraGuard Dashboard → Products → Cloud Config:
Message of the Day
Key: motd
Value: 🎉 Welcome to Summer Sale! Get 20% off upgrades!
Kill Switch (Maintenance Mode)
Key: status
Value: maintenance
Feature Toggles
Key: premium_mode
Value: true
API Endpoints
Key: api_endpoint
Value: https://api.yourservice.com/v2
Game Hacking: Memory Offsets
Key: OFFSET_PLAYER_BASE
Value: 0x1A2B3C4D
🔐 Security Features
Anti-Debug Protection
guard.EnableAntiDebug(onDetected: () =>
{
Console.WriteLine("Debugger detected!");
// Custom action before exit
});
Code Integrity Verification
// Get your app's hash (run once, store on server)
string hash = CodeIntegrity.GetExecutableHash();
Console.WriteLine($"Hash: {hash}");
// Enable integrity checking
guard.EnableCodeIntegrity(hash, onTampered: () =>
{
Console.WriteLine("App has been modified!");
});
Heartbeat Monitoring
// Continuous validation every 5 minutes
guard.StartHeartbeat(
interval: TimeSpan.FromMinutes(5),
onInvalid: () =>
{
Console.WriteLine("License became invalid!");
// App will auto-exit
}
);
📊 API Reference
AstraGuardClient
Constructor
AstraGuardClient(string apiUrl, string productId)
Methods
Task<LicenseResponse> VerifyLicense(string key, string? hwid = null)Task VerifyOrExit(string key, string? hwid = null, string? exitMessage = null)void StartHeartbeat(TimeSpan? interval = null, Action? onInvalid = null)void StopHeartbeat()void EnableAntiDebug(Action? onDetected = null)void EnableCodeIntegrity(string expectedHash, Action? onTampered = null)string? GetCloudVariable(string key)bool IsMaintenanceMode()static string GetMachineId()
Properties
Dictionary<string, string> CloudConfig- All cloud variablesLicenseDetails? CurrentLicense- Current license info
Events
EventHandler? OnLicenseInvalidEventHandler<Dictionary<string, string>>? OnCloudConfigUpdated
🎯 Integration Workflow
- Developer (Hans Peter) creates account on AstraGuard
- Creates product in Dashboard (gets Product ID)
- Generates license keys for customers
- Integrates SDK into his application:
await guard.VerifyOrExit(licenseKey); - Distributes app to customers
- Customer enters license key → App validates → Runs!
- Hans Peter can:
- Revoke licenses remotely
- Send messages via Cloud Config
- Enable/disable features
- Emergency shutdown (kill switch)
🛠️ 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;
}
return;
}
📞 Support
- Docs: https://docs.astraguard.io
- Discord: https://discord.gg/4AZRBNgVp6
- Email: support@astraguard.io
- GitHub: https://github.com/astraguard/sdk
📄 License
MIT License - See LICENSE file for details
Made with 💜 by AstraGuard
Stripe for Software Licensing
| 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 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.
-
net8.0
- Newtonsoft.Json (>= 13.0.3)
- System.Management (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.