Muonroi.Governance
1.0.0-alpha.16
dotnet add package Muonroi.Governance --version 1.0.0-alpha.16
NuGet\Install-Package Muonroi.Governance -Version 1.0.0-alpha.16
<PackageReference Include="Muonroi.Governance" Version="1.0.0-alpha.16" />
<PackageVersion Include="Muonroi.Governance" Version="1.0.0-alpha.16" />
<PackageReference Include="Muonroi.Governance" />
paket add Muonroi.Governance --version 1.0.0-alpha.16
#r "nuget: Muonroi.Governance, 1.0.0-alpha.16"
#:package Muonroi.Governance@1.0.0-alpha.16
#addin nuget:?package=Muonroi.Governance&version=1.0.0-alpha.16&prerelease
#tool nuget:?package=Muonroi.Governance&version=1.0.0-alpha.16&prerelease
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.
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 gating —
ILicenseGuard.HasFeature()(non-throwing) andEnsureFeature()(throwing) enforce capabilities declared in the license payload. - Action-level enforcement —
EnsureValid(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-opIFingerprintChainStore/IFingerprintSignerin OSS; real implementations provided byMuonroi.Governance.Enterprise). - License info endpoint —
MapMuonroiLicenseInfoEndpoint()mapsGET /api/v1/license/inforeturning tier, validity, and an RS256 activation JWT for frontend consumers. - Policy file verification —
FilePolicyStore+PolicyVerifiervalidate a signed JSON policy file whenRequireSignedPolicy = true. - Soft/Hard fail modes —
FailMode = Softlogs license failures without throwing (developer-friendly default);Hardthrows on any invalid state. - Automatic online refresh — when
Mode = Onlineand an endpoint is configured, aLicenseRefreshHostedServiceperiodically re-validates the license in the background. - Centralized PDP integration —
AddMPolicyDecision()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,ILicenseGuardfeature/action enforcement, andMapMuonroiLicenseInfoEndpoint - Quickstart.Governance.Enterprise — same API with
Muonroi.Governance.Enterpriselayered on for anti-tampering and HMAC chain
Compatibility
- Target framework:
net8.0 - License: Apache-2.0 (OSS)
Related Packages
Muonroi.Governance.Abstractions— contracts (ILicenseGuard,LicensePayload,LicenseConfigs,ILicenseStore, etc.) consumed by this package and by EnterpriseMuonroi.Governance.Enterprise— adds anti-tampering, HMAC chain signing, compliance export, and enterprise secure-defaults on top of this packageMuonroi.Core— providesIMJsonSerializeServiceandIMDateTimeServicerequired by the license pipeline
License
Apache-2.0. See LICENSE-APACHE for details.
| Product | Versions 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. |
-
net8.0
- Muonroi.Core (>= 1.0.0-alpha.16)
- Muonroi.Core.Abstractions (>= 1.0.0-alpha.16)
- Muonroi.Governance.Abstractions (>= 1.0.0-alpha.16)
- Muonroi.Tenancy.Core (>= 1.0.0-alpha.16)
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 |