M6d.Cerebro 1.0.0

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

Cerebro C# SDK

This SDK provides reusable licensing and feature-gating primitives for any C# / ASP.NET Core application that consumes Cerebro licenses.

Project structure

The library is organized by responsibility to make navigation easier:

  • Cerebro/Licensing/Abstractions: public service contracts.
  • Cerebro/Licensing/Models: license payload and validation result models.
  • Cerebro/Licensing/Options: configurable licensing options.
  • Cerebro/Licensing/Services: default implementations.
  • Cerebro/Licensing/Extensions: DI and startup helpers.
  • Cerebro/Licensing/Constants: built-in public keys.
  • Cerebro/Licensing/AspNetCore/Abstractions: HTTP feature resolver contracts.
  • Cerebro/Licensing/AspNetCore/Options: ASP.NET Core behavior configuration.
  • Cerebro/Licensing/AspNetCore/Routing: route-to-feature mapping primitives.
  • Cerebro/Licensing/AspNetCore/Middleware: request gating middleware.
  • Cerebro/Licensing/AspNetCore/Extensions: ASP.NET Core pipeline/endpoint helpers.
  • samples: runnable example projects.

What is included

  • License key validation compatible with Cerebro-generated keys.
  • Feature extraction and feature checks from validated licenses.
  • ASP.NET Core middleware for:
    • blocking requests with invalid or expired licenses.
    • blocking requests for unlicensed features.
    • returning RFC 7807 Problem Details responses by default.
  • Configurable route-to-feature mapping.
  • Optional endpoint helper to expose licensed features.

Samples

  • samples/MinimalApiFeatureGateSample: minimal API with license validation middleware and feature gating.
  • samples/StartupStyleApiSample: class-based Startup configuration with controllers and endpoint routing.

Testing

  • Unit tests live in tests/Cerebro.Tests.
  • Run tests with bun run test (or dotnet test).

CI and releases

  • Pull requests targeting main run checks in .github/workflows/pr-checks.yml:
    • commit message linting
    • .NET build
    • unit tests
    • NuGet package packing validation
    • formatting and spellcheck
  • Pushes to main run .github/workflows/release-and-publish.yml:
    • semantic version bump based on conventional commits
    • changelog and project version updates
    • GitHub release creation
    • NuGet package publish

Required secrets for release publishing:

  • NUGET_API_KEY: NuGet.org API key with push permissions.

Installation and setup

NuGet package ID: M6d.Cerebro.

Register services in Program.cs or Startup.ConfigureServices:

using Cerebro.Licensing;
using Cerebro.Licensing.AspNetCore;
using System.Net.Http;

services.AddCerebroLicensing(
    configureLicensing: options =>
    {
        options.LicenseKeyEnvironmentVariableName = "MSR_LICENSE_KEY";
        // options.PublicKey = "..."; // optional override
    },
    configureFeatureRouting: routes =>
    {
        routes.MapFirstSegmentPrefix("kpis", "kpis");
        routes.MapFirstSegmentPrefix("plans", "plans");
        routes.MapFirstSegmentPrefix("operations", "operations");

        routes.MapPathPrefix("settings/kpis", "kpis", HttpMethod.Post, HttpMethod.Put, HttpMethod.Delete, HttpMethod.Patch);
        routes.MapPathPrefix("settings/plans", "plans", HttpMethod.Post, HttpMethod.Put, HttpMethod.Delete, HttpMethod.Patch);
    });

Add middleware in the request pipeline:

using Cerebro.Licensing.AspNetCore;

app.UseCerebroLicenseValidation();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseCerebroFeatureGating();

Optionally fail startup if the license is invalid:

using Cerebro.Licensing;

app.Services.EnsureCerebroLicenseIsValid();

Optionally expose the current license features:

using Cerebro.Licensing.AspNetCore;

app.UseEndpoints(endpoints =>
{
    endpoints.MapControllers();
    endpoints.MapCerebroLicenseFeaturesEndpoint();
});

By default, MapCerebroLicenseFeaturesEndpoint() maps GET /licenses/features.

Direct service usage

Inject ICerebroLicenseService anywhere:

public class MyService
{
    private readonly ICerebroLicenseService _licenseService;

    public MyService(ICerebroLicenseService licenseService)
    {
        _licenseService = licenseService;
    }

    public bool CanUseAdvancedReports()
    {
        return _licenseService.HasFeature("advanced_reports");
    }
}

Generate API docs

The project enables XML documentation output in the library project file. Public APIs are documented with XML comments so IDE IntelliSense and generated docs remain useful for integrators.

Compatibility details

  • License payload is decoded as UTF-16.
  • Signature verification uses RSA PKCS#1 v1.5 with MD5 hash.
  • Payload shape is expected to include: id, appId, deviceIds, expirationDate, features.
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.
  • net6.0

    • No dependencies.

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
1.0.0 218 2/14/2026