Muonroi.Governance.Abstractions 1.0.0-alpha.16

This is a prerelease version of Muonroi.Governance.Abstractions.
dotnet add package Muonroi.Governance.Abstractions --version 1.0.0-alpha.16
                    
NuGet\Install-Package Muonroi.Governance.Abstractions -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.Abstractions" 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.Abstractions" Version="1.0.0-alpha.16" />
                    
Directory.Packages.props
<PackageReference Include="Muonroi.Governance.Abstractions" />
                    
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.Abstractions --version 1.0.0-alpha.16
                    
#r "nuget: Muonroi.Governance.Abstractions, 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.Abstractions@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.Abstractions&version=1.0.0-alpha.16&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Muonroi.Governance.Abstractions&version=1.0.0-alpha.16&prerelease
                    
Install as a Cake Tool

Muonroi.Governance.Abstractions

OSS contracts for license governance: the interfaces, value types, and configuration models that all Muonroi license-aware components program against.

NuGet License: Apache 2.0

This package is contracts only — it ships no runtime behavior. It defines ILicenseGuard, LicenseState, LicenseTier, the policy interfaces, fingerprint abstractions, and the full LicenseConfigs options graph. Application code, middleware, and plugin authors reference this package to stay decoupled from the concrete implementation.

The runtime implementation lives in Muonroi.Governance (OSS) and enterprise extensions in Muonroi.Governance.Enterprise.

Installation

dotnet add package Muonroi.Governance.Abstractions --prerelease

In most scenarios you depend on Muonroi.Governance or Muonroi.Governance.Enterprise instead; those packages pull this one in transitively. Depend on this package directly only when writing a plugin, adapter, or middleware that must not couple to the implementation.

Quick Start

Consuming ILicenseGuard in a service

Inject ILicenseGuard (registered by Muonroi.Governance) and call its contract methods:

using Muonroi.Governance.License;

public class ReportService(ILicenseGuard licenseGuard)
{
    public byte[] GeneratePdf(ReportRequest request)
    {
        // Throws LicenseException when the feature is not available for the current tier.
        licenseGuard.EnsureFeature("pdf.export");

        // Gate arbitrary actions — logs or throws depending on FailMode config.
        licenseGuard.EnsureValid("report.generate", actionName: "GeneratePdf");

        return BuildPdf(request);
    }

    public bool CanUseMultiTenant() =>
        licenseGuard.HasFeature(FreeTierFeatures.Premium.MultiTenant);
}

Implementing ILicenseStore in a custom adapter

using Muonroi.Governance.License;

public sealed class DatabaseLicenseStore : ILicenseStore
{
    public LicensePayload? Load() { /* read from DB */ }
    public void Save(LicensePayload payload) { /* persist to DB */ }
    public ActivationProof? LoadActivationProof() { /* ... */ }
    public void SaveActivationProof(ActivationProof proof) { /* ... */ }
    public string? LoadActivationJwt() { /* ... */ }
    public void SaveActivationJwt(string jwt) { /* ... */ }
}

// Register the custom store in the DI container before AddMuonroiGovernance().
builder.Services.AddSingleton<ILicenseStore, DatabaseLicenseStore>();

Implementing ILicenseGuardEnhancer for custom enforcement

using Muonroi.Governance.License;
using Muonroi.Governance.Abstractions.License;

public sealed class AuditLicenseEnhancer : ILicenseGuardEnhancer
{
    public void OnStartup(LicenseConfigs configs, LicenseState state)
        => Console.WriteLine($"License tier: {state.TrustedTier}");

    public void OnEnsureValid(string actionType, LicenseState state)
        => Console.WriteLine($"Checking action: {actionType}");

    public void OnRecordAction(LicenseActionContext context, LicenseState state) { }
}

Features

  • ILicenseGuard — tier query (Tier, IsFreeMode), feature gating (HasFeature, EnsureFeature), action validation (EnsureValid), chain recording (RecordAction, GetChainToken), and secure decryption (DecryptSecurely)
  • LicenseState — immutable snapshot of validity, tier, expiry, features, and ActivationProof; HasFeature delegates to LicenseCapabilityResolver with backward-compatible key resolution
  • FreeTierFeatures — well-known feature key constants for free-tier (db.query, http.request, …) and premium capabilities (multi-tenant, rule-engine, audit-trail, …)
  • LicenseConfigs — complete options graph: mode (Offline/Online), fingerprint scope, fail mode, chain storage, anti-tampering, TPM anchoring, plus nested OnlineLicenseConfigs, MEnterpriseSecurityConfigs, and MComplianceConfigs
  • ILicenseStore — load/save LicensePayload, ActivationProof, and activation JWT
  • ILicenseFingerprintProvider / IFingerprintChainStore / IFingerprintSigner — device fingerprint and chain-signing contracts
  • ILicenseGuardEnhancer — hook into startup, EnsureValid, and RecordAction without modifying the guard
  • IMPolicyDecisionService — evaluate MPolicyDecisionRequest (user, tenant, permissions bitmask, claims) and receive MPolicyDecisionResult (allowed/denied/fallback with authoritative flag)
  • IPolicyStore — load and save LicensePolicy (enforcement rules + per-feature quotas)
  • IAssemblyHashCollector — assembly integrity fingerprint contract

