28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
import { FastifyRequest, FastifyReply } from 'fastify';
|
|
import { UserRole } from '@prisma/client';
|
|
declare module 'fastify' {
|
|
interface FastifyRequest {
|
|
user?: {
|
|
id: string;
|
|
email: string;
|
|
role: UserRole;
|
|
roles: UserRole[];
|
|
};
|
|
}
|
|
}
|
|
/**
|
|
* Authenticate user via V2 JWT access token
|
|
* Verifies token and checks user status in Prisma database
|
|
*/
|
|
export declare function authenticate(request: FastifyRequest, reply: FastifyReply): Promise<void>;
|
|
/**
|
|
* Require admin role (SUPER_ADMIN, INFLUENCE_ADMIN, or MAP_ADMIN)
|
|
* Also checks auth, so no need to use authenticate() separately
|
|
*/
|
|
export declare function requireAdminRole(request: FastifyRequest, reply: FastifyReply): Promise<void>;
|
|
/**
|
|
* Optional authentication - attach user if token present, but don't require it
|
|
* Used for public endpoints that want to know if user is logged in
|
|
*/
|
|
export declare function optionalAuth(request: FastifyRequest, _reply: FastifyReply): Promise<void>;
|
|
//# sourceMappingURL=auth.d.ts.map
|