WaffleAuth Documentation
Getting Started
WaffleAuth is a powerful license key system for C# applications, specifically designed for XAML and WinForms projects. It provides robust license management with HWID binding and Discord Rich Presence integration.
Installation Steps:
- Add WaffleAuth.dll as a reference in your project
- Add the following using statement:
- Configure your Firebase/Firestore database
- Set up your API endpoints
using WaffleAuth;
Requirements
Required NuGet Packages
WaffleAuth requires the following NuGet packages to be installed in your project:
- Discord Rich Presence
- Newtonsoft.Json
Installing NuGet Packages
You can install these packages using either:
Visual Studio NuGet Package Manager:
- Right-click your project in Solution Explorer
- Select "Manage NuGet Packages..."
- Search for each required package
- Click "Install" for each package
Package Manager Console:
Install-Package DiscordRichPresence
Install-Package Newtonsoft.Json
Note: Make sure to install these packages before trying to use WaffleAuth functionality.
Configuration Functions
Initial Configuration
Configure WaffleAuth at the start of your application:
// Required configuration
WaffleAuthFuncs.SetInitials("APP");
WaffleAuthFuncs.SetURL("your-firestore-url");
WaffleAuthFuncs.SetEndPoint("your-endpoint");
WaffleAuthFuncs.SetAPIKey("your-api-key");
WaffleAuthFuncs.MsgBoxes(true);
SetInitials(string userInitials)
Sets the prefix for generated license keys. This will appear before the hyphen in all generated keys.
WaffleAuthFuncs.SetInitials("APP");
Result format: APP-XXXXXXXXXXXXX
SetURL(string userURL)
Sets the Firestore database URL where license information will be stored.
WaffleAuthFuncs.SetURL("your-firestore-url");
SetEndPoint(string endpointuser)
Sets the API endpoint used for license validation and queries.
WaffleAuthFuncs.SetEndPoint("your-endpoint");
SetAPIKey(string userapikey)
Sets the Firebase API key for authentication and database access.
WaffleAuthFuncs.SetAPIKey("your-api-key");
MsgBoxes(bool showMsgBoxes)
Controls whether the system shows message box notifications for various events.
WaffleAuthFuncs.MsgBoxes(true); // Enable notifications
WaffleAuthFuncs.MsgBoxes(false); // Disable notifications
Key Management Functions
GenerateEarningKeyAsync(string websiteUrl, int timeInSeconds, int customDurationInHours)
Generates a license key after the user visits a specified website for a set duration.
string key = await WaffleAuthFuncs.GenerateEarningKeyAsync(
"https://example.com", // Website to visit
30, // Wait time in seconds
24 // License duration in hours
);
CheckKey(string licenseKey)
Validates a license key independently. Use this for manual key validation.
bool isValid = await WaffleAuthFuncs.CheckKey("APP-XXXXXXXXXXXXX");
Initialize()
Checks for any existing valid licenses on the current machine. Useful for automatic login.
private async void Init()
{
bool hasExistingLicense = await WaffleAuthFuncs.Initialize();
{
if (hasExistingLicense)
{
// Your code here for valid license
}
}
}
Call this method when your application starts to check for existing valid licenses.
Implementation Example
Basic Form Implementation
Here's a complete example of implementing WaffleAuth in a Windows Forms application:
using WaffleAuth;
namespace License_Tester
{
public partial class Form1 : Form
{
public Form1()
{
// Initial configuration
WaffleAuthFuncs.SetURL("https://firestore.googleapis.com/v1/projects/waffleauth/databases/(default)/documents/licenses");
WaffleAuthFuncs.SetAPIKey("YOUR-API-KEY");
WaffleAuthFuncs.SetEndPoint("https://firestore.googleapis.com/v1/projects/waffleauth/databases/(default)/documents:runQuery?key=");
WaffleAuthFuncs.SetInitials("LA");
WaffleAuthFuncs.MsgBoxes(true);
InitializeComponent();
}
// Generate new key button click handler
private async void button1_Click(object sender, EventArgs e)
{
string generatedKey = await WaffleAuthFuncs.GenerateEarningKeyAsync(
"https://youtube.com", // Website to visit
2, // Wait time in seconds
24 // License duration in hours
);
label1.Text = generatedKey;
}
// Validate key button click handler
private async void button2_Click(object sender, EventArgs e)
{
bool isKeyValid = await WaffleAuthFuncs.CheckKey(textBox1.Text);
if (!isKeyValid)
{
Application.Exit();
}
}
}
}
Important Implementation Notes
- Always configure WaffleAuth in your form's constructor before InitializeComponent()
- Handle key validation failures appropriately for your application
- Store sensitive information like API keys securely
- Consider implementing a loading indicator during async operations
Troubleshooting
Common Issues
- Invalid API Key: Ensure your Firebase API key is correctly set and has necessary permissions
- Database Connection: Verify your Firestore URL and endpoint configurations
- HWID Mismatch: Keys are bound to specific machines and cannot be transferred
- Expired Keys: Check the duration set during key generation