- auth.ts: 80→18 lines, delegates to createAuthMiddleware() - request-context.ts: delegates to createRequestContext() - Re-exports JwtPayload, AuthPayload from shared package
21 lines
794 B
TypeScript
21 lines
794 B
TypeScript
/**
|
|
* Request-level product context helpers — delegates to @bytelyst/fastify-auth.
|
|
*/
|
|
import { createRequestContext } from '@bytelyst/fastify-auth';
|
|
import type { FastifyRequest } from 'fastify';
|
|
import { PRODUCT_ID } from './product-config.js';
|
|
|
|
export type { JwtPayload } from '@bytelyst/fastify-auth';
|
|
|
|
const _ctx = createRequestContext({ productId: PRODUCT_ID });
|
|
|
|
export function getRequestProductId(req: FastifyRequest): string {
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
|
|
return _ctx.getRequestProductId(req as any);
|
|
}
|
|
|
|
export function getUserId(req: FastifyRequest): string {
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
|
|
return _ctx.getUserId(req as any);
|
|
}
|