function generateApiKey() { const prefix = 'hak'; const suffix = '.g'; const length = 60; const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; let middle = ''; for (let i = 0; i < length; i++) { middle += chars.charAt(Math.floor(Math.random() * chars.length)); } return prefix + middle + suffix; } function downloadApiKey() { const apiKey = generateApiKey(); const filename = 'key.txt'; const content = apiKey; const blob = new Blob([content], { type: 'text/plain' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = filename; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); }