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:

  1. Add WaffleAuth.dll as a reference in your project
  2. Add the following using statement:
  3. using WaffleAuth;
  4. Configure your Firebase/Firestore database
  5. Set up your API endpoints

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:

  1. Right-click your project in Solution Explorer
  2. Select "Manage NuGet Packages..."
  3. Search for each required package
  4. 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("https://firestore.googleapis.com/v1/projects/your-project-name/databases/(default)/documents");
WaffleAuthFuncs.SetEndPoint("https://firestore.googleapis.com/v1/projects/your-project-name/databases/(default)/documents:runQuery?key=");
WaffleAuthFuncs.SetAPIKey("YOUR-API-KEY");
WaffleAuthFuncs.SetActivationKey("KEY-HERE"); // Required activation key
WaffleAuthFuncs.Mode = "key"; // Set authentication mode
WaffleAuthFuncs.MsgBoxes(true);

Firebase Collections Setup

WaffleAuth requires four collections in your Firebase Firestore database:

  • licenses - Collection for storing license key data
  • accounts - Collection for storing user account data when using account mode
  • bans - Collection for managing banned users
  • mixed - Collection for the merged account and key system feature

Important: All collections must be created in your Firestore database before using WaffleAuth. The system will not automatically create these collections.

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. The URL should be in this format:

https://firestore.googleapis.com/v1/projects/your-project-name/databases/(default)/documents
WaffleAuthFuncs.SetURL("https://firestore.googleapis.com/v1/projects/your-project-name/databases/(default)/documents");

SetEndPoint(string endpointuser)

Sets the API endpoint used for license validation and queries.

WaffleAuthFuncs.SetEndPoint("https://firestore.googleapis.com/v1/projects/your-project-name/databases/(default)/documents:runQuery?key=");

SetAPIKey(string userapikey)

Sets the Firebase API key for authentication and database access.

WaffleAuthFuncs.SetAPIKey("YOUR-API-KEY");

SetActivationKey(string activationKey)

Sets the activation key required for the system to function. This must be set before using any other functionality.

WaffleAuthFuncs.SetActivationKey("KEY-HERE");

Mode(string mode)

Sets the authentication mode - either "keys" for license key system or "accounts" for username/password authentication, or "mixed" for mixed account and key system.

WaffleAuthFuncs.Mode = "keys";     // Use license key system
WaffleAuthFuncs.Mode = "accounts"; // Use account system
WaffleAuthFuncs.Mode = "mixed";    // Use mixed account and key system

MsgBoxes(bool showMsgBoxes)

Controls whether the system shows message box notifications for various events.

WaffleAuthFuncs.MsgBoxes(true);  // Enable notifications
WaffleAuthFuncs.MsgBoxes(false); // Disable notifications

Discord Rich Presence Configuration (Optional)

Set up Discord Rich Presence integration if desired:


// Configure Discord RPC (Optional)
WaffleAuthFuncs.SetRPCAppID("1320047337518928004"); // Your Discord App ID

// Initialize Rich Presence
WaffleAuthFuncs.InitializeDiscordRP(
    "Your Subtitle",      // Subtitle text
    "Your Description",   // Description text
    "large_image",        // Large image asset name
    "Large Image Text",   // Large image hover text 
    "small_image",        // Small image asset name
    "Small Image Text"    // Small image hover text
);

Key Management Functions

GenerateEarningKey(string keyType, 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.GenerateEarningKey(
    "free",                // Key type  
    "https://example.com", // Website to visit
    30,                    // Wait time in seconds
    24                     // License duration in hours
);

GenerateKey(string keyType, int customDurationInHours)

Generates a license key immediately with specified duration.

string key = await WaffleAuthFuncs.GenerateKey(
    "premium",            // Key type
    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 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.

Key Information Functions

Access current key details:


// Get the current key type
string keyType = await WaffleAuthFuncs.GetType();

// Get the current key string
string currentKey = WaffleAuthFuncs.CurrentLogin;
// Can be used like: label1.Text = WaffleAuthFuncs.CurrentLogin;

Implementation Example

Basic Form Implementation

Here's a complete example of implementing WaffleAuth in a Windows Forms application:

using WaffleAuth;

namespace Le_Login_Tester
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            WaffleAuthFuncs.Mode = "accounts";
            WaffleAuthFuncs.SetActivationKey("KEY-HERE");
            WaffleAuthFuncs.SetURL("https://firestore.googleapis.com/v1/projects/your-project-name/databases/(default)/documents");
            WaffleAuthFuncs.SetEndPoint("https://firestore.googleapis.com/v1/projects/your-project-name/databases/(default)/documents:runQuery?key=");
            WaffleAuthFuncs.SetAPIKey("YOUR-API-KEY");
            WaffleAuthFuncs.MsgBoxes(true);
            WaffleAuthFuncs.Initialize();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            bool success = await WaffleAuthFuncs.CreateAccount("free", UsernameCreate.Text, PasswordCreate.Text);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            bool isValid = await WaffleAuthFuncs.CheckAccount(UsernameLogin.Text, PasswordLogin.Text);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            CurrentLabel.Text = WaffleAuthFuncs.CurrentLogin;
        }

        private async void button4_Click(object sender, EventArgs e)
        {
            TypeLabel.Text = await WaffleAuthFuncs.GetType();
        }

        private async void button6_Click(object sender, EventArgs e)
        {
            string key = await WaffleAuthFuncs.GenerateKey("free", 10);
            textBox2.Text = key;
        }

        private void button5_Click(object sender, EventArgs e)
        {
            bool isValid = await WaffleAuthFuncs.CheckKey(keybox.Text);
        }
    }
}

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 operations