Configuration

LicenseConfigs is bound from appsettings.json under the "LicenseConfigs" section by the implementation packages. Key properties:

Property Default Description
Mode Offline Offline or Online activation mode
LicenseFilePath Path to the signed license file
PublicKeyPath Path to the RSA public key PEM
ActivationProofPath "licenses/activation_proof.json" RSA-signed offline proof generated during online activation
ActivationJwtPath "licenses/activation_jwt.txt" JWT for frontend license verification
FallbackToOnlineActivation true Attempt online activation when proof is absent
FingerprintScope MachineAndProject MachineAndProject or ProjectOnly
FailMode Soft Soft (log only) or Hard (throw)
EnableChain false Enable audit action chain
EnableAntiTampering false Runtime anti-tampering checks
RequireSignedPolicy false Require a valid signed policy file
{
  "LicenseConfigs": {
    "Mode": "Offline",
    "LicenseFilePath": "licenses/license.key",
    "PublicKeyPath": "licenses/public.pem",
    "FailMode": "Soft",
    "FingerprintScope": "ProjectOnly"
  }
}

API Reference

Type Purpose
ILicenseGuard Central guard: tier query, feature/action gating, chain recording, secure decryption
LicenseState Immutable license snapshot — validity, tier, expiry, features, ActivationProof
LicenseTier Enum: Free = 0, Licensed = 1, Enterprise = 2
FreeTierFeatures Well-known feature key constants; FreeTierFeatures.Premium.* for paid features
LicenseConfigs Root options model; section name "LicenseConfigs"
OnlineLicenseConfigs Online-mode sub-options: endpoint, heartbeat, certificate pinning
MEnterpriseSecurityConfigs Enterprise production security defaults (cert pinning, trusted hosts, response signatures)
MComplianceConfigs Compliance export pipeline options (NDJSON export, evidence packs, retention)
ILicenseStore Persistence contract for LicensePayload, ActivationProof, and activation JWT
ILicenseFingerprintProvider Device fingerprint generation contract
IFingerprintChainStore Chain entry persistence contract
IFingerprintSigner HMAC/RSA chain-signing contract
IFingerprintChainStore Chain persistence contract
ILicenseGuardEnhancer Extension point: OnStartup, OnEnsureValid, OnRecordAction
LicenseException Thrown by EnsureValid / EnsureFeature in Hard fail mode
LicenseActionContext Payload passed to RecordAction
LicenseExecutionContext Execution context snapshot attached to guarded actions
ProofTierAccessor Resolves the trusted tier from LicenseState + LicenseRuntimeStatus
ActivationProof RSA-signed offline activation proof
ActivationRequest / ActivationResponse Online activation API contracts
LicenseHeartbeatRequest / LicenseHeartbeatResponse Heartbeat keep-alive contracts
FingerprintChainEntry Single entry in the tamper-evident action chain
IMPolicyDecisionService Evaluates MPolicyDecisionRequestMPolicyDecisionResult
MPolicyDecisionRequest Decision input: user, tenant, action, resource, permissions, claims
MPolicyDecisionResult Decision output: IsAllowed, IsAuthoritative, UsedFallback, DecisionSource
MPolicyDecisionConfigs Configuration for the policy decision service
IPolicyStore Load/save LicensePolicy
LicensePolicy Policy document: PolicyEnforcementRules + per-feature FeatureQuota
IAssemblyHashCollector Collects assembly checksums for integrity verification

Samples

No dedicated sample exists for this package. See the implementation packages for runnable examples:

Compatibility

  • Target framework: net8.0
  • License: Apache-2.0 (OSS)

License

Licensed under the Apache License, Version 2.0.

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 (16)

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

Package Downloads
Muonroi.RuleEngine.Core

Rule Engine Core implementation for Muonroi.BuildingBlock

Muonroi.Data.EntityFrameworkCore

Entity Framework Core infrastructure for Muonroi: MDbContext with audit, soft-delete, multi-tenant filters, and repository base.

Muonroi.Caching.Memory

Multi-level in-memory + distributed cache implementation with tenant-aware key isolation and stampede protection.

Muonroi.Observability

OpenTelemetry integration for Muonroi: ActivitySource setup, metric counters, structured logging, and trace propagation.

Muonroi.Governance

OSS license governance implementation: basic license verification, capability resolution, and no-op implementations for free-tier usage.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.16 130 6/22/2026
1.0.0-alpha.15 232 5/31/2026
1.0.0-alpha.14 210 5/15/2026
1.0.0-alpha.13 176 5/2/2026
1.0.0-alpha.12 103 4/2/2026
1.0.0-alpha.11 152 4/2/2026
1.0.0-alpha.9 87 3/30/2026
1.0.0-alpha.8 183 3/28/2026
1.0.0-alpha.7 78 3/27/2026
1.0.0-alpha.5 69 3/27/2026
1.0.0-alpha.4 71 3/27/2026
1.0.0-alpha.3 69 3/27/2026
1.0.0-alpha.2 74 3/26/2026
1.0.0-alpha.1 103 3/8/2026