.NET client reference
This page lists the configuration options and consumer surface of the .NET client SDK (targets netstandard2.1).
The SDK is two public NuGet packages, and dotnet add package Sidub.Licensing.Client brings in
both: Sidub.Licensing.Client defines the registration entry point (AddSidubLicensing()),
while the types you program against — LicensingServiceOptions, ILicensingService,
LicensingContextAccessor, LicensingServiceReference — live in the core Sidub.Licensing
package it depends on, under the Sidub.Licensing and Sidub.Licensing.Services namespaces.
LicensingServiceOptions fields
Section titled “LicensingServiceOptions fields”| Field | Meaning |
|---|---|
LicenseServiceUri |
The licensing API URL to call. Required. |
ConsumptionServiceUri |
The consumption API URL to call. Optional; set it when you report usage. |
EncodedCredential |
The encoded credential (SIDUB_LIC_...) carrying the seat id, the service key and the seat’s runtime token. The recommended way to configure credentials. |
ServiceKeyVersion |
Server-side key registration only; not part of the encoded credential. |
BillableResourceId |
Optional resource id to attribute metered consumption to. |
IssuerClientId |
The seller’s client id, applied to embedded checkout requests that do not specify one. |
AuthorizationTimeoutSeconds |
Per-attempt time budget for the authorization fetch. Default 10; values below 1 are clamped to 1. |
AuthorizationStaleGraceMinutes |
How long the last verified authorization may be served past expiry when a refresh fails because the service is unreachable. Default 60; 0 disables grace. A denial or signature failure is never served stale. |
ILicensingService members
Section titled “ILicensingService members”| Member | Purpose |
|---|---|
GetAuthorization |
Retrieves the current authorization for the configured seat. |
GetLicenseFeature<T> |
Retrieves a specific license feature by type. Returns null when the feature is absent from the license — check before using the result. |
PerformOperation<TFeature,TState> |
Performs an operation against a feature, carrying state through the call. |
AssertLicense |
Confirms the license satisfies a given assertion, and returns whether it holds. |
GetLicenseFeatureState<TFeature,TState> |
Retrieves the current state of a license feature — for a rate-limited feature, its consumption. |
SetLicenseFeatureState<TFeature,TState> |
Sets the state of a license feature. |
Every member takes two leading arguments: a LicensingServiceReference identifying the
configured service, and the resolved LicensingContext carrying the credential —
GetAuthorization(serviceReference, context). LicensingContextAccessor resolves the context
for you, and the AI-assisted path’s implement_base output shows the wiring end to end; see
AI-assisted setup.
Supporting types
Section titled “Supporting types”| Type | Meaning |
|---|---|
LicensingContextAccessor |
Provides access to the current licensing context. |
LicensingServiceReference |
A reference to the configured licensing service. |
LicensingCredential |
The decoded SIDUB_LIC_... value: SeatId, ServiceKeyId, ServiceKeyPublicMember and RuntimeToken. CurrentVersion is 2; ToEncodedString() writes it back. A version 1 payload named the seat LicenseId and is refused, not reinterpreted. |
Credentials
Section titled “Credentials”LicensingCredential and LicensingContext carry one secret: RuntimeToken, a seat-scoped
token that authorizes and meters the one seat it names. LicensingContext requires it, and
there is no account key on either type — the account API key is a server-side seller identity and
never travels inside a credential (MON-374).
The SDK calls {LicenseServiceUri}/runtime and {ConsumptionServiceUri}/runtime and presents the
token as Authorization: Bearer. The /runtime suffixes are derived by the SDK, so set
LicenseServiceUri and ConsumptionServiceUri to the plain addresses. The service-path constants
are on LicensingServiceReference as LicensingApiRuntimeServicePath (.Api.Runtime) and
LicensingConsumptionRuntimeServicePath (.Consumption.Runtime).
LicensingContextAccessor refuses a context with no RuntimeToken, with
LicensingConfigurationException. ILicenseAuthorizationProvider.GetAuthorization takes the token
directly:
GetAuthorization(LicensingServiceReference serviceReference, Guid seatId, string? runtimeToken = null).
A null token is legitimate — a server-mode composition authorizes locally and reaches no
gateway.
Errors
Section titled “Errors”API failures throw LicensingApiException (namespace Sidub.Licensing.Exceptions), carrying
the same error contract every HTTP surface returns:
| Member | Meaning |
|---|---|
Code |
Machine-readable error code (PascalCase — e.g. ValidationError, AuthorizationDenied, NotFound, ServerError). Branch on this, not on message text. |
Message |
The server’s human-readable description (falls back to a client description when no body was received). |
CorrelationId |
The id the server logged the failure under — quote it when contacting support. |
StatusCode |
The HTTP status of the failed response, when one was received. |
Details |
Structured per-field entries (Code, Message, Field, TargetId); empty when none were sent. |
RetryAfter |
The server’s Retry-After backpressure hint, when sent. Don’t retry sooner. |
The authorization fetch retries transient failures (timeouts, 429, 5xx) with bounded backoff,
honouring Retry-After; exhaustion surfaces LicenseAuthorizationUnavailableException with the
last LicensingApiException as its inner exception. A definitive refusal (other 4xx — a denied
or unknown seat, a bad key) throws LicensingApiException immediately without retrying.
Rate-limit enforcement of your own features still throws RateLimitException locally.