managarten/packages/shared-nestjs-auth/src/index.ts
Till JS cacf8d7cc1 perf(shared-nestjs-auth): local JWKS verification instead of HTTP call
Replace HTTP POST to /api/v1/auth/validate with local JWT verification
using jose + createRemoteJWKSet. Eliminates ~5-20ms HTTP roundtrip per
API request across all backends. JWKS cached automatically by jose.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 08:57:24 +01:00

29 lines
788 B
TypeScript

/**
* @manacore/shared-nestjs-auth
*
* Shared authentication utilities for NestJS backends.
* Verifies JWT tokens locally using JWKS from the Mana Core Auth service.
*
* @example
* ```typescript
* import { JwtAuthGuard, CurrentUser, CurrentUserData } from '@manacore/shared-nestjs-auth';
*
* @Controller('api')
* @UseGuards(JwtAuthGuard)
* export class MyController {
* @Get('profile')
* getProfile(@CurrentUser() user: CurrentUserData) {
* return { userId: user.userId, email: user.email };
* }
* }
* ```
*/
// Guards
export { JwtAuthGuard } from './guards/jwt-auth.guard';
// Decorators
export { CurrentUser } from './decorators/current-user.decorator';
// Types
export type { CurrentUserData, AuthModuleConfig, TokenValidationResponse } from './types';