@aikidosec/firewall
Version:
Zen by Aikido is an embedded Application Firewall that autonomously protects Node.js apps against common and critical attacks, provides rate limiting, detects malicious traffic (including bots), and more.
17 lines (16 loc) • 804 B
TypeScript
// @ts-ignore
import type { FastifyInstance } from "fastify";
export type FastifyReply = {
status(code: number): FastifyReply;
send(payload: string): FastifyReply;
};
export type FastifyDone = () => void;
export type FastifyRequest = {};
export type FastifyHookHandler = (request: FastifyRequest, reply: FastifyReply, done: FastifyDone) => void | FastifyReply;
/**
* Calling this function will setup rate limiting and user blocking for the provided Fastify app by adding a onRequest hook.
* Attacks will still be blocked by Zen if you do not call this function.
* Execute this function as early as possible in your Fastify app, but after the hook that sets the user.
*/
export declare function addFastifyHook(app: FastifyInstance): void;
export declare const fastifyHook: FastifyHookHandler;