Account Management Functions

CreateAccount(string accountType, string username, string password)

Creates a new user account with the specified type and credentials.

bool success = await WaffleAuthFuncs.CreateAccount(
    "free",             // Account type
    "username",         // Username 
    "password"          // Password
);

CheckAccount(string username, string password)

Validates user account credentials.

bool isValid = await WaffleAuthFuncs.CheckAccount(
    "username",         // Username
    "password"          // Password
);

Account Information Functions

Access current account details:

// Get the current account type
string accountType = await WaffleAuthFuncs.GetType();

// Get the current logged in username 
string currentUser = WaffleAuthFuncs.CurrentLogin;

Mixed Accounts

Mixed Account System

The Mixed Account system combines the functionality of both account-based and key-based authentication into a single unified system. This allows you to require both account credentials and a license key for authentication.

CreateMixedAccount(string accountType, string username, string password)

Creates a new mixed account and returns a license key for that account.

string key = await WaffleAuthFuncs.CreateMixedAccount(
    "free",             // Account type
    "username",         // Username
    "password"          // Password
);

CheckMixedAccount(string username, string password, string licenseKey)

Validates a mixed account using both account credentials and a license key.

bool isValid = await WaffleAuthFuncs.CheckMixedAccount(
    "username",         // Username
    "password",         // Password
    "LICENSE-KEY"       // License key
);

Account Information Functions

Access current mixed account details:

// Get the current account type
string accountType = await WaffleAuthFuncs.GetType();

// Get the current logged in username 
string currentUser = WaffleAuthFuncs.CurrentLogin;

Note: Mixed accounts provide an additional layer of security by requiring both account credentials and a valid license key for authentication.

Addons

Loading Addons

WaffleAuth supports loading external addons via DLL files. Place addon DLLs in the automatically created "Addons" folder.

Running Addon Methods

Use the AddonManager to execute methods from loaded addons:

// Basic method call
AddonManager.RunAddonMethod("MyAddon.dll", "MethodName");

// With parameters
AddonManager.RunAddonMethod("MyAddon.dll", "MethodName", "param1", true, 42);

Note: Parameters after the method name are optional and should match the method signature in the addon DLL.

Creating Custom Addons

Creating Custom Addons

Here's a basic template for creating your own WaffleAuth addon:

using System;
using System.Windows.Forms;

namespace ExampleAddon
{
    public class MainClass
    {
        public static void PrintMessage(string message)
        {
            MessageBox.Show($"Test: {message}");
        }
    }
}

Note: Make sure to compile your addon as a DLL and place it in the Addons folder.

Checkpoints

Setting Up Checkpoints

The Checkpoint system allows you to create a sequence of URLs that users must visit before receiving their key or account. This is commonly used with ad-link services to monetize key generation.

Configuring Checkpoint URLs

// Set up checkpoint URLs - can add unlimited checkpoints
WaffleAuthFuncs.SetCheckpointUrls(
    1, "https://rekonise.com/checkpoint-1-pus4u",
    2, "https://link-hub.net/1286237/checkpoint-2",
    3, "https://link-target.net/1286237/tester"
);

Setting Checkpoint Preferences

Before starting checkpoints, configure the output preferences based on your mode:

For Mixed Mode:

// Configure mixed account preferences
// You can use textbox values here, e.g.: UsernameTextBox.Text, PasswordTextBox.Text
WaffleAuthFuncs.CheckpointMixedPrefs(
    "free",                 // Account type
    UsernameTextBox.Text,   // Username (can use textbox or string)
    PasswordTextBox.Text    // Password (can use textbox or string)
);

For Keys Mode:

// Configure key preferences
WaffleAuthFuncs.CheckpointKeyPrefs(
    "free",             // Key type
    24                  // Key duration in hours
);

Starting the Checkpoint System

// Start the checkpoint system
WaffleAuthFuncs.StartCheckpoints();

Important Configuration Notes:

When setting up your ad-link redirects, use these local endpoints:

  • Checkpoint 1: http://localhost:2579/waffleauth/1
  • Checkpoint 2: http://localhost:2579/waffleauth/2
  • And so on for additional checkpoints...
  • Final Checkpoint: http://localhost:2579/waffleauth/complete

Note: The final checkpoint must always redirect to the "complete" endpoint.

Implementation Example

public Form1()
{
    InitializeComponent();
    
    // Set up checkpoint URLs on startup
    WaffleAuthFuncs.SetCheckpointUrls(
        1, "https://linkvertise.com/checkpoint1",
        2, "https://linkvertise.com/checkpoint2",
        3, "https://linkvertise.com/checkpoint3"
    );
}

private async void button1_Click(object sender, EventArgs e)
{
    // Configure preferences based on your selected mode
    WaffleAuthFuncs.CheckpointMixedPrefs("free", "username", "password");
    // OR
    WaffleAuthFuncs.CheckpointKeyPrefs("free", 24);

    // Start the checkpoint system
    WaffleAuthFuncs.StartCheckpoints();
}

Important: While SetCheckpointUrls should be called at startup, the CheckpointPrefs and StartCheckpoints methods should be called when a user initiates the process (e.g., clicking a button).

Banning

User Ban Management

WaffleAuth provides functions to manage user bans through HWID (Hardware ID):

Banning a User

// Ban a user by their HWID
await WaffleAuthFuncs.BanUser("HWID-TO-BAN");

Unbanning a User

// Remove a ban for a specific HWID
await WaffleAuthFuncs.UnBan("HWID-TO-UNBAN");

Note: Bans are enforced at the HWID level, making them effective across different accounts or keys used on the same machine.

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