{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "auth-lock-reveal",
  "type": "registry:component",
  "title": "Auth Lock Reveal",
  "description": "A vault unlock screen with a cutaway pin-tumbler padlock: each typed character sets a pin at the shear line, a key slides in on submit and the shackle springs open to reveal the vault contents. Wrong or short passwords shake the lock.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "auth",
    "auth",
    "unlock",
    "vault",
    "padlock",
    "re-authentication",
    "success"
  ],
  "docs": "https://hyperblur.dev/effects/auth-lock-reveal",
  "files": [
    {
      "path": "registry/hyperblur/auth-lock-reveal.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/auth-lock-reveal.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface AuthLockRevealItem {\n  name: string;\n  meta: string;\n}\n\nexport interface AuthLockRevealProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  vaultName?: string;\n  account?: { name: string; email: string };\n  items?: AuthLockRevealItem[];\n  minLength?: number;\n  defaultPassword?: string;\n  onUnlock?: (password: string) => boolean | void | Promise<boolean | void>;\n  onLock?: () => void;\n  onSwitchAccount?: () => void;\n  accent?: string;\n}\n\nconst css = `\n.hb-vf8 {\n  --hb-vf8-accent: #e6b450;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  min-height: 600px;\n  display: grid;\n  place-items: center;\n  padding: 44px 20px;\n  overflow: hidden;\n  background: radial-gradient(ellipse 50% 40% at 50% 26%, color-mix(in srgb, var(--hb-vf8-accent) 9%, transparent), transparent 70%), #0a0a0a;\n  color: #ededed;\n  font-family: inherit;\n}\n.hb-vf8 *, .hb-vf8 *::before, .hb-vf8 *::after { box-sizing: border-box; }\n.hb-vf8-card { width: 100%; max-width: 380px; text-align: center; }\n.hb-vf8-lock { display: block; width: 168px; height: 168px; margin: 0 auto 6px; overflow: visible; transition: transform .7s cubic-bezier(.3,1.3,.5,1); }\n.hb-vf8[data-stage=\"open\"] .hb-vf8-lock { transform: scale(.78) translateY(-8px); }\n.hb-vf8[data-stage=\"error\"] .hb-vf8-lock { animation: hb-vf8-shake .5s cubic-bezier(.36,.07,.19,.97); }\n.hb-vf8-shackle { fill: none; stroke-width: 13; stroke-linecap: round; transform-origin: 138px 92px; transition: transform .55s cubic-bezier(.3,1.6,.5,1); }\n.hb-vf8[data-stage=\"open\"] .hb-vf8-shackle { transform: translateY(-16px) rotate(-24deg); transition-delay: .15s; }\n.hb-vf8-pin { transition: transform .35s cubic-bezier(.3,1.6,.5,1); }\n.hb-vf8-driver { fill: #4a4a50; transition: fill .3s; }\n.hb-vf8-pin[data-set=\"true\"] .hb-vf8-driver { fill: var(--hb-vf8-accent); }\n.hb-vf8-keypin { fill: #8a8a92; }\n.hb-vf8-shear { stroke: color-mix(in srgb, var(--hb-vf8-accent) 40%, #2a2a2a); stroke-width: 1; stroke-dasharray: 2 3; transition: stroke .4s; }\n.hb-vf8[data-stage=\"open\"] .hb-vf8-shear { stroke: var(--hb-vf8-accent); stroke-dasharray: none; }\n.hb-vf8-plug { fill: #1d1d21; transition: fill .4s .1s; }\n.hb-vf8[data-stage=\"open\"] .hb-vf8-plug { fill: color-mix(in srgb, var(--hb-vf8-accent) 30%, #1d1d21); }\n.hb-vf8-key { transform: translateX(-110px); opacity: 0; transition: transform .6s cubic-bezier(.6,0,.2,1), opacity .2s; }\n.hb-vf8[data-stage=\"checking\"] .hb-vf8-key, .hb-vf8[data-stage=\"open\"] .hb-vf8-key { transform: translateX(0); opacity: 1; }\n.hb-vf8-glow { opacity: 0; transition: opacity .6s .3s; }\n.hb-vf8[data-stage=\"open\"] .hb-vf8-glow { opacity: 1; }\n.hb-vf8-count { display: flex; justify-content: center; gap: 6px; margin: 0 0 18px; }\n.hb-vf8-count i { width: 6px; height: 6px; border-radius: 50%; background: #2a2a2a; transition: background .3s, transform .3s cubic-bezier(.3,1.6,.5,1); }\n.hb-vf8-count i[data-on=\"true\"] { background: var(--hb-vf8-accent); transform: scale(1.25); }\n.hb-vf8-title { margin: 0; font-size: 24px; letter-spacing: -.025em; line-height: 1.2; font-weight: 600; }\n.hb-vf8-sub { margin: 8px 0 20px; color: #8f8f8f; font-size: 14px; line-height: 1.55; }\n.hb-vf8-who { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; margin-bottom: 12px; border-radius: 12px; border: 1px solid #222; background: #101010; text-align: left; }\n.hb-vf8-ava { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; color: #0a0a0a; background: linear-gradient(135deg, #a7f3d0, #60a5fa); }\n.hb-vf8-who b { display: block; font-size: 13px; font-weight: 500; }\n.hb-vf8-who span { display: block; font-size: 12px; color: #8f8f8f; }\n.hb-vf8-who button { margin-left: auto; height: 28px; padding: 0 10px; border: 0; border-radius: 8px; background: #1b1b1b; color: #a1a1a1; font: inherit; font-size: 12px; cursor: pointer; }\n.hb-vf8-who button:hover { color: #ededed; background: #242424; }\n.hb-vf8-row { display: flex; gap: 8px; }\n.hb-vf8-input { flex: 1; min-width: 0; height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid #262626; background: #0c0c0c; color: #ededed; font: inherit; font-size: 15px; letter-spacing: .08em; outline: none; transition: border-color .2s, box-shadow .2s; }\n.hb-vf8-input::placeholder { letter-spacing: 0; color: #5a5a5a; }\n.hb-vf8-input:focus { border-color: var(--hb-vf8-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--hb-vf8-accent) 15%, transparent); }\n.hb-vf8-input[aria-invalid=\"true\"] { border-color: #ef5f5f; }\n.hb-vf8-turn { flex: none; height: 48px; padding: 0 18px; border: 0; border-radius: 12px; display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 14px; font-weight: 600; color: #1a1205; background: linear-gradient(180deg, color-mix(in srgb, var(--hb-vf8-accent) 80%, #fff), var(--hb-vf8-accent)); box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 12px 28px -14px var(--hb-vf8-accent); cursor: pointer; transition: filter .2s, transform .2s cubic-bezier(.2,.8,.2,1); }\n.hb-vf8-turn:hover { filter: brightness(1.06); }\n.hb-vf8-turn:active { transform: scale(.97); }\n.hb-vf8-turn:disabled { cursor: progress; }\n.hb-vf8-msg { min-height: 18px; margin: 10px 0 0; font-size: 12.5px; color: #8f8f8f; }\n.hb-vf8-msg[data-error=\"true\"] { color: #f39494; }\n.hb-vf8-vault { text-align: left; animation: hb-vf8-rise .6s .35s cubic-bezier(.2,.8,.2,1) both; }\n.hb-vf8-vhead { text-align: center; margin-bottom: 18px; }\n.hb-vf8-list { list-style: none; margin: 0 0 16px; padding: 6px; border-radius: 14px; border: 1px solid #222; background: #0f0f0f; }\n.hb-vf8-li { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; font-size: 13.5px; animation: hb-vf8-rise .5s cubic-bezier(.2,.8,.2,1) both; }\n.hb-vf8-li:hover { background: #151515; }\n.hb-vf8-li i { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--hb-vf8-accent) 14%, #141414); color: var(--hb-vf8-accent); }\n.hb-vf8-li span { margin-left: auto; font-size: 12px; color: #6b6b6b; white-space: nowrap; }\n.hb-vf8-relock { width: 100%; height: 42px; border-radius: 11px; border: 1px solid #262626; background: #121212; color: #ededed; font: inherit; font-size: 13.5px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .2s, border-color .2s; }\n.hb-vf8-relock:hover { background: #181818; border-color: #333; }\n.hb-vf8 :is(.hb-vf8-turn, .hb-vf8-relock, .hb-vf8-who button):focus-visible { outline: 2px solid var(--hb-vf8-accent); outline-offset: 3px; }\n@keyframes hb-vf8-shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px) rotate(-2deg); } 40%, 60% { transform: translateX(7px) rotate(2deg); } }\n@keyframes hb-vf8-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-vf8 *, .hb-vf8 *::before, .hb-vf8 *::after { animation: none !important; transition: none !important; }\n}\n`;\n\nconst pinX = [66, 82, 98, 114, 130];\nconst pinOrder = [2, 0, 4, 1, 3];\nconst pinDrop = pinX.map((_, i) => 4 + ((Math.imul(i + 7, 2246822519) >>> 0) % 6));\nconst keyCuts = pinX.map((_, i) => 3 + ((Math.imul(i + 11, 3266489917) >>> 0) % 4));\n\nconst icons = [\n  <path key=\"a\" d=\"M4 3h6l3 3v7H4Z M10 3v3h3\" stroke=\"currentColor\" strokeWidth=\"1.4\" strokeLinejoin=\"round\" fill=\"none\" />,\n  <path key=\"b\" d=\"M2.5 5.5h11v7h-11Z M2.5 8h11 M5 3.5h6\" stroke=\"currentColor\" strokeWidth=\"1.4\" strokeLinejoin=\"round\" fill=\"none\" />,\n  <path key=\"c\" d=\"M3 13V8m3.5 5V4m3.5 9V6.5m3.5 6.5V9\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" fill=\"none\" />,\n];\n\nexport function AuthLockReveal({\n  vaultName = \"Finance vault\",\n  account = { name: \"Daniel Reyes\", email: \"daniel@harbor.co\" },\n  items = [\n    { name: \"Q3 board deck.pdf\", meta: \"Edited 2h ago\" },\n    { name: \"Corporate card ending 4417\", meta: \"Updated yesterday\" },\n    { name: \"Payroll forecast 2027\", meta: \"Tue, 9:40\" },\n  ],\n  minLength = 6,\n  defaultPassword = \"\",\n  onUnlock,\n  onLock,\n  onSwitchAccount,\n  accent = \"#e6b450\",\n  className,\n  style,\n  ...rest\n}: AuthLockRevealProps) {\n  const id = React.useId().replace(/[^a-zA-Z0-9-]/g, \"\");\n  const [password, setPassword] = React.useState(defaultPassword);\n  const [stage, setStage] = React.useState<\"idle\" | \"checking\" | \"open\" | \"error\">(\"idle\");\n  const [message, setMessage] = React.useState<string | null>(null);\n  const inputRef = React.useRef<HTMLInputElement>(null);\n\n  const setCount = Math.min(5, password.length);\n  const initials = account.name.split(\" \").map((p) => p[0]).slice(0, 2).join(\"\");\n\n  const fail = (text: string) => {\n    setMessage(text);\n    setStage(\"idle\");\n    requestAnimationFrame(() => setStage(\"error\"));\n  };\n\n  const unlock = async (e: React.FormEvent) => {\n    e.preventDefault();\n    if (stage === \"checking\") return;\n    if (password.length < minLength) {\n      fail(`Vault passwords have at least ${minLength} characters.`);\n      return;\n    }\n    setMessage(null);\n    setStage(\"checking\");\n    try {\n      const [r] = await Promise.all([\n        onUnlock ? onUnlock(password) : Promise.resolve(true),\n        new Promise((res) => setTimeout(res, 900)),\n      ]);\n      if (r === false) {\n        fail(\"That password did not turn the lock.\");\n        return;\n      }\n      setStage(\"open\");\n    } catch (err) {\n      fail(err instanceof Error ? err.message : \"The vault could not be reached.\");\n    }\n  };\n\n  const relock = () => {\n    setPassword(\"\");\n    setStage(\"idle\");\n    setMessage(null);\n    onLock?.();\n    requestAnimationFrame(() => inputRef.current?.focus());\n  };\n\n  return (\n    <section className={[\"hb-vf8\", className].filter(Boolean).join(\" \")} data-stage={stage} style={{ \"--hb-vf8-accent\": accent, ...style } as React.CSSProperties} {...rest}>\n      <style href=\"hb-auth-lock-reveal\" precedence=\"default\">{css}</style>\n      <div className=\"hb-vf8-card\">\n        <svg className=\"hb-vf8-lock\" viewBox=\"0 0 200 200\" aria-hidden=\"true\">\n          <defs>\n            <linearGradient id={`${id}-steel`} x1=\"0\" y1=\"0\" x2=\"1\" y2=\"0\">\n              <stop offset=\"0\" stopColor=\"#6b6b72\" />\n              <stop offset=\".5\" stopColor=\"#d4d4d8\" />\n              <stop offset=\"1\" stopColor=\"#5b5b62\" />\n            </linearGradient>\n            <linearGradient id={`${id}-body`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n              <stop offset=\"0\" stopColor=\"#2b2b31\" />\n              <stop offset=\"1\" stopColor=\"#16161a\" />\n            </linearGradient>\n            <radialGradient id={`${id}-glow`} cx=\".5\" cy=\".5\" r=\".5\">\n              <stop offset=\"0\" stopColor={accent} stopOpacity=\".55\" />\n              <stop offset=\"1\" stopColor={accent} stopOpacity=\"0\" />\n            </radialGradient>\n            <clipPath id={`${id}-win`}><rect x=\"54\" y=\"100\" width=\"92\" height=\"62\" rx=\"8\" /></clipPath>\n          </defs>\n          <circle className=\"hb-vf8-glow\" cx=\"100\" cy=\"132\" r=\"90\" fill={`url(#${id}-glow)`} />\n          <path className=\"hb-vf8-shackle\" stroke={`url(#${id}-steel)`} d=\"M62 94V60a38 38 0 0 1 76 0v34\" />\n          <rect x=\"38\" y=\"86\" width=\"124\" height=\"98\" rx=\"18\" fill={`url(#${id}-body)`} stroke=\"rgba(255,255,255,.08)\" />\n          <path d=\"M52 90h96\" stroke=\"rgba(255,255,255,.12)\" strokeLinecap=\"round\" />\n          <rect x=\"54\" y=\"100\" width=\"92\" height=\"62\" rx=\"8\" fill=\"#0b0b0d\" stroke=\"rgba(0,0,0,.6)\" />\n          <g clipPath={`url(#${id}-win)`}>\n            <rect className=\"hb-vf8-plug\" x=\"54\" y=\"138\" width=\"92\" height=\"18\" />\n            {pinX.map((x, i) => {\n              const set = pinOrder.indexOf(i) < setCount || stage === \"open\" || stage === \"checking\";\n              return (\n                <g key={x}>\n                  <path d={`M${x + 4} 100 l-3 2.5 6 2.5 -6 2.5 6 2.5 -6 2.5 6 2.5 -3 2`} stroke=\"#3a3a40\" strokeWidth=\"1.2\" fill=\"none\" />\n                  <g className=\"hb-vf8-pin\" data-set={set} style={{ transform: `translateY(${set ? 0 : pinDrop[i]}px)` }}>\n                    <rect className=\"hb-vf8-driver\" x={x} y=\"116\" width=\"8\" height=\"22\" rx=\"1.5\" />\n                    <path className=\"hb-vf8-keypin\" d={`M${x} 138h8v${8 + keyCuts[i]}l-4 3-4-3Z`} />\n                  </g>\n                </g>\n              );\n            })}\n            <line className=\"hb-vf8-shear\" x1=\"54\" y1=\"138\" x2=\"146\" y2=\"138\" />\n          </g>\n          <g className=\"hb-vf8-key\">\n            <circle cx=\"30\" cy=\"154\" r=\"11\" fill=\"none\" stroke={accent} strokeWidth=\"5\" />\n            <path d={`M41 150${pinX.map((x, i) => `L${x} 150L${x + 4} ${149 + keyCuts[i]}L${x + 8} 150`).join(\"\")}L144 150L146 154L144 158H41Z`} fill={accent} />\n          </g>\n          <circle cx=\"100\" cy=\"172\" r=\"2.5\" fill=\"#3a3a40\" />\n        </svg>\n        <div className=\"hb-vf8-count\" aria-hidden=\"true\">\n          {pinX.map((x, i) => <i key={x} data-on={i < setCount || stage === \"open\"} />)}\n        </div>\n        {stage === \"open\" ? (\n          <div className=\"hb-vf8-vault\" role=\"status\">\n            <div className=\"hb-vf8-vhead\">\n              <h2 className=\"hb-vf8-title\">{vaultName} is open</h2>\n              <p className=\"hb-vf8-sub\" style={{ marginBottom: 0 }}>{items.length} items changed since your last visit. Locks again after 5 idle minutes.</p>\n            </div>\n            <ul className=\"hb-vf8-list\">\n              {items.map((it, i) => (\n                <li key={it.name} className=\"hb-vf8-li\" style={{ animationDelay: `${(0.5 + i * 0.08).toFixed(2)}s` }}>\n                  <i aria-hidden=\"true\"><svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\">{icons[i % icons.length]}</svg></i>\n                  {it.name}\n                  <span>{it.meta}</span>\n                </li>\n              ))}\n            </ul>\n            <button type=\"button\" className=\"hb-vf8-relock\" onClick={relock}>\n              <svg width=\"14\" height=\"14\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\"><rect x=\"3\" y=\"7\" width=\"10\" height=\"7\" rx=\"2\" stroke=\"currentColor\" strokeWidth=\"1.5\" /><path d=\"M5.5 7V5a2.5 2.5 0 0 1 5 0v2\" stroke=\"currentColor\" strokeWidth=\"1.5\" /></svg>\n              Lock {vaultName.toLowerCase()}\n            </button>\n          </div>\n        ) : (\n          <form onSubmit={unlock} noValidate>\n            <h2 className=\"hb-vf8-title\">Unlock {vaultName.toLowerCase()}</h2>\n            <p className=\"hb-vf8-sub\">Confirm it is you to see balances, cards and shared files.</p>\n            <div className=\"hb-vf8-who\">\n              <span className=\"hb-vf8-ava\" aria-hidden=\"true\">{initials}</span>\n              <div><b>{account.name}</b><span>{account.email}</span></div>\n              <button type=\"button\" onClick={() => onSwitchAccount?.()}>Not you?</button>\n            </div>\n            <div className=\"hb-vf8-row\">\n              <label htmlFor={`${id}-p`} style={{ position: \"absolute\", width: 1, height: 1, overflow: \"hidden\", clip: \"rect(0 0 0 0)\" }}>Vault password</label>\n              <input ref={inputRef} id={`${id}-p`} className=\"hb-vf8-input\" type=\"password\" autoComplete=\"current-password\" placeholder=\"Vault password\" value={password} onChange={(e) => { setPassword(e.target.value); if (stage === \"error\") setStage(\"idle\"); }} aria-invalid={stage === \"error\" ? true : undefined} aria-describedby={`${id}-m`} />\n              <button type=\"submit\" className=\"hb-vf8-turn\" disabled={stage === \"checking\"} aria-busy={stage === \"checking\"}>\n                <svg width=\"15\" height=\"15\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\"><circle cx=\"5\" cy=\"8\" r=\"3\" stroke=\"currentColor\" strokeWidth=\"1.6\" /><path d=\"M8 8h6.5M12 8v2.5M14 8v2\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" /></svg>\n                {stage === \"checking\" ? \"Turning\" : \"Unlock\"}\n              </button>\n            </div>\n            <p id={`${id}-m`} className=\"hb-vf8-msg\" data-error={stage === \"error\"} role={stage === \"error\" ? \"alert\" : undefined}>\n              {message ?? (setCount >= 5 ? \"All pins set. Turn the key.\" : `${5 - setCount} ${5 - setCount === 1 ? \"pin\" : \"pins\"} left to set`)}\n            </p>\n          </form>\n        )}\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}