UNPKG

1.13 kBTypeScriptView Raw
1/// <reference types="node" />
2import { IncomingMessage, ServerResponse } from "http"
3interface ContentSecurityPolicyDirectiveValueFunction {
4 (req: IncomingMessage, res: ServerResponse): string
5}
6declare type ContentSecurityPolicyDirectiveValue = string | ContentSecurityPolicyDirectiveValueFunction
7export interface ContentSecurityPolicyOptions {
8 useDefaults?: boolean
9 directives?: Record<string, null | Iterable<ContentSecurityPolicyDirectiveValue> | typeof dangerouslyDisableDefaultSrc>
10 reportOnly?: boolean
11}
12interface ContentSecurityPolicy {
13 (options?: Readonly<ContentSecurityPolicyOptions>): (req: IncomingMessage, res: ServerResponse, next: (err?: Error) => void) => void
14 getDefaultDirectives: typeof getDefaultDirectives
15 dangerouslyDisableDefaultSrc: typeof dangerouslyDisableDefaultSrc
16}
17declare const dangerouslyDisableDefaultSrc: unique symbol
18declare const getDefaultDirectives: () => {
19 [x: string]: Iterable<ContentSecurityPolicyDirectiveValue>
20}
21declare const contentSecurityPolicy: ContentSecurityPolicy
22export default contentSecurityPolicy
23export { getDefaultDirectives, dangerouslyDisableDefaultSrc }