Muonroi.Governance 1.0.0-alpha.16

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

Muonroi.Governance

OSS license protection for the Muonroi open-core stack: tier resolution, feature gating, action-chain audit, and policy enforcement — all in one call.

NuGet License: Apache 2.0

Muonroi.Governance implements the OSS (Free tier) license pipeline. It loads and verifies a license payload (offline or online), resolves the effective LicenseTier, and exposes ILicenseGuard as a scoped service. Applications that need no paid license run transparently in Free tier with no configuration required. Premium enforcement (anti-tampering, HMAC action chains, enterprise secure-defaults) is layered on by Muonroi.Governance.Enterprise without changing any registration call.

Installation

dotnet add package Muonroi.Governance --prerelease

Quick Start

// Program.cs
using Muonroi.Governance.License;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);

// Required helpers (or supply via Muonroi.Core's AddCoreServices())
builder.Services.AddSingleton<IMJsonSerializeService, MJsonSerializeService>();
builder.Services.AddSingleton<IMDateTimeService, MDateTimeService>();

// Register OSS license protection — binds "LicenseConfigs" config section.
// With no license file the app resolves to Free tier automatically.
builder.Services.AddLicenseProtection(builder.Configuration);

builder.Services.AddControllers();
WebApplication app = builder.Build();

// Exposes GET /api/v1/license/info (tier + activation JWT for frontend).
app.MapMuonroiLicenseInfoEndpoint();

app.MapControllers();
app.Run();

Inject ILicenseGuard in any controller or service:

public class MyService(ILicenseGuard guard)
{
    public void DoWork()
    {
        // Non-throwing probe
        if (!guard.HasFeature("multi-tenant"))
        {
            // run free-tier path
            return;
        }

        // Throwing enforcement — throws MInternalException when feature absent
        guard.EnsureFeature("rule-engine");

        // Action-level validation (also records chain entry when EnableChain = true)
        guard.EnsureValid("export.pdf");
    }
}

Features

  • Offline and online license verification — loads a local license file and/or validates against a remote endpoint. Falls back to Free tier when neither is present.
  • Tier-aware feature gatingILicenseGuard.HasFeature() (non-throwing) and EnsureFeature() (throwing) enforce capabilities declared in the license payload.
  • Action-level enforcementEnsureValid(actionType) validates and optionally records the action to the audit chain.
  • Audit action chain — when EnableChain = true, RecordAction() appends HMAC-signed entries per tenant partition (no-op IFingerprintChainStore / IFingerprintSigner in OSS; real implementations provided by Muonroi.Governance.Enterprise).
  • License info endpointMapMuonroiLicenseInfoEndpoint() maps GET /api/v1/license/info returning tier, validity, and an RS256 activation JWT for frontend consumers.
  • Policy file verificationFilePolicyStore + PolicyVerifier validate a signed JSON policy file when RequireSignedPolicy = true.
  • Soft/Hard fail modesFailMode = Soft logs license failures without throwing (developer-friendly default); Hard throws on any invalid state.
  • Automatic online refresh — when Mode = Online and an endpoint is configured, a LicenseRefreshHostedService periodically re-validates the license in the background.
  • Centralized PDP integrationAddMPolicyDecision() connects to an OPA or OpenFGA policy decision point for authorization decisions alongside the license layer.

Configuration

AddLicenseProtection

Bound from the "LicenseConfigs" section:

{
  "LicenseConfigs": {
    "Mode": "Offline",
    "FailMode": "Soft",
    "LicenseFilePath": "licenses/license.json",
    "PublicKeyPath": "licenses/public.pem",
    "ActivationProofPath": "licenses/activation_proof.json",
    "ActivationJwtPath": "licenses/activation_jwt.txt",
    "FallbackToOnlineActivation": true,
    "FingerprintScope": "MachineAndProject",
    "ProjectSeed": "<your-seed>",
    "EnableChain": false,
    "EnableAntiTampering": false,
    "FailMode": "Soft",
    "RequireSignedPolicy": false,
    "Online": {
      "Endpoint": "https://license.muonroi.com",
      "TimeoutSeconds": 10,
      "RefreshMinutes": 1440
    }
  }
}

