CarchaLabs.Seal 0.2.0

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

Carcha Seal for .NET

Licensing for .NET desktop apps that keeps working offline: activation, check-ins, offline grace, clock checks, offline license files, feature decryption and seats of floating licenses, with the same behaviour as the Electron SDK. CarchaLabs.Seal is a thin layer over the native library's C interface (the same library the C++ SDK ships), where the client logic, lease verification and decryption run. Requests go through .NET's HttpClient, so your app's proxy and certificate settings apply.

Targets: net10.0 (source-generated LibraryImport, trimming and Native AOT), netstandard2.0 and net462 (DllImport, for .NET Framework WinForms and WPF apps).

using CarchaLabs.Seal;

using var seal = new SealClient(new SealOptions
{
    Product = "studio",
    ServerUrl = "https://seal.carchalabs.com/<your slug>",   // https://, or http:// on this computer only
    PublicKeys = PublicKeys,                                 // the PEM from the console, in your code, not read from a file
    StorageDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Studio"),
    AppVersion = "2.4.0",
});

try
{
    await seal.ActivateAsync(keyTheUserTyped);
}
catch (LicenseException e)
{
    Show(e.Message);                 // e.Code: "activation_limit", "invalid_key", "network", ...
}

LicenseState state = await seal.CheckAsync();   // at every start: online when the server answers, else offline grace
if (state.HasFeature("pro")) { /* ... */ }
byte[] model = seal.Decrypt("pro", encryptedModel);   // data you encrypted for the feature
Member What it does
ActivateAsync(key, machineName) Activates this device; no machine name is sent unless you pass one
CheckAsync() The license state; offline from the saved lease, with its grace period and clock checks
DeactivateAsync() Releases this device's seat
OfflineRequest(key), ActivateOffline(file), DeactivateOffline() Offline activation by file
Decrypt(feature, data) Decrypts data encrypted for a feature; the content key stays in the native library
CheckoutAsync(key, options) Takes a seat of a floating license (below)

SealOptions.HttpClient takes your own HttpClient; turn off automatic redirects on its handler (AllowAutoRedirect = false), as the library's own does: a redirect is never followed. One operation runs at a time on a SealClient; concurrent calls wait for each other (a seat's renewals among them).

Floating licenses: seats

A floating license is used by taking a seat while the app runs; the server frees it when the app gives it back or stops renewing (see the server's docs/floating.md).

SealSeat seat;
try
{
    seat = await seal.CheckoutAsync(keyTheUserTyped, new CheckoutOptions { MachineName = "Lab PC 7" });   // later: CheckoutAsync() uses the saved key
}
catch (LicenseException e) when (e.Code == "seats_exhausted")
{
    Show(e.Message);                 // e.GetDetail("inUse"), e.GetDetail("total"), e.GetDetail("retryAfter") in seconds
    return;
}
seat.Lost += (_, e) => StopLicensedWork(e.Loss.Message);   // on a thread-pool thread: "expired", "license_revoked", ...
if (seat.HasFeature("pro")) { /* ... */ }
// ... the seat renews itself on a timer ...
await seat.ReleaseAsync();           // when the app is done (on quit), then seat.Dispose()
SealSeat What it does
GetInfo() Status (Held, Lost, Released), session id, features, seats in use and the pool's size (null: unlimited), license id and expiry, when the seat ends without a renewal, and why it was lost
Status, HasFeature(name) From GetInfo(); HasFeature is false once the seat is not held
RenewAsync() Renews now; the seat does it itself unless checked out with RenewAutomatically = false (then call it at NextRenewal)
ReleaseAsync() Gives the seat back: true when the server confirmed it, false when it could not be reached (the seat frees itself when its token expires)
Lost, Renewed Raised on the thread that renewed (a thread-pool thread for the timer's renewals)
Dispose() Stops renewing and frees the seat here; it does not release it

The seat token lives in the native library's memory only, and a seat has no offline grace: a renewal with no answer is tried again 15 s, 30 s, then every 60 s later (or when the server says), and the seat is lost as expired when its token's lifetime has passed on a monotonic clock (Stopwatch), so changing the computer's clock changes nothing. A session that ended or was taken over is checked out again on the same seat; any other refusal loses the seat with the server's reason. A transport that throws during a renewal or release counts as no answer, and so does a cancelled one (which then throws). An exception from a Lost or Renewed handler on the timer's thread is ignored. Keep a reference to the SealSeat while the app uses it.

Packages

dotnet add package CarchaLabs.Seal

CarchaLabs.Seal on nuget.org, published from a GitHub release tagged CarchaLabs.Seal@<version> (CHANGELOG). pack/ builds three packages, the layout Microsoft recommends for a native library used from both .NET and .NET Framework ("Native files in .NET packages"):

Package For Holds
CarchaLabs.Seal What apps install No files: it depends on one of the two below, chosen by the app's target framework
CarchaLabs.Seal.Runtime .NET 5+ (and other .NET Standard 2.0 hosts) The library under ref/ and runtimes/any/lib/ (net10.0, netstandard2.0), the native library under runtimes/<rid>/native/
CarchaLabs.Seal.NetFramework .NET Framework 4.6.2+: AnyCPU, x86, x64, ARM64; PackageReference or packages.config The library (net462), the native library for each Windows CPU, and build targets that copy them to carcha-seal\<cpu>\ next to the app; the library loads the one that matches the process

Put the native libraries (cargo build --release --manifest-path ../native/Cargo.toml, no features) in artifacts/native/<rid>/: seal_native.dll for win-x86, win-x64, win-arm64; libseal_native.dylib for osx-x64, osx-arm64; libseal_native.so for linux-x64, linux-arm64. Then:

dotnet pack pack/CarchaLabs.Seal.Runtime
dotnet pack pack/CarchaLabs.Seal.NetFramework
dotnet pack pack/CarchaLabs.Seal

The packages are written to artifacts/packages/. A platform with no file in artifacts/native/ is left out of them.

CI (.github/workflows/dotnet-packages.yml) builds the native library for all seven platforms: on Windows with the C runtime linked in (-C target-feature=+crt-static), so the DLL needs no Visual C++ redistributable; on macOS for macOS 11 and later; on Linux on Ubuntu 22.04, so it needs no newer glibc than 22.04's. It packs them, checks every file in the packages, and runs tests/Consumer, an app that installs the packages: .NET 10 on Windows (x64, ARM64), macOS (Apple Silicon, Intel) and Linux (x64, ARM64; Ubuntu 22.04 and 24.04), and .NET Framework built for x86, x64, AnyCPU and ARM64 through PackageReference and packages.config, each checking that it loaded the copy for its CPU.

Tests

Needs the .NET 10 SDK and a Rust toolchain (the tests build ../native with cargo).

dotnet test --project tests/CarchaLabs.Seal.Tests -c Release              # against the net10.0 build
dotnet test --project tests/CarchaLabs.Seal.Tests.NetStandard -c Release  # against the netstandard2.0 build

Both run every client scenario recorded from the Electron SDK (../client/tests/vectors.json), every seat scenario (../client/tests/seat-scenarios.json: requests, results and events, on a scripted monotonic clock), the seat's renewal timer on the real clock, and the HTTP client against a local server.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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 is compatible.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 69 11/10/2026
0.1.4 93 11/8/2026
0.1.3 88 11/8/2026
0.1.2 93 11/8/2026
0.1.1 88 11/7/2026