Nesco.LicenseActivation.Blazor 1.0.1

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 Nesco.LicenseActivation.Blazor --version 1.0.1
                    
NuGet\Install-Package Nesco.LicenseActivation.Blazor -Version 1.0.1
                    
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="Nesco.LicenseActivation.Blazor" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nesco.LicenseActivation.Blazor" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Nesco.LicenseActivation.Blazor" />
                    
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 Nesco.LicenseActivation.Blazor --version 1.0.1
                    
#r "nuget: Nesco.LicenseActivation.Blazor, 1.0.1"
                    
#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 Nesco.LicenseActivation.Blazor@1.0.1
                    
#: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=Nesco.LicenseActivation.Blazor&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Nesco.LicenseActivation.Blazor&version=1.0.1
                    
Install as a Cake Tool

🔐 LicenseActivation.Components

NuGet Version License: MIT .NET Blazor

A comprehensive Blazor component library for software license activation with advanced browser fingerprinting, duplicate detection, and flexible UI options.

🌟 Features

  • 🎨 Flexible UI Options

    • MudBlazor-based components for rich Material Design UI
    • Simple HTML/CSS components for lightweight deployments
    • Fully customizable styling and theming
  • 🔒 Advanced Security

    • Browser fingerprinting for device identification
    • Duplicate activation detection
    • Secure license validation with secret keys
    • Support for multiple activation constraints
  • 📱 Multi-Platform Support

    • Blazor Server
    • Blazor WebAssembly
    • Blazor Hybrid applications
  • 🛠️ Developer-Friendly

    • Clean service-based architecture
    • Dependency injection support
    • Comprehensive API for customization
    • TypeScript-quality IntelliSense

📦 Installation

Package Manager Console

Install-Package Nesco.LicenseActivation.Blazor

Components Available

This package provides two license activation components:

  1. LicenseActivationComponent - Full-featured component using MudBlazor
  2. BasicLicenseActivationComponent - Lightweight component using only HTML/CSS/JS

Choose the component that best fits your project requirements:

When to use LicenseActivationComponent:

  • ✅ Your project already uses MudBlazor
  • ✅ You want a professional Material Design UI
  • ✅ You need advanced UI features and animations
  • ✅ You prefer the pre-built sophisticated design

When to use BasicLicenseActivationComponent:

  • ✅ Your project doesn't use MudBlazor
  • ✅ You want to minimize dependencies
  • ✅ You need a lightweight solution
  • ✅ You want to customize the styling completely
  • ✅ You're building a minimal or headless application

Quick Start

1. Add Services to Program.cs
using LicenseActivation.BlazorComponent.Extensions;
using MudBlazor.Services;

var builder = WebApplication.CreateBuilder(args);

// Add MudBlazor services (required)
builder.Services.AddMudServices();

// Add License Activation component services
builder.Services.AddLicenseActivationComponent();

// Add other services...
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();

var app = builder.Build();

// Configure pipeline...
app.UseStaticFiles();
app.UseRouting();
app.MapRazorPages();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");

app.Run();
2. Add Component to Your Page
@page "/license"
@using LicenseActivation.BlazorComponent

<LicenseActivationComponent 
    ApiBaseUrl="https://your-license-api.com"
    OnActivationSuccess="OnActivationSuccess"
    OnActivationError="OnActivationError"
    OnShowMessage="OnShowMessage" />

@code {
    private async Task OnActivationSuccess(LicenseActivationResult result)
    {
        // Handle successful activation
        Console.WriteLine($"License activated: {result.ProductName}");
    }

    private async Task OnActivationError(string error)
    {
        // Handle activation error
        Console.WriteLine($"Activation failed: {error}");
    }

    private async Task OnShowMessage(LicenseActivationMessage message)
    {
        // Handle user messages (optional - for custom notifications)
        Console.WriteLine($"{message.Type}: {message.Message}");
    }
}
3. Or Use the Pre-built Page

Add the route to your app and the component will be available at /license-activation:

