declare const ALLOW = "'allow'"; declare const ALLOW_DOWNLOADS = "allow-downloads"; declare const ALLOW_DOWNLOADS_WITHOUT_USER_ACTIVATION = "allow-downloads-without-user-activation"; declare const ALLOW_DUPLICATES = "'allow-duplicates'"; declare const ALLOW_FORMS = "allow-forms"; declare const ALLOW_MODALS = "allow-modals"; declare const ALLOW_ORIENTATION_LOCK = "allow-orientation-lock"; declare const ALLOW_POINTER_LOCK = "allow-pointer-lock"; declare const ALLOW_POPUPS = "allow-popups"; declare const ALLOW_POPUPS_TO_ESCAPE_SANDBOX = "allow-popups-to-escape-sandbox"; /** * @deprecated */ declare const ALLOW_POPUPS_TO_ESACPE_SANDBOX = "allow-popups-to-escape-sandbox"; declare const ALLOW_PRESENTATION = "allow-presentation"; declare const ALLOW_SAME_ORIGIN = "allow-same-origin"; declare const ALLOW_STORAGE_ACCESS_BY_USER_ACTIVATION = "allow-storage-access-by-user-activation"; declare const ALLOW_SCRIPTS = "allow-scripts"; declare const ALLOW_TOP_NAVIGATION = "allow-top-navigation"; declare const ALLOW_TOP_NAVIGATION_BY_USER_ACTIVATION = "allow-top-navigation-by-user-activation"; declare const BLOB = "blob:"; declare const BLOCK = "'block'"; declare const DATA = "data:"; declare const HTTP = "http:"; declare const HTTPS = "https:"; declare const NO_REFERRER = "'no-referrer'"; declare const NONE = "'none'"; declare const NONE_WHEN_DOWNGRADE = "'none-when-downgrade'"; declare const ORIGIN = "'origin'"; declare const ORIGIN_WHEN_CROSS_ORIGIN = "'origin-when-cross-origin'"; declare const REPORT_SAMPLE = "'report-sample'"; declare const SCRIPT = "'script'"; declare const SELF = "'self'"; declare const STRICT_DYNAMIC = "'strict-dynamic'"; declare const UNSAFE_ALLOW_REDIRECTS = "'unsafe-allow-redirects'"; declare const UNSAFE_EVAL = "'unsafe-eval'"; declare const UNSAFE_HASHES = "'unsafe-hashes'"; declare const UNSAFE_INLINE = "'unsafe-inline'"; declare const UNSAFE_URL = "'unsafe-url'"; declare const WASM_UNSAFE_EVAL = "'wasm-unsafe-eval'"; declare const WS = "ws:"; declare const WSS = "wss:"; declare const EVAL = "'unsafe-eval'"; declare const HASHES = "'unsafe-hashes'"; declare const INLINE = "'unsafe-inline'"; declare const NO_REFERER = "'no-referrer'"; interface CSPHeaderParams { directives?: Partial; presets?: CSPPreset; reportUri?: string; } type DirectivesOfType = { [K in keyof CSPDirectives]: CSPDirectives[K] extends T ? K : never; } extends Record ? P : never; type CSPDirectiveName = DirectivesOfType; type CSPListDirectiveName = DirectivesOfType; type CSPStringDirectiveName = DirectivesOfType; type CSPBooleanDirectiveName = DirectivesOfType; type CSPDirectiveValue = CSPListDirectiveValue | CSPStringDirectiveValue | CSPBooleanDirectiveValue; type CSPListDirectiveValue = (string | false)[]; type CSPStringDirectiveValue = string; type CSPBooleanDirectiveValue = boolean; type CSPPreset = CSPPresetsObject | CSPPresetsArray; type CSPPresetsObject = { [presetName: string]: Partial; }; type CSPPresetsArray = Partial[]; type TSource = string; type TNonce = `nonce-${string}`; type THash = `sha${"256" | "384" | "512"}-${string}`; type TMimeType = `${string}/${string}`; type TFetchDirective = false | TSource | TNonce | THash | typeof NONE | typeof SELF | typeof UNSAFE_EVAL | typeof UNSAFE_HASHES | typeof UNSAFE_INLINE; type TAttrDirective = false | THash | typeof NONE | typeof UNSAFE_INLINE | typeof UNSAFE_HASHES; type TDocumentDirective = false | TSource | TNonce | THash | typeof NONE | typeof SELF | typeof UNSAFE_EVAL | typeof UNSAFE_HASHES | typeof UNSAFE_INLINE; type TNavigationDirective = false | TSource | TNonce | THash | typeof NONE | typeof SELF | typeof UNSAFE_EVAL | typeof UNSAFE_HASHES | typeof UNSAFE_INLINE | typeof STRICT_DYNAMIC; type TWebRTCDirective = typeof ALLOW | typeof BLOCK; type CSPDirectives = { "base-uri": (TDocumentDirective | typeof STRICT_DYNAMIC)[]; "block-all-mixed-content": boolean; "child-src": TFetchDirective[]; "connect-src": TFetchDirective[]; "default-src": (TFetchDirective | typeof STRICT_DYNAMIC)[]; "font-src": TFetchDirective[]; "form-action": TNavigationDirective[]; "frame-ancestors": (TSource | typeof SELF | typeof NONE)[]; "frame-src": TFetchDirective[]; "img-src": (TFetchDirective | typeof STRICT_DYNAMIC)[]; "manifest-src": TFetchDirective[]; "media-src": TFetchDirective[]; "navigate-to": TNavigationDirective[]; "object-src": TFetchDirective[]; "plugin-types": TMimeType[]; "prefetch-src": TFetchDirective[]; referrer: typeof NO_REFERRER | typeof NONE_WHEN_DOWNGRADE | typeof ORIGIN | typeof ORIGIN_WHEN_CROSS_ORIGIN | typeof UNSAFE_URL; "report-to": string; "report-uri": string; "require-sri-for": ("script" | "style")[]; "require-trusted-types-for": typeof SCRIPT; sandbox: (typeof ALLOW_DOWNLOADS | typeof ALLOW_DOWNLOADS_WITHOUT_USER_ACTIVATION | typeof ALLOW_FORMS | typeof ALLOW_MODALS | typeof ALLOW_ORIENTATION_LOCK | typeof ALLOW_POINTER_LOCK | typeof ALLOW_POPUPS | typeof ALLOW_POPUPS_TO_ESCAPE_SANDBOX | typeof ALLOW_PRESENTATION | typeof ALLOW_SAME_ORIGIN | typeof ALLOW_SCRIPTS | typeof ALLOW_STORAGE_ACCESS_BY_USER_ACTIVATION | typeof ALLOW_TOP_NAVIGATION | typeof ALLOW_TOP_NAVIGATION_BY_USER_ACTIVATION)[]; "script-src": (TFetchDirective | typeof STRICT_DYNAMIC | typeof REPORT_SAMPLE | typeof WASM_UNSAFE_EVAL)[]; "script-src-attr": (TAttrDirective | typeof REPORT_SAMPLE)[]; "script-src-elem": (TFetchDirective | typeof STRICT_DYNAMIC | typeof REPORT_SAMPLE)[]; "style-src": TFetchDirective[] | typeof REPORT_SAMPLE; "style-src-attr": (TAttrDirective | typeof REPORT_SAMPLE)[]; "style-src-elem": (TFetchDirective | typeof REPORT_SAMPLE)[]; "trusted-types": (string | typeof NONE | typeof ALLOW_DUPLICATES)[]; "upgrade-insecure-requests": boolean; "worker-src": TFetchDirective[]; webrtc: TWebRTCDirective; }; declare const ALLOWED_DIRECTIVES: { 'base-uri': string; 'block-all-mixed-content': string; 'child-src': string; 'connect-src': string; 'default-src': string; 'font-src': string; 'form-action': string; 'frame-ancestors': string; 'frame-src': string; 'img-src': string; 'manifest-src': string; 'media-src': string; 'navigate-to': string; 'object-src': string; 'plugin-types': string; 'prefetch-src': string; referrer: string; 'report-to': string; 'report-uri': string; 'require-sri-for': string; 'require-trusted-types-for': string; sandbox: string; 'script-src': string; 'script-src-attr': string; 'script-src-elem': string; 'style-src': string; 'style-src-attr': string; 'style-src-elem': string; 'trusted-types': string; 'upgrade-insecure-requests': string; webrtc: string; 'worker-src': string; }; /** * Build CSP header value from params */ declare function getCSP(params?: CSPHeaderParams): string; /** * Build CSP nonce string */ declare function nonce(nonceKey: string): string; export { ALLOW, ALLOWED_DIRECTIVES, ALLOW_DOWNLOADS, ALLOW_DOWNLOADS_WITHOUT_USER_ACTIVATION, ALLOW_DUPLICATES, ALLOW_FORMS, ALLOW_MODALS, ALLOW_ORIENTATION_LOCK, ALLOW_POINTER_LOCK, ALLOW_POPUPS, ALLOW_POPUPS_TO_ESACPE_SANDBOX, ALLOW_POPUPS_TO_ESCAPE_SANDBOX, ALLOW_PRESENTATION, ALLOW_SAME_ORIGIN, ALLOW_SCRIPTS, ALLOW_STORAGE_ACCESS_BY_USER_ACTIVATION, ALLOW_TOP_NAVIGATION, ALLOW_TOP_NAVIGATION_BY_USER_ACTIVATION, BLOB, BLOCK, type CSPBooleanDirectiveName, type CSPBooleanDirectiveValue, type CSPDirectiveName, type CSPDirectiveValue, type CSPDirectives, type CSPHeaderParams, type CSPListDirectiveName, type CSPListDirectiveValue, type CSPPreset, type CSPPresetsArray, type CSPPresetsObject, type CSPStringDirectiveName, type CSPStringDirectiveValue, DATA, EVAL, HASHES, HTTP, HTTPS, INLINE, NONE, NONE_WHEN_DOWNGRADE, NO_REFERER, NO_REFERRER, ORIGIN, ORIGIN_WHEN_CROSS_ORIGIN, REPORT_SAMPLE, SCRIPT, SELF, STRICT_DYNAMIC, UNSAFE_ALLOW_REDIRECTS, UNSAFE_EVAL, UNSAFE_HASHES, UNSAFE_INLINE, UNSAFE_URL, WASM_UNSAFE_EVAL, WS, WSS, getCSP, nonce };