import React, { useState, useEffect, useRef } from 'react'; import { Key, Shield, Plus, RefreshCw, Trash2, ChevronRight, Fingerprint, Terminal, ExternalLink, Eye, EyeOff, CheckCircle2, AlertCircle, Code } from 'lucide-react'; import { ClientRegisterRequest, ClientRegisterResponse } from '../types/index.ts'; const MOCK_INITIAL_CLIENTS: ClientRegisterResponse[] = [ { client_id: 'CLI-A192J-B002', client_secret: 'SEC-K992-XXXX-Z102', appId: 'LUMINA_CORE_NODE', client_name: 'Lumina Primary Ledger', clientDisplayName: 'Quantum Master Node', redirect_uris: ['https://lumina.app/auth/callback'], scope: ['accounts_details_transactions', 'customers_profiles'], description: 'The main corporate ledger application for treasury management.', token_endpoint_auth_method: 'client_secret_post' } ]; const SCOPES = [ 'accounts_details_transactions', 'accounts_routing_number', 'customers_profiles', 'accounts_statements', 'accounts_tax_statements' ]; const DCRManagement: React.FC = () => { const [clients, setClients] = useState(MOCK_INITIAL_CLIENTS); const [isRegistering, setIsRegistering] = useState(false); const [selectedClient, setSelectedClient] = useState(null); const [showSecret, setShowSecret] = useState(null); const [logs, setLogs] = useState(['System: DCR Interface Initialized. Waiting for input...']); const logEndRef = useRef(null); const [form, setForm] = useState({ client_name: '', redirect_uris: [''], scope: [], description: '', appId: '' }); useEffect(() => { logEndRef.current?.scrollIntoView({ behavior: 'smooth' }); }, [logs]); const addLog = (msg: string) => setLogs(prev => [...prev, `${new Date().toLocaleTimeString()} - ${msg}`]); const handleRegister = async (e: React.FormEvent) => { e.preventDefault(); addLog(`POST /api/dcr/v1/register - payload: ${JSON.stringify(form)}`); setTimeout(() => { const newClient: ClientRegisterResponse = { ...form, client_id: `CLI-${Math.random().toString(36).substring(2, 9).toUpperCase()}`, client_secret: `SEC-${Math.random().toString(36).substring(2, 12).toUpperCase()}`, grant_types: ['authorization_code', 'refresh_token'], token_endpoint_auth_method: 'client_secret_post' }; setClients([...clients, newClient]); setIsRegistering(false); addLog(`HTTP/1.1 201 Created - New Client ID: ${newClient.client_id}`); }, 1200); }; const handleUpdate = (clientId: string) => { addLog(`PUT /api/dcr/v1/register/${clientId} - Requesting metadata refresh...`); setTimeout(() => { addLog(`HTTP/1.1 200 OK - Metadata synchronized for ${clientId}`); }, 800); }; const handleRevoke = (clientId: string) => { if (!confirm(`Confirm revocation of ${clientId}? This cannot be undone.`)) return; addLog(`DELETE /api/dcr/v1/register/${clientId} - Initiating revocation...`); setTimeout(() => { setClients(clients.filter(c => c.client_id !== clientId)); if (selectedClient?.client_id === clientId) setSelectedClient(null); addLog(`HTTP/1.1 204 No Content - Registration ${clientId} purged from vault.`); }, 1000); }; return (

Dynamic Client Registry

Manage 4th party Data Recipients via FDX-standard DCR flows.

{clients.map(client => ( ))}
{isRegistering ? (

Register New Recipient

setForm({...form, appId: e.target.value})} />
setForm({...form, client_name: e.target.value})} />