// Psycho Key SDK — Java example integration // Compile & run: javac PsychoKey.java ExampleJava.java && java ExampleJava import java.util.Scanner; public class ExampleJava { public static void main(String[] args) throws Exception { PsychoKey.Config cfg = new PsychoKey.Config( "my-app", "REPLACE_WITH_64_HEX_PRODUCT_SECRET" ); cfg.version = "1.0.0"; PsychoKey.Client client = new PsychoKey.Client(cfg); System.out.println("HWID: " + client.hwid()); PsychoKey.Result hs = client.init(); if (!hs.ok) { System.out.println("Handshake failed: " + hs.code + " — " + hs.message); return; } Scanner sc = new Scanner(System.in); System.out.print("Enter license key: "); String key = sc.nextLine().trim(); PsychoKey.Result res = client.auth(key); if (!res.ok) { System.out.println("Access denied: " + res.code + " — " + res.message); if ("HWID_LIMIT".equals(res.code) || "HWID_MISMATCH".equals(res.code)) { System.out.print("Reset HWID? [y/N]: "); if ("y".equalsIgnoreCase(sc.nextLine().trim())) { res = client.resetHwid(key); if (!res.ok) { System.out.println("Reset failed: " + res.code); return; } } else { return; } } else { return; } } System.out.println("License accepted (" + res.license.status + ")"); for (int i = 0; i < 3; i++) { Thread.sleep(3000); PsychoKey.Result hb = client.heartbeat(); if (!hb.ok) { System.out.println("Session lost: " + hb.code); return; } System.out.println("Heartbeat OK (" + hb.license.secondsLeft + "s left)"); } client.logout(); System.out.println("Done."); } }