import { createSignal, Show } from "solid-js"; import type { PasskeyEntry } from "../../shared/types"; interface PasskeyEntryProps { entry: PasskeyEntry | null; onDelete: () => void | Promise; } function formatDate(timestamp?: number): string { if (!timestamp) return "Never"; return new Date(timestamp).toLocaleDateString(); } function formatUsedCount(count?: number): string { const used = count ?? 0; return `used ${used} time${used === 1 ? "" : "s"}`; } function algorithmLabel(algorithm: -7 | -8): string { return algorithm === -8 ? "EdDSA (Ed25519)" : "ES256 (P-256)"; } function titleSizeClass(title: string): string { if (title.length >= 28) return "peach-entry-name--xxl"; if (title.length >= 20) return "peach-entry-name--xl"; if (title.length >= 14) return "peach-entry-name--lg"; return ""; } export function PasskeyEntryView(props: PasskeyEntryProps) { const [deleteConfirmPending, setDeleteConfirmPending] = createSignal(false); return (
no passkey selected
}> {(entry) => ( <>

{entry().title}

{entry().rpId} passkey
username
{entry().userName}
display name
{entry().userDisplayName}
algorithm
{algorithmLabel(entry().algorithm)}
activity
{formatUsedCount(entry().signCount)} created {formatDate(entry().createdAt)} last used {formatDate(entry().lastUsedAt)}
The private key is stored encrypted in your Peach vault and is never shown in the UI.
setDeleteConfirmPending(true)} > remove passkey } >
Remove this passkey?
)} ); }