{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "watermark-trace-identity",
  "title": "Watermark Trace Identity",
  "description": "A sensitive screen whose mark combines the user's email, session id and a minute-resolution time stamp that refreshes, so a screenshot can be traced to a moment.",
  "registryDependencies": [
    "@tealmac/watermark"
  ],
  "files": [
    {
      "path": "registry/patterns/watermark-trace-identity/watermark-trace-identity.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { Watermark } from \"@/components/ui/watermark\"\n\nexport interface WatermarkTraceIdentityProps {\n  email: string\n  sessionId: string\n  children: React.ReactNode\n  /** Clock override for tests. */\n  now?: () => Date\n}\n\nfunction stamp(d: Date) {\n  return d.toISOString().slice(0, 16).replace(\"T\", \" \") + \" UTC\"\n}\n\n/**\n * Screenshots of internal tools are how data leaks. The mark prints three lines:\n * who (email), which session (first 8 characters of the id, enough to look up\n * in logs without exposing the whole token) and when (to the minute, UTC). The\n * time line refreshes each minute so an old capture cannot be passed off as\n * recent.\n */\nexport function WatermarkTraceIdentity({\n  email,\n  sessionId,\n  children,\n  now = () => new Date(),\n}: WatermarkTraceIdentityProps) {\n  const [time, setTime] = React.useState(() => stamp(now()))\n\n  React.useEffect(() => {\n    const id = setInterval(() => setTime(stamp(now())), 60000)\n    return () => clearInterval(id)\n  }, [now])\n\n  return (\n    <Watermark\n      content={[email, `session ${sessionId.slice(0, 8)}`, time]}\n      fontSize={13}\n      gap={[60, 50]}\n      className=\"rounded-xl border p-5\"\n    >\n      {children}\n    </Watermark>\n  )\n}\n",
      "type": "registry:block"
    }
  ],
  "type": "registry:block"
}