Guidelines for effective implementation and security
Key Principle: Fail Gracefully
Always design your kill-switch to fail in a way that maintains customer trust.
Allow access when checks fail. Best for maintaining customer relationships.
Block access when checks fail. Use only for high-security scenarios.
CacheTtlMinutes: 60 (Recommended)
Never commit API keys to version control
Make reverse engineering difficult:
// Good: Innocent-looking code
var analytics = AnalyticsClient.Initialize();
await analytics.ValidateLicenseAsync();
// Avoid: Obvious kill-switch code
var killSwitch = KillSwitchClient.Create();
if (!await killSwitch.CheckAsync()) Exit();
// .NET Console Application
public static async Task Main(string[] args)
{
var licenseCheck = await LicenseValidator.ValidateAsync();
if (!licenseCheck.IsValid)
return ShowTrialExpiredMessage();
await RunApplicationAsync();
}
// Background service for long-running apps
public class LicenseMonitor : BackgroundService
{
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
await ValidateLicensePeriodically();
await Task.Delay(TimeSpan.FromHours(1), stoppingToken);
}
}
// Log license check events
logger.LogInformation("License check for {CustomerId}: {Status}",
customerId, result.Allowed ? "Allowed" : "Blocked");
| Scenario | Recommended TTL | Network Calls |
|---|---|---|
| Desktop Application | 2-4 hours | ~6-12 per day |
| Web Application | 15-30 minutes | ~48-96 per day |
| Mobile Application | 1-2 hours | ~12-24 per day |
Start with our recommended settings and adjust based on your specific needs.