IronLicensing SDK for .NET
Go to file
David Friedel c962ddb635 Update README with branded header and documentation links
- Add centered logo and title with product branding
- Add links to product website and documentation
- Add NuGet badge
- Add Other SDKs table with cross-references
- Add Support section with dev@ironservices.io email
- Update repository links to git.marketally.com

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 11:08:29 +00:00
Exceptions Initial commit: IronLicensing.Client SDK 2025-12-25 09:07:58 +00:00
Extensions Initial commit: IronLicensing.Client SDK 2025-12-25 09:07:58 +00:00
Models Initial commit: IronLicensing.Client SDK 2025-12-25 09:07:58 +00:00
Platforms Initial commit: IronLicensing.Client SDK 2025-12-25 09:07:58 +00:00
.gitignore Initial commit: IronLicensing.Client SDK 2025-12-25 09:07:58 +00:00
ILicenseCache.cs Initial commit: IronLicensing.Client SDK 2025-12-25 09:07:58 +00:00
ILicenseManager.cs Initial commit: IronLicensing.Client SDK 2025-12-25 09:07:58 +00:00
IMachineIdentifier.cs Initial commit: IronLicensing.Client SDK 2025-12-25 09:07:58 +00:00
ISignatureVerifier.cs Initial commit: IronLicensing.Client SDK 2025-12-25 09:07:58 +00:00
IronLicensing.Client.csproj UserJourney 2025-12-26 06:14:08 -05:00
LICENSE Initial commit: IronLicensing.Client SDK 2025-12-25 09:07:58 +00:00
LicenseManager.cs Initial commit: IronLicensing.Client SDK 2025-12-25 09:07:58 +00:00
LicensingOptions.cs Initial commit: IronLicensing.Client SDK 2025-12-25 09:07:58 +00:00
MachineIdentifier.cs Initial commit: IronLicensing.Client SDK 2025-12-25 09:07:58 +00:00
README.md Update README with branded header and documentation links 2025-12-27 11:08:29 +00:00
RsaSignatureVerifier.cs Initial commit: IronLicensing.Client SDK 2025-12-25 09:07:58 +00:00
SecureStorageLicenseCache.cs Initial commit: IronLicensing.Client SDK 2025-12-25 09:07:58 +00:00
nuget_il.png UserJourney 2025-12-26 06:14:08 -05:00

README.md

IronLicensing

IronLicensing SDK for .NET

Software licensing and activation for .NET applications

NuGet License: MIT

WebsiteDocumentation.NET GuideGit


IronLicensing helps you protect your software with flexible licensing, activations, and feature management. Built for developers who want simple, powerful licensing without the complexity.

Installation

dotnet add package IronLicensing.Client

Quick Start

1. Register Services

using IronLicensing.Client.Extensions;

builder.Services.AddIronLicensing(options =>
{
    options.PublicKey = "pk_live_xxxxxxxxxx";
    options.ProductSlug = "my-product";
    options.OfflineGraceDays = 7;
});

2. Validate a License

using IronLicensing.Client;

public class MyViewModel
{
    private readonly ILicenseManager _license;

    public MyViewModel(ILicenseManager license)
    {
        _license = license;
    }

    public async Task ValidateLicenseAsync()
    {
        var result = await _license.ValidateAsync("IRON-XXXX-XXXX-XXXX-XXXX");

        if (result.Success)
        {
            Console.WriteLine($"Licensed! Tier: {result.License.Tier}");
        }
        else
        {
            Console.WriteLine($"Error: {result.ErrorMessage}");
        }
    }
}

3. Feature Gating

// Check if feature is available
if (_license.HasFeature("advanced-reports"))
{
    ShowAdvancedReports();
}

// Or throw if feature is required
_license.RequireFeature("advanced-reports"); // throws LicenseRequiredException

Configuration Options

builder.Services.AddIronLicensing(options =>
{
    // Required
    options.PublicKey = "pk_live_xxxxxxxxxx";
    options.ProductSlug = "my-product";

    // Offline support
    options.OfflineGraceDays = 7;           // Days license is valid offline
    options.RequireSignatureForOffline = true;  // Require signed license for offline

    // API settings
    options.ApiBaseUrl = "https://ironlicensing.com";
    options.HttpTimeout = TimeSpan.FromSeconds(30);

    // In-app purchase URLs
    options.SuccessUrl = "myapp://purchase/success";
    options.CancelUrl = "myapp://purchase/cancel";
});

License Activation

// Activate a license key
var result = await _license.ActivateAsync("IRON-XXXX-XXXX-XXXX-XXXX");

if (result.Success)
{
    // License is now active on this device
    Console.WriteLine($"Activated! {_license.CurrentLicense.ActivationsUsed}/{_license.CurrentLicense.ActivationsMax}");
}

// Deactivate (free up activation slot)
await _license.DeactivateAsync();

Trial Support

// Start a trial
var success = await _license.StartTrialAsync("user@example.com");

if (success)
{
    Console.WriteLine($"Trial started! {_license.TrialDaysRemaining} days remaining");
}

// Check trial status
if (_license.IsTrial)
{
    ShowTrialBanner(_license.TrialDaysRemaining);
}

In-App Purchase

// Start checkout flow
var checkout = await _license.StartPurchaseAsync("tier-id", "customer@example.com");

if (checkout.Success)
{
    // Open checkout URL in browser
    await Launcher.OpenAsync(checkout.CheckoutUrl);
}

Events

// Listen for license changes
_license.LicenseChanged += (sender, args) =>
{
    Console.WriteLine($"License changed from {args.OldLicense?.Status} to {args.NewLicense?.Status}");
};

// Listen for validation results
_license.ValidationCompleted += (sender, args) =>
{
    if (!args.Success)
    {
        Console.WriteLine($"Validation failed: {args.ErrorCode} - {args.ErrorMessage}");
    }
};

License Status

// Quick status checks
bool isLicensed = _license.IsLicensed;  // Active or Trial
bool isTrial = _license.IsTrial;
LicenseStatus status = _license.Status;  // Active, Trial, Expired, Suspended, Revoked

// Full license info
var license = _license.CurrentLicense;
Console.WriteLine($"Tier: {license.Tier}");
Console.WriteLine($"Expires: {license.ExpiresAt}");
Console.WriteLine($"Features: {string.Join(", ", license.Features)}");

Offline Support

Licenses are cached locally with cryptographic signatures for secure offline validation:

  • Grace Period: Configurable days the license is valid without server contact
  • Signature Verification: Optional RSA signature verification for offline licenses
  • Automatic Sync: License is re-validated when connectivity is restored
// Clear cached license
await _license.ClearCacheAsync();

Platform Support

Platform Minimum Version
Android 5.0 (API 21)
iOS 15.0
macOS (Catalyst) 15.0
Windows 10.0.17763.0

Documentation

For complete documentation, visit ironlicensing.com/docs.

Other SDKs

Platform Package
JavaScript/TypeScript @ironservices/licensing
Python ironlicensing
Go ironlicensing-go
Java ironlicensing-java
Rust ironlicensing

Support

License

MIT License - see LICENSE for details.