Requirements
- .NET 6.0 or later
BouncyCastle.Cryptography(pulled in transitively with the AuthForge package)
Installation
Add the AuthForge package from NuGet:Prefer a source-only layout? Copy
AuthForgeClient.cs from GitHub and reference BouncyCastle.Cryptography explicitly. The NuGet package is recommended for most apps.Quick start
Constructor parameters
ttlSeconds
Requested session token lifetime in seconds for /auth/validate. Pass null (or omit) to accept the server default of 24 hours. The server clamps to [3600, 604800] (1 hour to 7 days). The requested TTL is preserved across heartbeat refreshes so long-running apps in LOCAL mode can extend their offline window up to 7 days.
Billing
- Each successful
Login()orValidateLicense()costs 1 credit (one/auth/validatedebit). - Heartbeats cost 1 credit per 10 successful calls (billed on every 10th heartbeat). Any
heartbeatInterval ≥ 1is economically safe. - Revocations take effect on the next heartbeat regardless of interval.
Login
true if authentication succeeded, false otherwise. On success, the SDK starts a background heartbeat thread automatically.
Validate license (no heartbeat)
/auth/validate request and verification as Login, without updating the client’s session fields or starting the heartbeat thread.
Failure callback
If authentication or a heartbeat fails, the SDK calls yourOnFailure callback. If no callback is set (or the callback throws), the SDK calls Environment.Exit(1).