Skip to content

.NET SDK — offline, freshness and grace

The SDK does not call the server on every check. After activation it holds a signed, cached license and validates it locally against the embedded provider key. This is what lets you gate features on the hot path without a network round trip — and what lets a short connectivity blip pass unnoticed.

The cached license lives on disk in a LicenseFileStore, keyed to the device fingerprint, in a default location under application data. On startup the SDK serves the cached license first and validates its signature against the pinned provider key, so the application starts licensed without waiting on the network. On the fluent-builder path, UseLicenseStoreBuilder() enables the cache and lets you move it:

.UseLicenseStoreBuilder(store => store
.UseLicenseFolderLocation(LicenseFileStore.LicenseFolderLocation.Custom, path))

Each cached license carries a lease describing how recently it was authoritatively validated. LeaseStatus captures where it stands:

StatusMeaning
FreshValidated within the normal freshness window. Used directly.
StalePast freshness but still inside the allowed offline window — should revalidate soon.
StaleLockoutPast the absolute offline limit — must revalidate before further protected use.
UnverifiableFreshness can’t be determined; treated conservatively.

The background refresh (every LicenseRefreshIntervalSeconds) keeps the lease Fresh in normal operation, so a backend outage shorter than that window has no user-visible effect. A prolonged outage eventually moves the lease to lockout, at which point the license must be revalidated before protected features resume — the SDK will not extend an unverified license indefinitely.

Grace is separate from freshness: it’s the window after a license’s validity ends during which the product keeps working, giving a customer time to renew. While in grace, LicenseStatus is GracePeriod and IsOperational stays true, so your existing feature checks keep passing without special casing. Read LicenseStatus == LicenseStatus.GracePeriod if you want to show a “renew now” banner.

Offline enforcement can’t trust the system clock alone — moving it backwards would revive an expired license. The SDK keeps a monotonic high-water record of observed time, so winding the clock back doesn’t restore expired access. This is automatic; you don’t configure it.

For air-gapped or intermittently connected installs, add the Revenusion.MonetizeIt.Client.OfflineStore package. It lets you carry activation across an air gap: the device produces a signed request, an operator activates it against the platform, and the device imports the signed response — all verified against the same provider key, so an offline device is no less protected than an online one.