Key LicenseConfigs properties:

Property Default Description
Mode Offline Offline or Online
FailMode Soft Soft = log only; Hard = throw
LicenseFilePath null Path to signed license JSON
FingerprintScope MachineAndProject MachineAndProject or ProjectOnly
EnableChain false Enable HMAC action-chain audit
EnableAntiTampering false Enable anti-tampering checks (Enterprise)
RequireSignedPolicy false Reject startup if policy file absent/invalid
FallbackToOnlineActivation true Auto-activate online when no proof found

AddMPolicyDecision

Optional. Binds from the "MPolicyDecision" section:

{
  "MPolicyDecision": {
    "Enabled": true,
    "Provider": "Opa",
    "Endpoint": "http://opa-service:8181",
    "TimeoutSeconds": 5,
    "FailureMode": "FallbackToLocal",
    "EnableDecisionLogging": true
  }
}

API Reference

Type Purpose
ILicenseGuard Primary guard: Tier, IsFreeMode, HasFeature(), EnsureFeature(), EnsureValid(), RecordAction()
LicenseState Resolved license snapshot: IsValid, IsExpired, TrustedTier, Features, OrganizationName
LicenseTier Enum: Free = 0, Licensed = 1, Enterprise = 2
LicenseConfigs Strongly typed config; section name "LicenseConfigs"
ITenantLicenseFeatureGate Per-tenant feature gate adapter (scoped)
ILicenseStore Loads/saves license payload and activation proof
ILicenseActivationService Activates a license key against the license server
IMPolicyDecisionService Evaluates authorization decisions via OPA or OpenFGA
MPolicyDecisionConfigs Config for PDP integration; section name "MPolicyDecision"
LicenseInfoEndpointExtensions MapMuonroiLicenseInfoEndpoint() — serves tier + JWT to frontend

Samples

  • Quickstart.Governance — minimal ASP.NET Core API demonstrating AddLicenseProtection, ILicenseGuard feature/action enforcement, and MapMuonroiLicenseInfoEndpoint
  • Quickstart.Governance.Enterprise — same API with Muonroi.Governance.Enterprise layered on for anti-tampering and HMAC chain

Compatibility

  • Target framework: net8.0
  • License: Apache-2.0 (OSS)
  • Muonroi.Governance.Abstractions — contracts (ILicenseGuard, LicensePayload, LicenseConfigs, ILicenseStore, etc.) consumed by this package and by Enterprise
  • Muonroi.Governance.Enterprise — adds anti-tampering, HMAC chain signing, compliance export, and enterprise secure-defaults on top of this package
  • Muonroi.Core — provides IMJsonSerializeService and IMDateTimeService required by the license pipeline

License

Apache-2.0. See LICENSE-APACHE for details.

Product 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.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Muonroi.Governance:

Package Downloads
Muonroi.AspNetCore

ASP.NET Core integration: auto-CRUD controllers, middleware pipeline, license protection, and Muonroi hosting extensions.

Muonroi.BuildingBlock.All

Metapackage for Muonroi Building Block - Includes all sub-packages for a complete infrastructure setup.

Muonroi.Governance.Enterprise

Package Description

Muonroi.Pdf.Governance

CSS policy enforcement and HTML/CSS parsing adapters for Muonroi PDF rendering.

muonroi-mcp-dev

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.16 74 6/22/2026
1.0.0-alpha.15 120 5/31/2026
1.0.0-alpha.14 105 5/15/2026
1.0.0-alpha.13 85 5/2/2026
1.0.0-alpha.12 77 4/2/2026
1.0.0-alpha.11 127 4/2/2026
1.0.0-alpha.9 74 3/30/2026
1.0.0-alpha.8 158 3/28/2026
1.0.0-alpha.7 69 3/27/2026
1.0.0-alpha.5 64 3/27/2026
1.0.0-alpha.4 73 3/27/2026
1.0.0-alpha.3 62 3/27/2026
1.0.0-alpha.2 65 3/26/2026
1.0.0-alpha.1 78 3/8/2026