Mnm.Cerebro
1.0.0
dotnet add package Mnm.Cerebro --version 1.0.0
NuGet\Install-Package Mnm.Cerebro -Version 1.0.0
<PackageReference Include="Mnm.Cerebro" Version="1.0.0" />
<PackageVersion Include="Mnm.Cerebro" Version="1.0.0" />
<PackageReference Include="Mnm.Cerebro" />
paket add Mnm.Cerebro --version 1.0.0
#r "nuget: Mnm.Cerebro, 1.0.0"
#:package Mnm.Cerebro@1.0.0
#addin nuget:?package=Mnm.Cerebro&version=1.0.0
#tool nuget:?package=Mnm.Cerebro&version=1.0.0
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-basedStartupconfiguration with controllers and endpoint routing.
Testing
- Unit tests live in
tests/Cerebro.Tests. - Run tests with
bun run test(ordotnet test).
CI and releases
- Pull requests targeting
mainrun checks in.github/workflows/pr-checks.yml:- commit message linting
- .NET build
- unit tests
- NuGet package packing validation
- formatting and spellcheck
- Pushes to
mainrun.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: Mnm.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 | Versions 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. |
-
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 | 98 | 2/14/2026 |