<html><head><base href="/" /><title>WaffleAuth Documentation</title><style>
body {
    font-family: 'Segoe UI', Arial, sans-serif;
    line-height: 1.6;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    color: #333;
    background: #f5f5f5;
}

.container {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

h1, h2, h3 {
    color: #2c3e50;
    margin-top: 2em;
    margin-bottom: 1em;
}

.code-block {
    background: #f6f8fa;
    color: #24292e;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #3498db;
    font-family: 'Consolas', monospace;
    overflow-x: auto;
    white-space: pre;
    line-height: 1.4;
}

/* Syntax highlighting */
.keyword { color: #d73a49; }
.string { color: #032f62; }
.comment { color: #6a737d; }
.type { color: #6f42c1; }
.function { color: #005cc5; }
.number { color: #005cc5; }
.boolean { color: #d73a49; }

.method {
    margin: 30px 0;
    padding: 25px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e1e4e8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.parameter {
    margin: 15px 0;
    padding-left: 20px;
}

.note {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 20px;
    margin: 25px 0;
    border-radius: 4px;
}

.step {
    background: #e7f5ff;
    border-left: 4px solid #339af0;
    padding: 20px;
    margin: 25px 0;
    border-radius: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

th, td {
    padding: 15px;
    text-align: left;
    border: 1px solid #e1e4e8;
}

th {
    background: #f8f9fa;
    font-weight: 600;
}

td {
    background: white;
}

code {
    font-family: 'Consolas', monospace;
    background: #f6f8fa;
    padding: 2px 5px;
    border-radius: 3px;
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #ffffff;
    color: #2c3e50;
    text-decoration: none;
    border-radius: 8px;
    margin: 20px 0;
    font-weight: 500;
    transition: background 0.2s ease;
    max-width: 320px;
    border: 1px solid #e1e4e8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.download-btn:hover {
    background: #f8f9fa;
}

.download-icon {
    width: 24px;
    height: 24px;
    background: #5865f2;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-icon svg {
    width: 16px;
    height: 16px;
    fill: white;
}

.download-text {
    display: flex;
    flex-direction: column;
}

.download-filename {
    font-size: 16px;
    margin-bottom: 4px;
    color: #2c3e50;
}

.download-size {
    font-size: 12px;
    color: #6c757d;
}
</style></head><body>
<div class="container">
    <h1>WaffleAuth Documentation</h1>
    
    <h2>Getting Started</h2>
    <p>WaffleAuth is a license authentication system that provides functionality for generating and validating license keys.</p>

    <a href="https://auth.waffledev.com/WaffleAuth.dll" class="download-btn" download>
        <div class="download-text">
            <span class="download-filename">WaffleAuth.dll</span>
            <span class="download-size">Library File</span>
        </div>
        <div class="download-icon">
            <svg viewBox="0 0 24 24">
                <path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/>
            </svg>
        </div>
    </a>
    
    <a href="https://auth.waffledev.com/WaffleHWID.exe" class="download-btn" download>
        <div class="download-text">
            <span class="download-filename">WaffleHWID.exe</span>
            <span class="download-size">HWID Generator</span>
        </div>
        <div class="download-icon">
            <svg viewBox="0 0 24 24">
                <path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/>
            </svg>
        </div>
    </a>

    <div class="note">
        <strong>Important:</strong> Before using WaffleAuth, you need to configure your own Firebase/Firestore credentials and endpoints.
    </div>

    <h2>Initial Setup</h2>
    <p>Initialize WaffleAuth with the following configuration methods:</p>
    
    <div class="method">
        <h3>Required Configuration Methods</h3>
        <div class="code-block"><span class="type">WaffleAuthFuncs</span>.<span class="function">SetURL</span>(<span class="string">"YOUR_FIRESTORE_URL"</span>);
<span class="type">WaffleAuthFuncs</span>.<span class="function">SetAPIKey</span>(<span class="string">"YOUR_API_KEY"</span>);
<span class="type">WaffleAuthFuncs</span>.<span class="function">SetEndPoint</span>(<span class="string">"YOUR_ENDPOINT_URL"</span>);
<span class="type">WaffleAuthFuncs</span>.<span class="function">SetDuration</span>(<span class="number">1</span>);
<span class="type">WaffleAuthFuncs</span>.<span class="function">SetInitials</span>(<span class="string">"LA"</span>);
<span class="type">WaffleAuthFuncs</span>.<span class="function">MessageBoxes</span>(<span class="boolean">true</span>);</div>
    </div>

    <table>
        <tr>
            <th>Method</th>
            <th>Description</th>
            <th>Parameter Type</th>
        </tr>
        <tr>
            <td><code>SetURL()</code></td>
            <td>Sets the Firestore database URL</td>
            <td>string</td>
        </tr>
        <tr>
            <td><code>SetAPIKey()</code></td>
            <td>Sets the API key for authentication</td>
            <td>string</td>
        </tr>
        <tr>
            <td><code>SetEndPoint()</code></td>
            <td>Sets the endpoint URL for queries</td>
            <td>string</td>
        </tr>
        <tr>
            <td><code>SetDuration()</code></td>
            <td>Sets the duration value in hours</td>
            <td>int</td>
        </tr>
        <tr>
            <td><code>SetInitials()</code></td>
            <td>Sets the initials for key generation</td>
            <td>string</td>
        </tr>
        <tr>
            <td><code>MessageBoxes()</code></td>
            <td>Enables/disables message boxes</td>
            <td>bool</td>
        </tr>
    </table>

    <h2>Firebase Configuration</h2>
    <div class="step">
        <h3>Step 1: Create Firebase Project</h3>
        <p>1. Go to the Firebase Console and create a new project</p>
        <p>2. In the project settings, create a new Web App to get your API key and project configuration</p>
        <p>3. Enable Firestore Database from the Firebase Console</p>
    </div>

    <div class="step">
        <h3>Step 2: Get Required URLs and Keys</h3>
        <p>After creating your Firebase project and enabling Firestore, you'll need:</p>
        <ul>
            <li>Firestore URL Format: <code>https://firestore.googleapis.com/v1/projects/YOUR_PROJECT_ID/databases/(default)/documents/licenses</code></li>
            <li>Web API Key: Found in your Firebase project settings under the Web App configuration</li>
            <li>Endpoint URL Format: <code>https://firestore.googleapis.com/v1/projects/YOUR_PROJECT_ID/databases/(default)/documents:runQuery?key=</code></li>
        </ul>
    </div>

    <h2>License Key Format & Premium Keys</h2>

    <div class="method">
        <h3>Standard Key Format</h3>
        <p>Each license key in the Firestore database follows this structure:</p>
        <div class="code-block">{
    <span class="string">"createdAt"</span>: <span class="string">"December 20, 2024 at 4:42:23 PM UTC+1"</span>, <span class="comment">// timestamp</span>
    <span class="string">"expiresAt"</span>: <span class="string">"December 20, 2024 at 5:42:23 PM UTC+1"</span>, <span class="comment">// timestamp</span>
    <span class="string">"hwid"</span>: <span class="string">"751466F8F0542C9A"</span>,                 <span class="comment">// string</span>
    <span class="string">"key"</span>: <span class="string">"LA-48a7ebadbda84b67"</span>                <span class="comment">// string</span>
}</div>
    </div>

    <div class="step">
        <h3>Creating Premium Keys</h3>
        <p>To create premium keys with custom durations or properties:</p>
        <ol>
            <li>Have the user download and run WaffleHWID.exe to generate their HWID</li>
            <li>Get the HWID from the user that was generated by WaffleHWID.exe</li>
            <li>Go to your Firestore database console</li>
            <li>Manually add a new document to the 'licenses' collection</li>
            <li>Set up the document with the format shown above</li>
            <li>Use the HWID provided by the user in the 'hwid' field of the document</li>
        </ol>
    </div>

    <div class="note">
        <strong>Note:</strong> When creating premium keys, ensure you maintain the exact document structure. Premium keys require the user's HWID which can only be generated using WaffleHWID.exe to maintain security and prevent key sharing.
    </div>

    <h2>Key Functions</h2>

    <div class="method">
        <h3>Generate License Key</h3>
        <p>To generate a new license key:</p>
        <div class="code-block"><span class="type">string</span> generatedKey = <span class="keyword">await</span> <span class="type">WaffleAuthFuncs</span>.<span class="function">GenerateKeyAsync</span>();</div>
    </div>

    <div class="method">
        <h3>Validate License Key</h3>
        <p>To check if a license key is valid:</p>
        <div class="code-block"><span class="type">bool</span> isKeyValid = <span class="keyword">await</span> <span class="type">WaffleAuthFuncs</span>.<span class="function">CheckKey</span>(keyString);</div>
    </div>

    <div class="method">
        <h3>Generate Earning/Adlink Key</h3>
        <p>To generate a new license key with an associated earning URL (e.g., ad links):</p>
        <div class="code-block"><span class="type">string</span> generatedKey = <span class="keyword">await</span> <span class="type">WaffleAuthFuncs</span>.<span class="function">GenerateEarningKeyAsync</span>(<span class="string">"https://youtube.com"</span>, <span class="number">1</span>);</div>
        <div class="parameter">
            <p>Parameters:</p>
            <ul>
                <li><code>url</code> (string): The URL that users need to visit to earn the key</li>
                <li><code>duration</code> (int): Required time in hours that the user must stay on the URL page to earn their key</li>
            </ul>
        </div>
    </div>

    <h2>Example Implementation</h2>
    <div class="code-block"><span class="keyword">using</span> WaffleAuth;

<span class="keyword">public partial class</span> <span class="type">Form1</span> : <span class="type">Form</span>
{
    <span class="keyword">public</span> <span class="function">Form1</span>()
    {
        <span class="comment">// Initialize WaffleAuth with your credentials</span>
        <span class="type">WaffleAuthFuncs</span>.<span class="function">SetURL</span>(<span class="string">"YOUR_FIRESTORE_URL"</span>);
        <span class="type">WaffleAuthFuncs</span>.<span class="function">SetAPIKey</span>(<span class="string">"YOUR_API_KEY"</span>);
        <span class="type">WaffleAuthFuncs</span>.<span class="function">SetEndPoint</span>(<span class="string">"YOUR_ENDPOINT_URL"</span>);
        <span class="type">WaffleAuthFuncs</span>.<span class="function">SetDuration</span>(<span class="number">1</span>);
        <span class="type">WaffleAuthFuncs</span>.<span class="function">SetInitials</span>(<span class="string">"LA"</span>);
        <span class="type">WaffleAuthFuncs</span>.<span class="function">MessageBoxes</span>(<span class="boolean">true</span>);
        <span class="function">InitializeComponent</span>();
    }

    <span class="keyword">private async void</span> <span class="function">GenerateKey_Click</span>(<span class="type">object</span> sender, <span class="type">EventArgs</span> e)
    {
        <span class="type">string</span> generatedKey = <span class="keyword">await</span> <span class="type">WaffleAuthFuncs</span>.<span class="function">GenerateKeyAsync</span>();
        <span class="comment">// Display or use the generated key</span>
    }

    <span class="keyword">private async void</span> <span class="function">ValidateKey_Click</span>(<span class="type">object</span> sender, <span class="type">EventArgs</span> e)
    {
        <span class="type">bool</span> isKeyValid = <span class="keyword">await</span> <span class="type">WaffleAuthFuncs</span>.<span class="function">CheckKey</span>(licenseKey);
        <span class="keyword">if</span> (!isKeyValid)
        {
            <span class="type">Application</span>.<span class="function">Exit</span>();
        }
    }

    <span class="keyword">private async void</span> <span class="function">GenerateEarningKey_Click</span>(<span class="type">object</span> sender, <span class="type">EventArgs</span> e)
    {
        <span class="type">string</span> earningKey = <span class="keyword">await</span> <span class="type">WaffleAuthFuncs</span>.<span class="function">GenerateEarningKeyAsync</span>(<span class="string">"https://youtube.com"</span>, <span class="number">1</span>);
        <span class="comment">// Display or use the generated earning key</span>
    }
}</div>

    <div class="note">
        <h3>Security Note</h3>
        <p>Always keep your API keys and credentials secure and never expose them in client-side code or public repositories.</p>
    </div>
</div>
</body></html>