diff --git a/desktop/src/features/agents/ui/VerifyReceiptDialog.tsx b/desktop/src/features/agents/ui/VerifyReceiptDialog.tsx index e14893975ee..e2282188506 100644 --- a/desktop/src/features/agents/ui/VerifyReceiptDialog.tsx +++ b/desktop/src/features/agents/ui/VerifyReceiptDialog.tsx @@ -3,6 +3,7 @@ import { ShieldCheck, ShieldX } from "lucide-react"; import { verifyWorkReceipt } from "@/shared/api/tauriTrustLedger"; import type { ReceiptVerification } from "@/shared/api/types"; +import { truncateNpub } from "@/shared/lib/pubkey"; import { Badge } from "@/shared/ui/badge"; import { Button } from "@/shared/ui/button"; import { @@ -19,12 +20,6 @@ const LEVEL_LABEL: Record = { autonomous: "Autonomous", }; -function shortKey(pubkey: string): string { - return pubkey.length > 16 - ? `${pubkey.slice(0, 8)}…${pubkey.slice(-6)}` - : pubkey; -} - function formatIssued(unixSeconds: number): string { return new Date(unixSeconds * 1_000).toLocaleString(undefined, { month: "short", @@ -125,11 +120,11 @@ export function VerifyReceiptDialog({
Issuer
- {shortKey(result.issuerPubkey ?? "")} + {truncateNpub(result.issuerPubkey ?? "")}
Agent
- {shortKey(result.summary.agentPubkey)} + {truncateNpub(result.summary.agentPubkey)}
Issued
{formatIssued(result.issuedAt ?? 0)}
diff --git a/desktop/src/features/time-machine/ui/TimeMachineScreen.tsx b/desktop/src/features/time-machine/ui/TimeMachineScreen.tsx index dae1598cbfa..a6457b7024f 100644 --- a/desktop/src/features/time-machine/ui/TimeMachineScreen.tsx +++ b/desktop/src/features/time-machine/ui/TimeMachineScreen.tsx @@ -13,7 +13,7 @@ import { import { getOrgTimeline } from "@/shared/api/tauriTimeMachine"; import type { TimelineEvent } from "@/shared/api/types"; import { cn } from "@/shared/lib/cn"; -import { normalizePubkey } from "@/shared/lib/pubkey"; +import { normalizePubkey, truncateNpub } from "@/shared/lib/pubkey"; import { Badge } from "@/shared/ui/badge"; import { Button } from "@/shared/ui/button"; import { UserAvatar } from "@/shared/ui/UserAvatar"; @@ -32,10 +32,6 @@ const FEED_ROWS = 40; type Named = { name: string; avatarUrl: string | null }; -function shortKey(pubkey: string): string { - return `${pubkey.slice(0, 6)}…${pubkey.slice(-4)}`; -} - function formatInstant(unixSeconds: number): string { return new Date(unixSeconds * 1_000).toLocaleString(undefined, { weekday: "short", @@ -133,7 +129,7 @@ export function TimeMachineScreen(): React.ReactElement { }, [channels]); const nameOf = (pubkey: string): Named => agentNames.get(normalizePubkey(pubkey)) ?? { - name: shortKey(pubkey), + name: truncateNpub(pubkey), avatarUrl: null, }; const channelOf = (channelId: string | null): string | null =>