@adonisjs/shield
Version:
A middleware for AdonisJS to keep web applications secure from common web attacks
22 lines (21 loc) • 829 B
TypeScript
import type { ContentSecurityPolicyOptions } from 'helmet-csp';
import type { ServerResponse, IncomingMessage } from 'node:http';
import type { ValueOf } from '../../types.js';
/**
* A collection of CSP keywords that are resolved to actual values
* during an HTTP request.
*/
declare class CSPKeywords {
#private;
/**
* Register a custom CSP directive keyword and resolve
* it to a value during an HTTP request.
*/
register(keyword: string, resolver: (_: IncomingMessage, response: ServerResponse) => string): this;
/**
* Resolves keywords
*/
resolve(directiveValues: ValueOf<Exclude<ContentSecurityPolicyOptions['directives'], undefined>>): ValueOf<Exclude<ContentSecurityPolicyOptions['directives'], undefined>>;
}
declare const cspKeywords: CSPKeywords;
export { cspKeywords };