UNPKG

@harmonyjs/controller-auth-session

Version:

Authentication controller for Harmony using Session

19 lines (18 loc) 679 B
import FastifySession from 'fastify-session'; import 'fastify-cookie'; import { Controller } from '@harmonyjs/server'; declare module 'fastify' { interface FastifyInstance { sessionAuthenticate: { block: (request: FastifyRequest, reply: FastifyReply<any>) => Promise<void>; try: (request: FastifyRequest) => Promise<void>; }; } } declare type AuthenticationSessionConfig = Omit<FastifySession.Options, 'secret'> & { secret?: FastifySession.Options['secret']; }; declare const ControllerAuthenticationSession: Controller<AuthenticationSessionConfig> & { validator: string; }; export default ControllerAuthenticationSession;