import React, { useState } from 'react'; function ApiKeyPage({ apiKey, onRegenerateApiKey }) { const [copySuccess, setCopySuccess] = useState(false); const handleCopyToClipboard = async () => { try { await navigator.clipboard.writeText(apiKey); setCopySuccess(true); setTimeout(() => setCopySuccess(false), 2000); } catch (err) { console.error('Failed to copy to clipboard:', err); // Fallback for older browsers const textArea = document.createElement('textarea'); textArea.value = apiKey; document.body.appendChild(textArea); textArea.select(); document.execCommand('copy'); document.body.removeChild(textArea); setCopySuccess(true); setTimeout(() => setCopySuccess(false), 2000); } }; return (
🔐 API Key Management
This API key is used to encrypt and authenticate data uploads from remote clients. Note: Requests from localhost (127.0.0.1) do not require an API key.
📡 Remote Data Upload API

External tools can upload sample data remotely using the REST API. For remote clients, the API key is required for authentication:

{`curl -s -X POST \\
    -H "Content-Type: application/json" \\
    -H "Accept: application/json" \\
    -H "X-API-Key: ${apiKey}" \\
    --data @{{JSON_FILE_NAME}} \\
    "${window.location.origin}/api/v1/upload"`}
              
Replace {'{{JSON_FILE_NAME}}'} with the path to your JSON file containing the sample data.
For localhost clients: The X-API-Key header is optional and can be omitted.
â„šī¸ How it works:
  • Remote clients require API key authentication for security
  • Localhost clients (127.0.0.1) can access the API without authentication
  • Your data is encrypted using AES-256-GCM with PBKDF2 key derivation
  • Data is automatically cleared after first retrieval (one-time use)
  • Sessions expire after 1 hour for security
  • Maximum 100 concurrent sessions supported
); } export default ApiKeyPage;