Official NightAuth Java SDK & Reference Client Suite (Modern Desktop UI in Java Swing and Interactive Terminal CLI). Protect your Java / JVM software against piracy, reverse engineering, and tampering with cloud licensing, HWID locking, realtime encrypted chat, and secure in-memory streaming in minutes.
Official Portal: https://nightauth.org
Documentation: https://nightauth.org/docs
Technical Architecture Benchmark: NightAuth vs KeyAuth vs Auth.gg
Languages / Idiomas / Langues / Sprachen:
English β’ EspaΓ±ol β’ FranΓ§ais β’ Deutsch β’ Italiano β’ PortuguΓͺs β’ Π ΡΡΡΠΊΠΈΠΉ β’ TΓΌrkΓ§e β’ Polski β’ δΈζ
Note
Official video tutorials and detailed step-by-step guides explaining how to configure applications, plans, subscriptions, cloud variables, webhooks, and licenses in the NightAuth Dashboard will be published soon on our official portal and YouTube channel.
| Start / Authentication Screen | Dashboard & Subscription Management |
|---|---|
![]() |
![]() |
| Terminal Login Screen | Interactive Console Dashboard |
|---|---|
![]() |
![]() |
- Bytecode Obfuscation & Virtualization: Java bytecode (.class files) can be easily reversed using tools like CFR, Procyon, Fernflower, or JD-GUI. For production releases, protect compiled classes and JARs using commercial obfuscators such as Zelix KlassMaster (ZKM), ProGuard, or DexGuard to encrypt string literals, rename symbols, and flatten control flow.
- Ahead-Of-Time (AOT) Native Compilation: Compile Java code into standalone native executables (.exe on Windows, ELF on Linux) using GraalVM Native Image (
native-image -jar MyApp.jar). This strips JVM bytecode entirely and eliminates conventional decompilers. - Memory Buffer Sanitization: Clear sensitive credentials, decrypted tokens, and cryptographic keys immediately after use by zeroing arrays (
Arrays.fill(bytes, (byte) 0)). - In-Memory Secure File Execution: When retrieving protected binary modules or JAR assets with
NightAuthApp.downloadFile(), never write bytes to physical storage or disk. Load bytecode directly into memory via custom in-memoryClassLoaderimplementations (defineClass) and purge temporary buffers immediately.
Requires JDK 17 or later (tested on OpenJDK 17, 21, and 25 LTS). Zero external dependencies β built exclusively with standard JDK libraries (java.net.http, javax.crypto, java.security).
# Compile SDK and Console
javac -d build sdk/src/main/java/com/nightauth/sdk/NightAuthApi.java console/src/main/java/com/nightauth/console/Main.java
# Run Console
java -cp build com.nightauth.console.Main# Compile SDK and Desktop
javac -d build sdk/src/main/java/com/nightauth/sdk/NightAuthApi.java desktop/Main.java
# Run Desktop
java -cp build com.nightauth.desktop.Main# Build Console JAR
jar cfe NightAuth-Console.jar com.nightauth.console.Main -C build .
# Build Desktop JAR
jar cfe NightAuth-Desktop.jar com.nightauth.desktop.Main -C build .Define your application credentials from the Manage Apps tab of the NightAuth dashboard:
import com.nightauth.sdk.NightAuthApi;
public static final String APP_NAME = "";
public static final String APP_API_KEY = "";
public static final String APP_VERSION = "1.0";
public static final String APP_TOKEN = "";
public static NightAuthApi NightAuthApp = new NightAuthApi(
APP_NAME,
APP_API_KEY,
APP_VERSION,
APP_TOKEN
);You must call init() prior to executing any other SDK functions. This establishes an ephemeral Diffie-Hellman (X25519) key exchange and an encrypted session:
NightAuthApp.init();
if (!NightAuthApp.response.success) {
System.err.printf("Initialization failed: %s\n", NightAuthApp.response.message);
System.exit(1);
}// Validate active session status with the server
if (!NightAuthApp.check()) {
System.out.printf("Session invalid: %s\n", NightAuthApp.response.message);
}
// Check if client HWID or IP address is blacklisted
String hwid = NightAuthApi.getHardwareId();
if (NightAuthApp.checkBlacklist(hwid)) {
System.err.println("Access Denied: Machine or IP is blacklisted.");
System.exit(1);
}if (NightAuthApp.login(username, password, totpCode)) {
System.out.printf("Welcome back, %s!\n", NightAuthApp.user.username);
} else {
System.err.printf("Login failed: %s\n", NightAuthApp.response.message);
}if (NightAuthApp.register(username, password, licenseKey, email)) {
System.out.printf("Registration successful: %s!\n", NightAuthApp.user.username);
} else {
System.err.printf("Registration failed: %s\n", NightAuthApp.response.message);
}// Authenticate using license key alone or with 2FA TOTP code
if (NightAuthApp.license(licenseKey, totpCode)) {
System.out.printf("License valid! Logged in as: %s\n", NightAuthApp.user.username);
} else {
System.err.printf("License authentication failed: %s\n", NightAuthApp.response.message);
}if (NightAuthApp.upgrade(username, licenseKey)) {
System.out.printf("Account upgraded: %s\n", NightAuthApp.response.message);
} else {
System.err.printf("Upgrade failed: %s\n", NightAuthApp.response.message);
}if (NightAuthApp.resetHwid(username, password, totpCode)) {
System.out.println("Hardware fingerprint reset successfully.");
} else {
System.err.printf("HWID reset failed: %s\n", NightAuthApp.response.message);
}// Step 1: Request recovery email link
NightAuthApp.forgotPassword("user@example.com");
// Step 2: Complete reset using token received via email
if (NightAuthApp.resetPassword(resetToken, newPassword)) {
System.out.println("Password updated successfully.");
}NightAuthApi.UserData u = NightAuthApp.user;
System.out.printf("Username: %s\n", u.username);
System.out.printf("Email: %s\n", u.email);
System.out.printf("HWID: %s\n", u.hwid);
System.out.printf("Client IP: %s\n", u.ip);
System.out.printf("Account Status: %s\n", u.status);
System.out.printf("Created At: %s\n", u.createdAt);
System.out.printf("Last Login: %s\n", u.lastLoginAt);
System.out.printf("2FA Enabled: %b\n", u.twoFactorEnabled);
for (NightAuthApi.SubscriptionData sub : u.subscriptions) {
System.out.printf("Tier: %s | Key: %s | Expires: %s | Seconds Left: %d\n",
sub.subscription, sub.key, sub.expiry, sub.timeLeft);
}String motd = NightAuthApp.getGlobalVar("server_motd");
System.out.printf("Announcement: %s\n", motd);// Retrieve a per-user encrypted variable
String theme = NightAuthApp.getUserVar("custom_theme");
// Set or update a per-user variable
NightAuthApp.setUserVar("custom_theme", "dark_obsidian");
// Fetch all per-user variables
if (NightAuthApp.getUserVariables()) {
Object vars = NightAuthApp.response.payload != null ? NightAuthApp.response.payload.get("variables") : null;
}NightAuthApp.log("User initialized workflow #42");NightAuthApp.ban("Security tampering detected");// 1. Trigger JSON payload webhook
Map<String, Object> payload = Map.of("event", "user_action", "score", 42);
NightAuthApi.WebhookResult result = NightAuthApp.triggerWebhook("webhook-id", payload);
if (result != null && result.success) {
System.out.printf("Webhook response (HTTP %d): %s\n", result.status, result.data);
}
// 2. Upload file securely via server-side webhook proxy
byte[] reportBytes = "Audit dump content...".getBytes(java.nio.charset.StandardCharsets.UTF_8);
NightAuthApi.WebhookResult fileResult = NightAuthApp.triggerWebhookFile("webhook-id", reportBytes, "audit.log", payload);byte[] fileData = NightAuthApp.downloadFile("asset_file_id");
if (fileData != null) {
// Process or load payload directly into memory (e.g. ClassLoader defineClass)
// Wipe buffer from memory immediately after execution:
java.util.Arrays.fill(fileData, (byte) 0);
}// Fetch recent message history
List<NightAuthApi.ChatMessage> messages = NightAuthApp.getChatMessages("general", 0L, true);
for (NightAuthApi.ChatMessage msg : messages) {
System.out.printf("[%s] %s: %s\n", msg.timestamp, msg.author, msg.message);
}
// Send a message to a channel
NightAuthApp.sendChatMessage("Hello from Java SDK!", "general");NightAuthApi.EventSubscription sub = NightAuthApp.subscribeEvents((payload) -> {
System.out.printf("[EVENT] %s\n", payload);
});
// Close event stream when finished
sub.close();// Step 1: Initialize TOTP setup
NightAuthApi.TwoFactorSetupData setup = NightAuthApp.setup2FA();
if (setup != null) {
System.out.printf("Secret: %s | URI: %s\n", setup.secret, setup.uri);
}
// Step 2: Confirm with 6-digit TOTP code
NightAuthApi.TwoFactorConfirmData conf = NightAuthApp.confirm2FA("123456");
if (conf != null) {
System.out.println("2FA Activated! Backup Codes:");
for (String code : conf.backupCodes) {
System.out.printf(" - %s\n", code);
}
}
// Step 3: Disable 2FA if needed
boolean disabled = NightAuthApp.disable2FA(password, "123456");// Keep session active with periodic ping
NightAuthApp.heartbeat();
// Revoke session on cloud and close client
NightAuthApp.logout();
NightAuthApp.close();if (NightAuthApp.changeUsername("new_alias", "CurrentPassword123!")) {
System.out.printf("Username changed successfully to: %s\n", NightAuthApp.user.username);
} else {
System.err.printf("Change username failed: %s\n", NightAuthApp.response.message);
}// Retrieve application usage statistics
NightAuthApi.AppStats stats = NightAuthApp.getStats();
if (stats != null) {
System.out.printf("Users: %d active / %d total | Licenses: %d used / %d total\n",
stats.activeUsers, stats.totalUsers, stats.usedLicenses, stats.totalLicenses);
}
// Fetch list of currently online usernames
List<String> onlineUsers = NightAuthApp.getOnlineUsers();
System.out.printf("Online users (%d): %s\n", onlineUsers.size(), String.join(", ", onlineUsers));String fileSha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
if (NightAuthApp.verifyFileHash(fileSha256)) {
System.out.println("Binary matches registered server checksum.");
} else {
System.err.println("Integrity verification failed!");
}// Retrieve stable hardware fingerprint identifier
String hwid = NightAuthApi.getHardwareId();
System.out.printf("Device HWID: %s\n", hwid);// Pin server signing (Ed25519) and sealed-box (X25519) public keys
NightAuthApi.PinnedKeys pinned = new NightAuthApi.PinnedKeys(
"cdb2285db481666ce40003aadb874c8751dbeb9a0672a37f740dfe881ecdc742",
"b773fc4f6cf1a0938e78e714c3d84cb386584bea24728923008471a6cd203213"
);
// Initialize with custom API endpoint and pinned keys
NightAuthApi customAuth = new NightAuthApi(
"Custom App",
"na_custom_key",
"1.0",
null,
"https://nightauth.org/api/v1",
false,
pinned
);
// Configure HTTP request timeout
customAuth.setRequestTimeoutMillis(15000);// Download and verify Ed25519 digitally signed update manifest with monotonic sequence protection
String downloadedJar = NightAuthApi.SignedUpdateInstaller.download(
"https://releases.example.com/manifest.json",
"cdb2285db481666ce40003aadb874c8751dbeb9a0672a37f740dfe881ecdc742",
"SDK Example App",
"updates/app-v2.0.jar"
);
System.out.printf("Verified update downloaded to: %s\n", downloadedJar);# Interactive Terminal Console Client
javac -d build sdk/src/main/java/com/nightauth/sdk/NightAuthApi.java console/src/main/java/com/nightauth/console/Main.java
java -cp build com.nightauth.console.Main
# Modern Java Swing Desktop Client
javac -d build sdk/src/main/java/com/nightauth/sdk/NightAuthApi.java desktop/Main.java
java -cp build com.nightauth.desktop.Main| Feature | NightAuth | KeyAuth | Auth.gg |
|---|---|---|---|
| Cryptography | End-to-End Curve25519 (X25519) + ChaCha20-Poly1305 | Static AES-CBC (Vulnerable to MITM & Proxy Interception) | Legacy HTTPS / Plain JSON |
| Hardware ID (HWID) | Multi-Component Cryptographic Hash (Anti-Spoofing) | Raw WMI Strings (Trivially Spoofed) | Simple Registry / MAC |
| Edge Network Latency | < 35ms Global Anycast Edge Network | Single-Origin VPS (Frequent Network Outages) | Unmaintained / High Latency |
| Reseller System & Bots | Built-in Multi-Tier Credit Balances + Discord & Telegram Bots | Manual API / Third-Party Scripts | Incomplete / Deprecated |
| In-Memory Streaming | Zero-Disk Decryption with Direct Memory Execution & Buffer Wiping | Disk Writes Required | Not Supported |
| Internationalization | 10 Languages Supported Out of the Box across Documentation & SDKs | English Only | English Only |
Read the full architectural benchmark: NightAuth vs KeyAuth vs Auth.gg
This project is licensed under the Elastic License 2.0.
- You may not provide the software to third parties as a hosted or managed service.
- You may not move, change, disable, or circumvent the license key functionality.
- You may not alter, remove, or obscure any licensing or copyright notices.
See the LICENSE file for the full legal text.



