@pulzar/core
Version:
Next-generation Node.js framework for ultra-fast web applications with zero-reflection DI, GraphQL, WebSockets, events, and edge runtime support
55 lines • 1.34 kB
TypeScript
import type { FastifyInstance } from "fastify";
export interface SecurityOptions {
csp?: {
enabled: boolean;
directives?: Record<string, string | string[]>;
};
hsts?: {
enabled: boolean;
maxAge?: number;
};
xss?: {
enabled: boolean;
mode?: "block" | "sanitize";
};
csrf?: {
enabled: boolean;
ignoredMethods?: string[];
};
rateLimit?: {
enabled: boolean;
windowMs?: number;
max?: number;
};
}
export declare class SecurityManager {
private app?;
private options;
private csrfTokens;
private rateLimitStore;
constructor(options?: Partial<SecurityOptions>);
initialize(app: FastifyInstance): Promise<void>;
private setupCSP;
private buildCSPHeader;
private setupHSTS;
private setupXSSProtection;
private setupCSRFProtection;
private generateCSRFToken;
private setupRateLimit;
getStats(): {
csp: boolean;
hsts: boolean;
xss: boolean;
csrf: {
enabled: boolean;
activeSessions: number;
};
rateLimit: {
enabled: boolean;
activeKeys: number;
};
};
shutdown(): Promise<void>;
}
export default SecurityManager;
//# sourceMappingURL=security-manager.d.ts.map