Skip to content
This repository has been archived by the owner on Mar 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #5 from xkr47/add-typescript
Browse files Browse the repository at this point in the history
Add TypeScript typings.
  • Loading branch information
frux authored Jan 24, 2018
2 parents 86d59e5 + d8faaca commit 4b643c0
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
51 changes: 51 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
declare module 'csp-header' {
interface Dictionary<T> {
[index: string]: T;
}

namespace csp {
interface Policies {
'base-uri'?: string[];
'block-all-mixed-content'?: boolean;
'child-src'?: string[];
'connect-src'?: string[];
'default-src'?: string[];
'disown-opener'?: boolean;
'font-src'?: string[];
'form-action'?: string[];
'frame-ancestors'?: string[];
'frame-src'?: string[];
'img-src'?: string[];
'manifest-src'?: string[];
'media-src'?: string[];
'object-src'?: string[];
'plugin-types'?: string[];
'referrer'?: [ string ];
'reflected-xss'?: boolean | string[];
'sandbox'?: boolean | string[];
'script-src'?: string[];
'strict-dynamic'?: boolean | string[];
'style-src'?: string[];
'upgrade-insecure-requests'?: boolean;
'worker-src'?: string[];
}

function nonce(nonceId: string): string;
function resolvePreset(presetName: string): string;
const NONE: string;
const SELF: string;
const INLINE: string;
const EVAL: string;
}

interface Params {
policies?: csp.Policies;
extend?: csp.Policies;
presets?: Array<csp.Policies | string> | Dictionary<csp.Policies | string>;
'report-uri': string;
}

function csp(params: Params): string;

export = csp;
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.1.0",
"description": "Content-Security-Policy header generator",
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"test": "ava"
},
Expand Down

0 comments on commit 4b643c0

Please sign in to comment.