import useSWR from 'swr' import axios from 'axios' import { Tab } from '@headlessui/react' // Nextra uses headlessui usually, or we can build simple tabs import { useState } from 'react' // Interface matching the API response interface CaCertificate { name: string; type: string; serial: string; family_id?: string | null; expires_at: string; cdn_url?: string | null; linux_cdn_url?: string | null; der_cdn_url?: string | null; bat_cdn_url?: string | null; mac_cdn_url?: string | null; } const fetcher = (url: string) => axios.get(url).then(res => res.data.data) export function DynamicInstallationGuide() { const { data: certificates, error, isLoading } = useSWR('https://api.trustlab.dyzulk.com/api/public/ca-certificates', fetcher) const [selectedIndex, setSelectedIndex] = useState(0) if (error) return
Failed to load live certificates. CLI: curl -sL https://cdn.trustlab.dyzulk.com/ca/bundles/trustlab-all.sh | sudo bash
if (isLoading || !certificates) return
Loading dynamic installer links...
const root = certificates.find(c => c.type === 'root') const intermediates = certificates.filter(c => c.type !== 'root') // Helper to format the table rows const renderTable = (os: 'windows' | 'mac' | 'linux' | 'android') => { return (
{/* ROOT CA */} {root && ( )} {/* INTERMEDIATES */} {intermediates.map(cert => ( ))}
Certificate Raw File {os === 'windows' ? 'Auto-Installer Script' : os === 'mac' ? 'Configuration Profile' : os === 'linux' ? 'One-Liner Installer' : 'Alternative Format'}
Root CA {root.name} Download .crt {os === 'windows' && root.bat_cdn_url && ( Download .bat )} {os === 'mac' && root.mac_cdn_url && ( Download .mobileconfig )} {os === 'android' && root.der_cdn_url && ( Download .der )} {os === 'linux' && root.linux_cdn_url && ( curl -sL {root.linux_cdn_url} | sudo bash )}
Intermediate {cert.name} Download .crt {os === 'windows' && cert.bat_cdn_url && ( Download .bat )} {os === 'mac' && cert.mac_cdn_url && ( Download .mobileconfig )} {os === 'linux' && cert.linux_cdn_url && ( curl -sL {cert.linux_cdn_url} | sudo bash )} {os === 'android' && cert.der_cdn_url && ( Download .der )}
) } const tabs = [ { id: 'windows', label: 'Windows' }, { id: 'mac', label: 'macOS' }, { id: 'android', label: 'Android' }, { id: 'linux', label: 'Linux (CLI)' }, ] return (
{tabs.map((tab, idx) => ( ))}
{/* Windows Tab */} {selectedIndex === 0 && (
{renderTable('windows')}

Installation Steps (Raw File)

  1. Double-click the downloaded .crt file.
  2. Click Install Certificate.
  3. Select Local Machine (requires Admin).
  4. Choose "Place all certificates in the following store".
  5. Select Trusted Root Certification Authorities (for Root) or Intermediate Certification Authorities (for Intermediates).
  6. FInish.

*Note: Using the Auto-Installer Script (.bat) handles all of this automatically.*

)} {/* macOS Tab */} {selectedIndex === 1 && (
{renderTable('mac')}

Installation Steps

  • Option 1 (Profile): Download .mobileconfig, go to System Settings > Privacy & Security > Profiles to install.
  • Option 2 (Raw): Download .crt, open in Keychain Access, then set Trust settings to Always Trust.
)} {/* Android Tab */} {selectedIndex === 2 && (
{renderTable('android')}

Installation Steps

  1. Download the .crt (or .der if required by your device).
  2. Go to Settings > Security > Encryption & Credentials.
  3. Tap Install a certificate > CA Certificate.
  4. Select "Install anyway" and choose the file.
)} {/* Linux Tab */} {selectedIndex === 3 && (
{renderTable('linux')}

Manual Installation (If not using One-Liner)

                                
{`# Copy certificates
sudo cp *.crt /usr/local/share/ca-certificates/

# Update Store
sudo update-ca-certificates`}
                                
                            
)}
) }