{"_id":"@caleblawson/auth-clerk","name":"@caleblawson/auth-clerk","dist-tags":{"latest":"0.10.1"},"versions":{"0.10.1":{"name":"@caleblawson/auth-clerk","version":"0.10.1","description":"Mastra Clerk Auth integration","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./package.json":"./package.json"},"license":"Elastic-2.0","dependencies":{"@clerk/backend":"^1.34.0","@mastra/auth":"npm:@caleblawson/auth@0.1.0"},"devDependencies":{"@types/node":"^20.19.0","eslint":"^9.28.0","tsup":"^8.5.0","typescript":"^5.8.3","vitest":"^2.1.9","@mastra/core":"npm:@caleblawson/core@0.10.7-alpha.0","@internal/lint":"0.0.13"},"scripts":{"build":"tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake","build:watch":"pnpm build --watch","test":"vitest run","lint":"eslint ."},"gitHead":"c31e90130a5c9765c23f688ecea70adc6164543d","_id":"@caleblawson/auth-clerk@0.10.1","_integrity":"sha512-nkunarb/KnKDbLmFhWJjlXCkfe3OkqoPDtDA/d2X3viXq2fhniERqcn2eluCWq8Jd2itkuEaEu6DZHta7jmTjw==","_resolved":"C:\\Users\\caleb\\AppData\\Local\\Temp\\1750404ffc18b1ca7622276d8e4185c4\\caleblawson-auth-clerk-0.10.1.tgz","_from":"file:caleblawson-auth-clerk-0.10.1.tgz","_nodeVersion":"21.2.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-nkunarb/KnKDbLmFhWJjlXCkfe3OkqoPDtDA/d2X3viXq2fhniERqcn2eluCWq8Jd2itkuEaEu6DZHta7jmTjw==","shasum":"e303f5ea40687099fd520887f22b998edc53725c","tarball":"https://registry.npmjs.org/@caleblawson/auth-clerk/-/auth-clerk-0.10.1.tgz","fileCount":23,"unpackedSize":119236,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC8hjZMRl2V0/f2VG3+94dTDxHu0ei5RGRSeL4RP8AgTgIhAKL20Zi/3AVZUo/HV6xV+EuiwNXLTzEX6oVUz4aHjZdj"}]},"_npmUser":{"name":"caleblawson","email":"caleb.lawson@dynapt.com","actor":{"name":"caleblawson","email":"caleb.lawson@dynapt.com","type":"user"}},"directories":{},"maintainers":[{"name":"caleblawson","email":"caleb.lawson@dynapt.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/auth-clerk_0.10.1_1750378164944_0.5590163912347232"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-20T00:09:24.817Z","0.10.1":"2025-06-20T00:09:25.140Z","modified":"2025-06-20T00:09:25.444Z"},"maintainers":[{"name":"caleblawson","email":"caleb.lawson@dynapt.com"}],"description":"Mastra Clerk Auth integration","license":"Elastic-2.0","readme":"# @mastra/auth-clerk\r\n\r\nA Mastra authentication provider for Clerk, enabling seamless integration of Clerk authentication with Mastra applications.\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @mastra/auth-clerk\r\n# or\r\nyarn add @mastra/auth-clerk\r\n# or\r\npnpm add @mastra/auth-clerk\r\n```\r\n\r\n## Usage\r\n\r\n```typescript\r\nimport { Mastra } from '@mastra/core';\r\nimport { MastraAuthClerk } from '@mastra/auth-clerk';\r\n\r\n// Initialize the Clerk auth provider\r\nconst clerkAuth = new MastraAuthClerk({\r\n  jwksUri: 'your-jwks-uri',\r\n  secretKey: 'your-secret-key',\r\n  publishableKey: 'your-publishable-key',\r\n});\r\n\r\n// Or use environment variables\r\nconst clerkAuth = new MastraAuthClerk();\r\n\r\n// Enable auth in Mastra\r\nconst mastra = new Mastra({\r\n  ...\r\n  server: {\r\n    experimental_auth: clerkAuth,\r\n  },\r\n});\r\n```\r\n\r\n## Configuration\r\n\r\nThe package can be configured either through constructor options or environment variables:\r\n\r\n### Environment Variables\r\n\r\n- `CLERK_JWKS_URI`: The JWKS URI for your Clerk instance\r\n- `CLERK_SECRET_KEY`: Your Clerk secret key\r\n- `CLERK_PUBLISHABLE_KEY`: Your Clerk publishable key\r\n\r\n### Constructor Options\r\n\r\n```typescript\r\ninterface MastraAuthClerkOptions {\r\n  jwksUri?: string;\r\n  secretKey?: string;\r\n  publishableKey?: string;\r\n}\r\n```\r\n\r\n## Features\r\n\r\n- JWT token verification using Clerk's JWKS\r\n- User authentication and authorization\r\n- Organization membership verification\r\n- Seamless integration with Mastra's authentication system\r\n\r\n## API\r\n\r\n### `authenticateToken(token: string): Promise<ClerkUser | null>`\r\n\r\nVerifies a JWT token and returns the associated user if valid.\r\n\r\n### `authorizeUser(user: ClerkUser): Promise<boolean>`\r\n\r\nChecks if a user is authorized by verifying their organization membership.\r\n\r\n## License\r\n\r\nMIT\r\n","readmeFilename":"README.md","_rev":"1-c7312fe41eac861f30e735266e1ce30f"}