Spaces:
Paused
Paused
File size: 1,768 Bytes
6a041ed | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | <?php
/**
* API Key Generator
* Generate secure random API keys untuk Hugging Face authentication
*/
function generateSecureAPIKey($length = 32) {
// Generate random bytes
$randomBytes = random_bytes($length);
// Convert to hexadecimal
$hexKey = bin2hex($randomBytes);
return $hexKey;
}
// Generate 3 different API keys
echo "=================================================\n";
echo " 🔐 Secure API Key Generator for HF Space\n";
echo "=================================================\n\n";
echo "Generated API Keys (pilih salah satu):\n\n";
for ($i = 1; $i <= 3; $i++) {
$apiKey = generateSecureAPIKey();
echo "API Key #{$i}:\n";
echo $apiKey . "\n\n";
}
echo "=================================================\n";
echo "Setup Instructions:\n";
echo "=================================================\n\n";
echo "1. HUGGING FACE SPACE:\n";
echo " - Buka: https://huggingface.co/spaces/doniramdani820/Textbaru\n";
echo " - Klik: Settings → Variables and secrets\n";
echo " - Add Secret:\n";
echo " Name: API_KEY_SECRET\n";
echo " Value: [paste salah satu key di atas]\n\n";
echo "2. CONFIG.PHP:\n";
echo " - Edit file: config.php\n";
echo " - Update HF_API_KEY dengan key yang sama\n";
echo " define('HF_API_KEY', 'paste_key_disini');\n\n";
echo "3. VERIFY:\n";
echo " - Buka: http://localhost/Captchakings.com/test_hf_integration.php\n";
echo " - Check status: semua harus hijau ✅\n\n";
echo "⚠️ SECURITY WARNING:\n";
echo " - JANGAN share API key ke siapa pun\n";
echo " - JANGAN commit API key ke Git\n";
echo " - Simpan di tempat yang aman\n";
echo "=================================================\n";
?>
|