Something went wrong. Try again.
(READ ONLY) Margin is an open annotation layer for the internet. Powered by the AT Protocol.
margin.at
Something went wrong. Try again.
12345678910111213141516171819202122232425262728const INVALID_HANDLE = "handle.invalid";
export function isInvalidHandle(handle?: string | null): boolean { return !handle || handle === INVALID_HANDLE;}
export function shortenDid(did?: string | null): string { if (!did) return ""; if (did.startsWith("did:plc:")) { const id = did.slice("did:plc:".length); return id.length > 10 ? `did:plc:${id.slice(0, 4)}…${id.slice(-4)}` : did; } if (did.startsWith("did:web:")) { return did.slice("did:web:".length); } return did;}
export function displayHandle( handle?: string | null, did?: string | null,): string { if (isInvalidHandle(handle)) { return shortenDid(did) || handle || ""; } return handle as string;}