@page "/license"
@using LicenseActivation.BlazorComponent

<LicenseActivationPage ApiBaseUrl="https://your-license-api.com" />

Option B: Using Basic Component (No MudBlazor Required)

For projects that don't use MudBlazor, use the basic component:

1. Add Services to Program.cs
using LicenseActivation.BlazorComponent.Extensions;

var builder = WebApplication.CreateBuilder(args);

// Add License Activation component services (no MudBlazor required)
builder.Services.AddLicenseActivationComponent();

// Configure the API base URL
builder.Services.Configure<LicenseActivationSettings>(options =>
{
    options.ApiBaseUrl = builder.Configuration["LicenseApi:BaseUrl"] ?? "https://localhost:7139";
});

// Add other services...
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();

var app = builder.Build();

// Configure pipeline...
app.UseStaticFiles();
app.UseRouting();
app.MapRazorPages();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");

app.Run();
2. Add Basic Component to Your Page
@page "/license"
@using LicenseActivation.BlazorComponent

<BasicLicenseActivationComponent 
    ApiBaseUrl="https://your-license-api.com"
    OnActivationSuccess="OnActivationSuccess"
    OnActivationError="OnActivationError"
    OnShowMessage="OnShowMessage" />

@code {
    private async Task OnActivationSuccess(LicenseActivationResult result)
    {
        // Handle successful activation
        Console.WriteLine($"License activated: {result.ProductName}");
    }

    private async Task OnActivationError(string error)
    {
        // Handle activation error
        Console.WriteLine($"Activation failed: {error}");
    }

    private async Task OnShowMessage(LicenseActivationMessage message)
    {
        // Handle user messages
        Console.WriteLine($"{message.Type}: {message.Message}");
    }
}
3. Or Use the Pre-built Basic Page

Add the route to your app and the component will be available at /basic-license-activation:

@page "/license"
@using LicenseActivation.BlazorComponent

<BasicLicenseActivationPage ApiBaseUrl="https://your-license-api.com" />

Configuration Options

Both LicenseActivationComponent and BasicLicenseActivationComponent support the following parameters:

Parameter Type Default Description
ApiBaseUrl string "" Required. The base URL of your license activation API
Description string Default text Description shown above the file upload
ShowFingerprintTest bool true Whether to show the fingerprint test button
ShowFingerprintInfo bool true Whether to show fingerprinting information
ShowResponse bool true Whether to show the API response section
ShowHistory bool true Whether to show activation history

Events

The component provides three main events:

OnActivationSuccess

Fired when license activation succeeds:

private async Task OnActivationSuccess(LicenseActivationResult result)
{
    // result.Success - Always true for this event
    // result.LicenseKey - The activated license key
    // result.ActivationId - Unique activation identifier
    // result.ProductName - Name of the licensed product
    // result.LicensedTo - Who the license is registered to
    // result.ExpiryDate - When the license expires (if applicable)
    // result.Params - Product-specific parameters (JSON string)
    // result.Response - Raw API response
}

OnActivationError

Fired when license activation fails:

private async Task OnActivationError(string error)
{
    // error - Description of what went wrong
}

OnShowMessage

Fired when the component wants to show a message to the user:

private async Task OnShowMessage(LicenseActivationMessage message)
{
    // message.Message - The message text
    // message.Type - Info, Success, Warning, or Error
}

License File Format

The component expects license files in JSON format:

{
  "LicenseKey": "12345678-1234-1234-1234-123456789012",
  "SecretKey": "your-secret-key-here",
  "Params": "{\"features\": [\"feature1\", \"feature2\"], \"maxUsers\": 100}"
}

Note: The Params field is optional and contains product-specific parameters as a JSON string. It can be used to pass configuration, feature flags, limits, or any custom data specific to your product.

API Integration

Your license activation API should support the following endpoints:

POST /api/LicenseActivation/check-duplicate

Check for duplicate activations before activating.

Request:

