diff --git a/express-jwt/express-jwt-tests.ts b/express-jwt/express-jwt-tests.ts new file mode 100644 index 000000000..64bda77f2 --- /dev/null +++ b/express-jwt/express-jwt-tests.ts @@ -0,0 +1,21 @@ +/// + +import express = require('express'); +import jwt = require('express-jwt'); +import unless = require('express-unless'); + +var app = express(); + +app.use(jwt({ + secret: 'shhhhhhared-secret' +})); +app.use(jwt({ + secret: 'shhhhhhared-secret', + userProperty: 'auth' +})); + +var jwtCheck = jwt({ + secret: 'shhhhhhared-secret' +}); +jwtCheck.unless = unless; +app.use(jwtCheck.unless({ path: '/api/login' })); \ No newline at end of file diff --git a/express-jwt/express-jwt.d.ts b/express-jwt/express-jwt.d.ts new file mode 100644 index 000000000..2e92e6e8d --- /dev/null +++ b/express-jwt/express-jwt.d.ts @@ -0,0 +1,26 @@ +// Type definitions for express-jwt +// Project: https://www.npmjs.org/package/express-jwt +// Definitions by: Wonshik Kim +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "express-jwt" { + import express = require('express'); + import unless = require('express-unless'); + + function jwt(options: jwt.Options): jwt.RequestHandler; + + module jwt { + export interface Options { + secret: string; + skip?: string[]; + credentialsRequired?: boolean; + } + export interface RequestHandler extends express.RequestHandler { + unless?: typeof unless; + } + } + export = jwt; +} \ No newline at end of file