import { Cards, Card } from 'nextra/components' import useSWR from 'swr' import axios from 'axios' import { ShieldCheck, Shield, Smartphone, Monitor } from 'lucide-react' import { useEffect, useState } from 'react' 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 CertificateDownload() { const { data: certificates, error } = useSWR('https://api.trustlab.dyzulk.com/api/public/ca-certificates', fetcher) const [os, setOs] = useState<'windows' | 'mac' | 'linux' | 'android' | 'ios' | 'unknown'>('unknown') useEffect(() => { const ua = navigator.userAgent.toLowerCase() if (ua.includes('win')) setOs('windows') else if (ua.includes('mac')) setOs('mac') else if (ua.includes('linux')) setOs('linux') else if (ua.includes('android')) setOs('android') else if (ua.includes('iphone') || ua.includes('ipad')) setOs('ios') }, []) if (error) return
Failed to load certificates. Please check your connection.
if (!certificates) return
Loading certificates...
const rootCerts = certificates.filter(c => c.type === 'root') const interCerts = certificates.filter(c => c.type !== 'root') const getDownloadLink = (cert: CaCertificate) => { if (os === 'windows' && cert.bat_cdn_url) return cert.bat_cdn_url if (os === 'mac' && cert.mac_cdn_url) return cert.mac_cdn_url if (os === 'android' && cert.der_cdn_url) return cert.der_cdn_url if (os === 'ios' && cert.mac_cdn_url) return cert.mac_cdn_url return cert.cdn_url // Default PEM } const getIcon = (type: string) => { return type === 'root' ? : } return (

Root Authorities Auto-Detected: {os.toUpperCase()}

{rootCerts.map(cert => ( {null} ))}

Intermediate Authorities

{interCerts.map(cert => ( {null} ))}
) }