{
  "LicenseKey": "guid",
  "SecretKey": "string",
  "MachineId": "string",
  "ApplicationVersion": "string",
  "MachineFingerprint": "string"
}

Response:

{
  "HasDuplicate": false,
  "ClientType": "Web Browser",
  "MachineFingerprint": "fingerprint-hash",
  "ExistingActivation": null
}

POST /api/LicenseActivation/activate

Activate the license.

Request:

{
  "LicenseKey": "guid",
  "SecretKey": "string",
  "MachineId": "string",
  "ApplicationVersion": "string",
  "MachineFingerprint": "string",
  "ForceDuplicateActivation": false
}

Response:

{
  "Success": true,
  "ActivationId": "guid",
  "LicenseKey": "guid",
  "ProductName": "Your Product",
  "LicensedTo": "Customer Name",
  "ExpiryType": "FixedDate",
  "ExpiryDate": "2024-12-31T23:59:59Z",
  "MaxActivations": 5,
  "CurrentActivations": 1,
  "ActivatedAt": "2024-01-01T10:00:00Z",
  "Params": "{\"features\": [\"feature1\", \"feature2\"], \"maxUsers\": 100}"
}

POST /api/LicenseActivation/heartbeat/{activationId}

Send heartbeat to check license validity and update last heartbeat timestamp.

Path Parameters:

  • activationId (Guid) - The activation ID to check

Request: No request body required.

Response:

{
  "isValid": true,
  "isActiveActivation": true,
  "isValidLicense": true,
  "activationId": "guid",
  "licenseKey": "guid", 
  "productName": "Your Product",
  "licensedTo": "Customer Name",
  "expiryType": "FixedDate",
  "expiryDate": "2024-12-31T23:59:59Z",
  "expiryDays": null,
  "activatedAt": "2024-01-01T10:00:00Z",
  "lastHeartbeat": "2024-01-15T14:30:00Z",
  "params": "{\"features\": [\"feature1\", \"feature2\"], \"maxUsers\": 100}"
}

Heartbeat Functionality

Both LicenseActivationComponent and BasicLicenseActivationComponent include a heartbeat helper method:

// Get a reference to the component
@ref var activationComponent

// Call heartbeat method
var response = await activationComponent.SendHeartbeatAsync(activationId);

if (response != null && response.IsValid)
{
    // License is valid
    Console.WriteLine($"License valid for {response.ProductName}");
    Console.WriteLine($"Expires: {response.ExpiryDate}");
}
else
{
    // License is invalid or expired
    Console.WriteLine("License is no longer valid");
}

The heartbeat method:

  • Checks if the license activation is still valid
  • Updates the last heartbeat timestamp on the server
  • Returns comprehensive license status information
  • Automatically shows success/warning messages to the user

Browser Fingerprinting

The component uses advanced browser fingerprinting to create unique device identifiers:

  • User Agent - Browser and OS information
  • Screen Properties - Resolution, color depth, pixel depth
  • Hardware - CPU cores, memory (if available)
  • WebGL - Graphics card vendor and renderer
  • Canvas - Unique rendering characteristics
  • Audio - Audio context fingerprinting
  • Fonts - Available system fonts
  • Timezone - User's timezone and offset
  • Storage - Available storage types
  • Network - Connection information (if available)

All properties are hashed using SHA-256 to create a unique fingerprint while maintaining privacy.

Styling

The component uses MudBlazor components and follows Material Design principles. You can customize the appearance using MudBlazor's theming system.

Requirements

  • .NET 9.0 or later
  • Blazor Server or Blazor WebAssembly
  • MudBlazor 8.0 or later

Browser Support

  • Chrome/Edge 88+
  • Firefox 85+
  • Safari 14+
  • Mobile browsers with modern JavaScript support

License

MIT License - see LICENSE file for details.

Support

For issues and questions:

  • Create an issue on GitHub
  • Check the documentation
  • Review the sample implementations

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Submit a pull request

Built with ❤️ using Blazor and MudBlazor

Product Compatible and additional computed target framework versions.
.NET 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. 
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