How keyauth/keyauth-csharp-example works
Project type and purpose
• This is a C# “client-SDK example” project demonstrating how to integrate with the KeyAuth license-key authentication API.
• It provides two sample consumers:
• A Console application (Console/Loader.sln)
• A Windows Forms application (Form/Loader.sln)
• Both samples share two core library files: KeyAuth.cs (the API wrapper) and Ed25519.cs (cryptographic signing/verification).
File structure
• Top-level:
• .github/workflows/pr_notification.yml – CI notification workflow
• Console/ – Console SDK sample
• Form/ – WinForms SDK sample
• README.md & LICENSE
• Under each sample:
• Program.cs – entry point invoking KeyAuth API calls
• KeyAuth.cs – central API client class (HTTP requests, response models)
• Ed25519.cs – digital-signature helper (integrity/security)
• .csproj & .sln – Visual Studio solution/project files
• Form example also has designer files (*.Designer.cs, *.resx) and UI controllers (Login.cs, Main.cs).
README insights
• Purpose: show how to initialize the API client, authenticate users (login / register / license-only), check stats, handle subscriptions, perform webhooks, download files, chat channels, logging, ban/blacklist.
• Dependencies: .NET Framework/.NET Core, HTTP, JSON, Ed25519 cryptography.
• Security recommendations: obfuscation, integrity checks, in‐memory execution, remote webhooks.
Main architectural components (to be drawn as distinct blocks)
A. Client Applications
• Console UI Layer (Console/Program.cs)
• WinForms UI Layer (Form/Login.cs, Form/Main.cs)
B. Shared SDK Library
• KeyAuth API client (KeyAuth.cs)
• Cryptography module (Ed25519.cs)
• Configuration loader (App.config)
C. External Services
• KeyAuth Cloud API Endpoints (init, login, register, fetchStats, etc.)
• Optional Webhooks (SellerAPI, Discord)
• File storage / download endpoint
D. Support & Build
• Visual Studio Solutions & Projects (.sln, .csproj)
• CI Workflow (.github/workflows)
• License & Documentation (README, LICENSE)
Relationships & interactions
1. UI Layer → calls Shared SDK library methods (KeyAuthApp.init(), .login(), etc.)
2. SDK Library → constructs & signs requests with Ed25519 → sends HTTP(S) to KeyAuth Cloud
3. KeyAuth Cloud → responds with JSON → SDK Library parses into models → returns to UI
4. UI Layer → renders result to user (console output or WinForms controls)
5. For webhooks & file download: SDK Library uses dedicated HTTP calls to external endpoints via the KeyAuth server.
6. CI Workflow → triggers on PRs → runs any tests/builds (not defined here, but in .github/workflows)
Architectural patterns & design principles
• Separation of concerns: UI layers are thin; all API logic lives in KeyAuth.cs.
• Single-responsibility: Ed25519 module handles only signing/verification.
• Config-driven: App.config contains endpoints and keys.
• Extensibility: easy to swap UI or embed KeyAuth library in your own projects.
• Security first: explicit integrity checks, in-memory RPC calls, digital signatures.
Technologies / frameworks
• .NET Framework / .NET Core
• WinForms for GUI
• System.Net.Http for REST calls
• JSON deserialization (e.g., Newtonsoft.Json or built-in)
• Ed25519 cryptography (custom implementation)
• GitHub Actions for CI
• Clear component names (Presentation, KeyAuth SDK, Ed25519, KeyAuth Cloud)
• Tech annotations on or near each block (e.g., “WinForms (.NET)”, “HTTP REST”, “Ed25519”)
• Don’t clutter: separate into as many logical blocks as makes each responsibility obvious
• A small note about CI (GitHub Actions) and config (App.config) off to the side