{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "auth-05",
  "title": "Passkey 与多因素验证",
  "description": "登录第二步：通行密钥、验证器 App、短信验证码和恢复码四种验证方式，可互相切换，并支持记住设备。",
  "registryDependencies": [
    "https://yiui.dev/r/auth-05-panel.json",
    "https://yiui.dev/r/grid-layout.json"
  ],
  "files": [
    {
      "path": "src/registry/blocks/auth-05/auth-05.tsx",
      "content": "\"use client\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n  GridContainer,\n  GridSection,\n} from \"@/components/ui/grid-layout/grid-layout\"\nimport { Auth05Panel } from \"./auth-05-panel\"\nimport {\n  Auth05AccountContent,\n  Auth05Alternatives,\n  Auth05Announcer,\n  Auth05HelpLink,\n  Auth05Intro,\n  Auth05MethodBody,\n  Auth05RememberDevice,\n} from \"./parts\"\nimport type { Auth05Props } from \"./types\"\nimport { useAuth05 } from \"./use-auth-05\"\n\n/**\n * 登录第二步（整页版）：账号已通过第一步认证，这里再完成一次通行密钥、验证码或恢复码验证。\n * 真实认证由回调接入。和 Auth05Panel 共用同一套状态与零件，只是外面加了线条网格外壳，\n * 并在桌面宽度下把「其他验证方式」放到主面板右侧。\n */\nfunction Auth05(props: Auth05Props) {\n  const auth = useAuth05(props)\n  const { className, ...rootProps } = auth.rootProps\n  const hasFooter = auth.showRememberDevice || Boolean(auth.helpHref)\n\n  return (\n    <div\n      data-slot=\"auth-05\"\n      data-method={auth.method}\n      data-state={auth.done ? \"success\" : \"idle\"}\n      className={cn(\n        \"w-full overflow-x-clip bg-background text-foreground\",\n        className,\n      )}\n      {...rootProps}\n    >\n      <GridContainer className=\"max-w-3xl\">\n        <GridSection topLine className=\"px-4 py-8 sm:px-6\">\n          <Auth05Intro auth={auth} defaultLevel={1} />\n        </GridSection>\n        {/* 账号摘要放在标题之后：先说明要做什么，再说明是哪个账号 */}\n        <GridSection\n          data-slot=\"auth-05-account\"\n          className=\"flex flex-wrap items-center gap-x-3 gap-y-1 px-4 py-3 sm:px-6\"\n        >\n          <Auth05AccountContent auth={auth} />\n        </GridSection>\n        <GridSection\n          className={cn(\n            \"grid\",\n            !auth.done &&\n              auth.others.length > 0 &&\n              \"md:grid-cols-[minmax(0,1fr)_17rem]\",\n          )}\n        >\n          <div className=\"px-4 py-8 sm:px-6\">\n            <Auth05MethodBody auth={auth} />\n          </div>\n          {!auth.done && auth.others.length > 0 && (\n            // 右栏用虚线与主面板分开；窄屏变成面板下方的一块，用上边的虚线分隔\n            <Auth05Alternatives\n              auth={auth}\n              className=\"border-t border-dashed border-edge px-4 py-6 sm:px-6 md:border-t-0 md:border-l md:px-4 md:py-8\"\n            />\n          )}\n        </GridSection>\n        {!auth.done && hasFooter && (\n          <GridSection className=\"flex flex-col gap-3 px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-6\">\n            {auth.showRememberDevice && (\n              <div className=\"sm:w-72\">\n                <Auth05RememberDevice auth={auth} />\n              </div>\n            )}\n            <Auth05HelpLink auth={auth} />\n          </GridSection>\n        )}\n      </GridContainer>\n      <Auth05Announcer auth={auth} />\n    </div>\n  )\n}\n\nexport { Auth05, Auth05Panel }\nexport type {\n  Auth05Account,\n  Auth05Method,\n  Auth05Props,\n  Auth05RecoveryCode,\n} from \"./types\"\nexport type { Auth05Labels } from \"./config\"\n",
      "type": "registry:component",
      "target": "@components/auth-05/auth-05.tsx"
    },
    {
      "path": "src/registry/blocks/auth-05/page.tsx",
      "content": "\"use client\"\n\nimport { useRouter } from \"next/navigation\"\n\nimport { Auth05 } from \"@/components/auth-05/auth-05\"\n\n/**\n * 登录第二步：账号已通过第一步认证后进入这里。\n * 把下面的回调换成自己的认证服务；通行密钥的 WebAuthn 调用写在 onPasskey 里，\n * challenge 必须从服务端获取，不要在客户端生成。\n */\nexport default function VerifyPage() {\n  const router = useRouter()\n  return (\n    <main className=\"flex min-h-screen flex-col justify-center bg-background py-8 text-foreground\">\n      <Auth05\n        account={{ email: \"name@example.com\", phone: \"13800138000\" }}\n        helpHref=\"/support\"\n        onPasskey={async () => {\n          throw new Error(\"请接入通行密钥验证\")\n        }}\n        onSendCode={async () => {\n          throw new Error(\"请接入短信发送接口\")\n        }}\n        onVerify={async () => {\n          throw new Error(\"请接入验证码校验接口\")\n        }}\n        onSuccess={() => router.push(\"/\")}\n        onSwitchAccount={() => router.push(\"/login\")}\n      />\n    </main>\n  )\n}\n",
      "type": "registry:page",
      "target": "app/login-verify/page.tsx"
    }
  ],
  "cssVars": {
    "theme": {
      "color-edge": "var(--edge)"
    },
    "light": {
      "edge": "color-mix(in oklch, var(--foreground) 12%, transparent)"
    },
    "dark": {
      "edge": "color-mix(in oklch, var(--foreground) 18%, transparent)"
    }
  },
  "meta": {
    "iframeHeight": "800px"
  },
  "type": "registry:block"
}
