{"_id":"@authdog/redwood","_rev":"2-2e7ffdfbddde7002a9d7cfb113347e4c","name":"@authdog/redwood","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@authdog/redwood","version":"0.1.0","_id":"@authdog/redwood@0.1.0","maintainers":[{"name":"dbrrt","email":"david@barrat.io"}],"homepage":"https://github.com/authdog-labs/web-sdk/tree/main/packages/redwood#readme","bugs":{"url":"https://github.com/authdog-labs/web-sdk/issues"},"dist":{"shasum":"e2bb05ebe5acacb77331e96a961be3ebf2871352","tarball":"https://registry.npmjs.org/@authdog/redwood/-/redwood-0.1.0.tgz","fileCount":14,"integrity":"sha512-xO+L3FoEDt6J/n4CFXlGjTIZ1p3u8wb7UZQ3rFBoualLNSeQ+75NGzlYmoaDIHfkZiS6u4n2sM67RMaVSXnbkA==","signatures":[{"sig":"MEUCIQCpwRbL/lVbtVxa7fpwMG3HEP2OSpEhABdKiYQDaAfX4wIgQaf1zgRIkA/lFA/Em4zd+3RGkK4TpS+K/sZeS37rUY8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":60950},"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"},"./api":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./web":{"types":"./dist/web.d.ts","import":"./dist/web.mjs","require":"./dist/web.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/redwood"},"_npmVersion":"10.9.8","description":"Authdog RedwoodJS 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","react-dom":"^18.2.0 || ^19.0.0"},"_npmOperationalInternal":{"tmp":"tmp/redwood_0.1.0_1783118235025_0.18235849758703893","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@authdog/redwood","version":"0.1.1","description":"Authdog RedwoodJS 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"},"./api":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./web":{"types":"./dist/web.d.ts","import":"./dist/web.mjs","require":"./dist/web.js"}},"sideEffects":false,"repository":{"type":"git","url":"git+https://github.com/authdog-labs/web-sdk.git","directory":"packages/redwood"},"homepage":"https://github.com/authdog-labs/web-sdk/tree/main/packages/redwood#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":{"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/redwood@0.1.1","gitHead":"8fc45848451bd383934b3dcccbad1cae7ba15fe8","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-u1DJMPbO6vAS8EenBWkHstRqPPyQZZ2Q5tf6IvIMc6QF2d0anoVPRp+cJrxKsoEAwgrdUQ+/5DyYivhsJrgpOg==","shasum":"12673c24bef2e56170268363c6afeb2b344e72a4","tarball":"https://registry.npmjs.org/@authdog/redwood/-/redwood-0.1.1.tgz","fileCount":14,"unpackedSize":60950,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCfaJDeUtpcrv8X0q/0hfqz2MuJQj+h639eRnrGgloAgwIgYFuBg0qOEC/VPMBNdQjxtPyxsDfIAZosMedKJ8kPhfU="}]},"_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/redwood_0.1.1_1783871975337_0.23223090236550714"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-03T22:37:14.859Z","modified":"2026-07-12T15:59:35.585Z","0.1.0":"2026-07-03T22:37:15.164Z","0.1.1":"2026-07-12T15:59:35.472Z"},"bugs":{"url":"https://github.com/authdog-labs/web-sdk/issues"},"homepage":"https://github.com/authdog-labs/web-sdk/tree/main/packages/redwood#readme","repository":{"type":"git","url":"git+https://github.com/authdog-labs/web-sdk.git","directory":"packages/redwood"},"description":"Authdog RedwoodJS SDK","maintainers":[{"name":"dbrrt","email":"david@barrat.io"}],"readme":"# @authdog/redwood\n\nAuthdog SDK for [RedwoodJS](https://redwoodjs.com/) — a React web-side provider\nplus API-side helpers for Redwood functions and services.\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\nyarn workspace web add @authdog/redwood @authdog/react-elements\nyarn workspace api add @authdog/redwood\n```\n\nProvide your public key (`pk_…`). The web side reads it via Redwood's\n`REDWOOD_ENV_` prefix; the API side reads it server-side:\n\n```bash\nREDWOOD_ENV_AUTHDOG_PUBLIC_KEY=pk_xxxxxxxxxxxxxxxx   # exposed to the browser\nPK_AUTHDOG=pk_xxxxxxxxxxxxxxxx                        # server-only (API)\n```\n\n> Add `AUTHDOG_PUBLIC_KEY` (or the `REDWOOD_ENV_*` name) to\n> `includeEnvironmentVariables` in `redwood.toml` so the web build inlines it.\n\n## Web side\n\nWrap your app in `web/src/App.tsx`:\n\n```tsx\nimport \"@authdog/react-elements/styles.css\";\nimport { AuthdogProvider } from \"@authdog/redwood/web\";\n\nconst App = () => (\n  <AuthdogProvider>\n    <RedwoodProvider titleTemplate=\"%PageTitle | %AppTitle\">\n      <Routes />\n    </RedwoodProvider>\n  </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## API side (functions)\n\n```ts\n// api/src/functions/me.ts\nimport { createAuthdog } from \"@authdog/redwood/api\";\n\nconst authdog = createAuthdog({ publicKey: process.env.PK_AUTHDOG! });\n\n// requireAuth is the real server-side enforcement point.\nexport const handler = authdog.requireAuth(async (event) => ({\n  statusCode: 200,\n  headers: { \"Content-Type\": \"application/json\" },\n  body: JSON.stringify(event.authdog.user),\n}));\n```\n\n```ts\n// api/src/functions/logout.ts\nexport { logoutHandler as handler } from \"@authdog/redwood/api\";\n```\n\nInside a Redwood **service** you can resolve the user from the incoming event:\n\n```ts\nimport { createAuthdog } from \"@authdog/redwood/api\";\nimport { context } from \"@redwoodjs/graphql-server\";\n\nconst authdog = createAuthdog({ publicKey: process.env.PK_AUTHDOG! });\n\nexport const me = async () => {\n  const user = await authdog.getUser(context.event);\n  return user?.user ?? null;\n};\n```\n\n## API\n\n| Export                             | Entry  | Description                                      |\n| ---------------------------------- | ------ | ------------------------------------------------ |\n| `AuthdogProvider`, `ReloadPage`    | `/web` | React provider + callback helper                 |\n| `initAuthdog`, `clearAuthdogToken` | `/web` | Browser token bootstrap / sign-out               |\n| `createAuthdog`                    | `/api` | `getSession`, `getUser`, `requireAuth`, `logout` |\n| `getSessionToken`, `logoutHandler` | `/api` | Low-level helpers                                |\n| `getPublicKeyPayload`              | `/api` | Validated public-key parser                      |\n\n## License\n\n[MIT](../../LICENSE) © Authdog\n","readmeFilename":"README.md"}