{"_id":"@021.is/spine-auth","_rev":"2-98d4357c56a8b7fc701d7661f6470cff","name":"@021.is/spine-auth","dist-tags":{"latest":"0.4.3"},"versions":{"0.4.0":{"name":"@021.is/spine-auth","version":"0.4.0","license":"MIT","_id":"@021.is/spine-auth@0.4.0","maintainers":[{"name":"edvone","email":"edvard@edvone.dev"}],"homepage":"https://github.com/021is/spine-ts#readme","bugs":{"url":"https://github.com/021is/spine-ts/issues"},"dist":{"shasum":"f04786b6b8b9a2cff2eceb34d628077a2d65d26a","tarball":"https://registry.npmjs.org/@021.is/spine-auth/-/spine-auth-0.4.0.tgz","fileCount":8,"integrity":"sha512-tJJY6PAvl+/pzRW31ir2cZifARgxDV4S0LZ/3nTLPkGHAzDm3nQmwGrovEXwIJzNkg9vxcY02qKtkOhw5ja7jw==","signatures":[{"sig":"MEUCIQDKF1rPutEwqlxzFZAK3t58Oa1bev+RZRQUds5FpCETHwIgVk+p90GwvVUWM1RFLwoT45h5Je+iR6Qoyr85LtuitaQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9401},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./next":{"types":"./dist/next.d.ts","import":"./dist/next.js"}},"gitHead":"e4434c6f59db8f586e0f05ffdb3b88a96e68e67b","scripts":{"build":"tsup src/index.ts src/next.ts --format esm --dts --clean --external next","typecheck":"tsc --noEmit"},"_npmUser":{"name":"edvone","email":"edvard@edvone.dev"},"repository":{"url":"git+https://github.com/021is/spine-ts.git","type":"git","directory":"packages/auth"},"_npmVersion":"10.9.4","description":"JWKS verifier + requireUser/requireRole helpers for Next.js route handlers + server actions. Verifies your IdP's issued RS256 tokens.","directories":{},"_nodeVersion":"22.22.0","dependencies":{"jose":"^5.9.6","@021.is/spine-errors":"^0.4.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"next":"^16.0.0","react":"^19.0.0","react-dom":"^19.0.0"},"peerDependencies":{"next":">=15 <17"},"peerDependenciesMeta":{"next":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/spine-auth_0.4.0_1779981932900_0.5359689405430661","host":"s3://npm-registry-packages-npm-production"}},"0.4.3":{"name":"@021.is/spine-auth","version":"0.4.3","license":"MIT","description":"JWKS verifier + requireUser/requireRole helpers for Next.js route handlers + server actions. Verifies your IdP's issued RS256 tokens.","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./next":{"types":"./dist/next.d.ts","import":"./dist/next.js"}},"scripts":{"build":"tsup src/index.ts src/next.ts --format esm --dts --clean --external next","typecheck":"tsc --noEmit"},"dependencies":{"@021.is/spine-errors":"^0.4.3","jose":"^5.9.6"},"peerDependencies":{"next":">=15 <17"},"peerDependenciesMeta":{"next":{"optional":true}},"devDependencies":{"next":"^16.0.0","react":"^19.0.0","react-dom":"^19.0.0"},"repository":{"type":"git","url":"git+https://github.com/021is/spine-ts.git","directory":"packages/auth"},"publishConfig":{"access":"public"},"_id":"@021.is/spine-auth@0.4.3","gitHead":"b9f9333776fa55686cc2feb05f851aa6000b0e05","bugs":{"url":"https://github.com/021is/spine-ts/issues"},"homepage":"https://github.com/021is/spine-ts#readme","_nodeVersion":"22.22.0","_npmVersion":"10.9.4","dist":{"integrity":"sha512-49QsFEq1Ey52jJEILUifa2drXWVmo/x7LGqPX6JR0n25LeGN3xUrOfOOXJzfIgmJNmfZ9IBHtfQq73XPEYS83A==","shasum":"66157f451f512a79bf8b42fc729d89e5cadedea5","tarball":"https://registry.npmjs.org/@021.is/spine-auth/-/spine-auth-0.4.3.tgz","fileCount":9,"unpackedSize":11210,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD/5ysUt3bM+61gGeEA/tjN52xPDb+sReu3B/WX17fzEQIhAM5VhFP9RJfAklZeOWLVAsjfLSjbnx87/FPkyvoRxi4u"}]},"_npmUser":{"name":"edvone","email":"edvard@edvone.dev"},"directories":{},"maintainers":[{"name":"edvone","email":"edvard@edvone.dev"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/spine-auth_0.4.3_1779995225930_0.5495537493216707"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-28T15:25:32.783Z","modified":"2026-05-28T19:07:06.234Z","0.4.0":"2026-05-28T15:25:33.031Z","0.4.3":"2026-05-28T19:07:06.076Z"},"bugs":{"url":"https://github.com/021is/spine-ts/issues"},"license":"MIT","homepage":"https://github.com/021is/spine-ts#readme","repository":{"type":"git","url":"git+https://github.com/021is/spine-ts.git","directory":"packages/auth"},"description":"JWKS verifier + requireUser/requireRole helpers for Next.js route handlers + server actions. Verifies your IdP's issued RS256 tokens.","maintainers":[{"name":"edvone","email":"edvard@edvone.dev"}],"readme":"# @021.is/spine-auth\n\nJWKS-based RS256 JWT verifier with cached key fetching + role/scope guards. Verifies your IdP's issued tokens in production; pair with `@021.is/spine-testing/jwks` for tests.\n\n## Use — verify a token\n\n```ts\nimport { JwksVerifier, requireRoles } from \"@021.is/spine-auth\";\n\nconst verifier = new JwksVerifier({\n  jwksUri: env.JWKS_URI,            // https://auth.example.com/.well-known/jwks.json\n  issuer: env.JWKS_ISSUER,                // \"auth.example.com\"\n  audience: env.JWKS_AUDIENCE,            // your app's client id\n  cacheTtlMs: 60 * 60 * 1000,              // 1h (default)\n});\n\nconst principal = await verifier.verifyFromHeaders(req.headers);\nrequireRoles(principal, [\"admin\"]);\n```\n\n## Use — Next.js route handler\n\n```ts\nimport { withAuth, makeVerifier } from \"@021.is/spine-auth/next\";\nexport const verifier = makeVerifier({ jwksUri: env.JWKS_URI });\n\nexport const GET = withAuth(verifier, async ({ principal }) => {\n  return Response.json({ me: principal.sub });\n}, { roles: [\"admin\"] });\n```\n\n## Behavior\n\n- **Caches JWKS** for `cacheTtlMs` (default 1h)\n- **Force-refreshes** on any unknown `kid` — IdP key rotation doesn't break the cluster\n- Throws `UnauthorizedException` on bad/expired/wrong-issuer token (→ 401)\n- Throws `ForbiddenException` on missing role/scope (→ 403)\n- Pairs with `@021.is/spine-testing/jwks` for in-process test JWKS server (no real IdP needed)\n","readmeFilename":"README.md"}