{"_id":"@authdog/gatsby","_rev":"2-8d261f1aec6552288e3af1a1ee076419","name":"@authdog/gatsby","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@authdog/gatsby","version":"0.1.0","_id":"@authdog/gatsby@0.1.0","maintainers":[{"name":"dbrrt","email":"david@barrat.io"}],"homepage":"https://github.com/authdog-labs/web-sdk/tree/main/packages/gatsby#readme","bugs":{"url":"https://github.com/authdog-labs/web-sdk/issues"},"dist":{"shasum":"2acfddb1c973836cb343bfde7fbc7c8e5f4c3589","tarball":"https://registry.npmjs.org/@authdog/gatsby/-/gatsby-0.1.0.tgz","fileCount":20,"integrity":"sha512-/ZmgGLpph8CrFhhrmnQeZRLEfC2T3T7w7kl1UP57eWPXF4GrETSiw0nCeT3p6phxeFoa9IPXTvVwas+ga//Jag==","signatures":[{"sig":"MEUCIHkKLVo8TqRsd4dfce8mCxBKQxtohbHiAPppdMgQo8bKAiEAjQEkLhNf/SKXepbhceoRDWDgPcVqd4E4ti2i1HhmHzM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":102058},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","source":"src/index.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./client":{"types":"./dist/client.d.ts","import":"./dist/client.mjs","require":"./dist/client.js"},"./server":{"types":"./dist/server.d.ts","import":"./dist/server.mjs","require":"./dist/server.js"}},"gitHead":"37846680338938fedec2df3ebb291dcfc452d56a","scripts":{"ship":"bun run build && bun publish --access public","test":"vitest run","build":"bun run clean && tsup","clean":"rm -rf dist","format":"prettier --config .prettierrc.json --write \"**/*.{ts,tsx,md}\"","type-check":"tsc"},"_npmUser":{"name":"dbrrt","email":"david@barrat.io"},"repository":{"url":"git+https://github.com/authdog-labs/web-sdk.git","type":"git","directory":"packages/gatsby"},"_npmVersion":"10.9.8","description":"Authdog Gatsby SDK","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"@authdog/node-commons":"workspace:*"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","react":"^19.0.0","vitest":"^3.2.6","react-dom":"^19.0.0","typescript":"^5.7.2","@types/node":"^26.0.0","@types/react":"^19.2.17","@types/react-dom":"^19.2.3"},"peerDependencies":{"react":"^18.2.0 || ^19.0.0","gatsby":"^5.0.0","react-dom":"^18.2.0 || ^19.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby_0.1.0_1783118237468_0.7966258661785945","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@authdog/gatsby","version":"0.1.1","description":"Authdog Gatsby SDK","source":"src/index.ts","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./client":{"types":"./dist/client.d.ts","import":"./dist/client.mjs","require":"./dist/client.js"},"./server":{"types":"./dist/server.d.ts","import":"./dist/server.mjs","require":"./dist/server.js"}},"sideEffects":false,"repository":{"type":"git","url":"git+https://github.com/authdog-labs/web-sdk.git","directory":"packages/gatsby"},"homepage":"https://github.com/authdog-labs/web-sdk/tree/main/packages/gatsby#readme","bugs":{"url":"https://github.com/authdog-labs/web-sdk/issues"},"scripts":{"format":"prettier --config .prettierrc.json --write \"**/*.{ts,tsx,md}\"","type-check":"tsc","clean":"rm -rf dist","test":"vitest run","build":"bun run clean && tsup","ship":"bun run build && bun publish --access public"},"dependencies":{"@authdog/node-commons":"workspace:*"},"peerDependencies":{"gatsby":"^5.0.0","react":"^18.2.0 || ^19.0.0","react-dom":"^18.2.0 || ^19.0.0"},"devDependencies":{"@types/node":"^26.0.0","@types/react":"^19.2.17","@types/react-dom":"^19.2.3","react":"^19.0.0","react-dom":"^19.0.0","tsup":"^8.3.5","typescript":"^5.7.2","vitest":"^3.2.6"},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"_id":"@authdog/gatsby@0.1.1","gitHead":"8fc45848451bd383934b3dcccbad1cae7ba15fe8","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-QA1kJAYY8eRPXbcmhZPQ+irDPKQ9Wi+tu0HHgwVcqqyCZSKPiq5Ta+NpENuN6RYyytpyws1PMwdCWf/ivrwulw==","shasum":"8377f3b6d52a22495ce328a00a09e2459160e4f4","tarball":"https://registry.npmjs.org/@authdog/gatsby/-/gatsby-0.1.1.tgz","fileCount":20,"unpackedSize":102058,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIC2VBQS9FCCaQY3OP/QZq3lR2RWcbdpC5NtpWNhutLNzAiEAuxCjAj5kncDoVmuMwZsR6hnH8k2R7XTqZjKNdvSkYhE="}]},"_npmUser":{"name":"dbrrt","email":"david@barrat.io"},"directories":{},"maintainers":[{"name":"dbrrt","email":"david@barrat.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/gatsby_0.1.1_1783871983952_0.8716339552531727"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-03T22:37:17.235Z","modified":"2026-07-12T15:59:44.194Z","0.1.0":"2026-07-03T22:37:17.600Z","0.1.1":"2026-07-12T15:59:44.089Z"},"bugs":{"url":"https://github.com/authdog-labs/web-sdk/issues"},"homepage":"https://github.com/authdog-labs/web-sdk/tree/main/packages/gatsby#readme","repository":{"type":"git","url":"git+https://github.com/authdog-labs/web-sdk.git","directory":"packages/gatsby"},"description":"Authdog Gatsby SDK","maintainers":[{"name":"dbrrt","email":"david@barrat.io"}],"readme":"# @authdog/gatsby\n\nAuthdog SDK for [Gatsby](https://www.gatsbyjs.com/) — a React client provider\nplus server helpers for [Gatsby Functions](https://www.gatsbyjs.com/docs/reference/functions/).\n\nSessions use the same `authdog-session` cookie and OIDC `userinfo` flow as every\nother `@authdog/*` package, so one Authdog environment works across your stack.\n\n## Install\n\n```bash\nbun add @authdog/gatsby @authdog/react-elements\n```\n\nProvide your public key (`pk_…`). The browser reads it via Gatsby's `GATSBY_`\nprefix; Functions read it server-side:\n\n```bash\nGATSBY_AUTHDOG_PUBLIC_KEY=pk_xxxxxxxxxxxxxxxx   # exposed to the browser\nPK_AUTHDOG=pk_xxxxxxxxxxxxxxxx                   # server-only (Functions)\n```\n\n## Client\n\nWrap your app in `gatsby-browser.js` / `gatsby-ssr.js`:\n\n```tsx\n// gatsby-browser.js\nimport \"@authdog/react-elements/styles.css\";\nimport { AuthdogProvider } from \"@authdog/gatsby/client\";\n\nexport const wrapRootElement = ({ element }) => (\n  <AuthdogProvider>{element}</AuthdogProvider>\n);\n```\n\nThe provider strips the `?token=…` the login redirect appends and reloads once so\nthe server can persist the HttpOnly session cookie.\n\n## Server (Gatsby Functions)\n\n```ts\n// src/api/me.ts\nimport { createAuthdog } from \"@authdog/gatsby/server\";\n\nconst authdog = createAuthdog({ publicKey: process.env.PK_AUTHDOG! });\n\n// requireAuth is the real server-side enforcement point.\nexport default authdog.requireAuth(async (req, res) => {\n  res.json(req.authdog.user);\n});\n```\n\n```ts\n// src/api/logout.ts\nexport { logoutHandler as default } from \"@authdog/gatsby/server\";\n```\n\n## API\n\n| Export                             | Entry     | Description                                      |\n| ---------------------------------- | --------- | ------------------------------------------------ |\n| `AuthdogProvider`, `ReloadPage`    | `/client` | React provider + callback helper                 |\n| `initAuthdog`, `clearAuthdogToken` | `/client` | Browser token bootstrap / sign-out               |\n| `createAuthdog`                    | `/server` | `getSession`, `getUser`, `requireAuth`, `logout` |\n| `getSessionToken`, `logoutHandler` | `/server` | Low-level helpers                                |\n| `getPublicKeyPayload`              | `/server` | Validated public-key parser                      |\n\n## License\n\n[MIT](../../LICENSE) © Authdog\n","readmeFilename":"README.md"}