diff --git a/koa-jwt/index.d.ts b/koa-jwt/index.d.ts new file mode 100644 index 0000000000..e2a4435aef --- /dev/null +++ b/koa-jwt/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for koa-jwt 2.1 +// Project: https://github.com/koajs/jwt +// Definitions by: Bruno Krebs +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import Koa = require("koa"); + +export = jwt; + +declare function jwt(options: jwt.Options): Koa.Middleware; + +declare namespace jwt { + export interface Options { + secret: string | Buffer; + key?: string; + getToken?: (opts: jwt.Options) => string; + passthrough?: boolean; + cookie?: string; + debug?: boolean; + } +} diff --git a/koa-jwt/koa-jwt-tests.ts b/koa-jwt/koa-jwt-tests.ts new file mode 100644 index 0000000000..793bf50872 --- /dev/null +++ b/koa-jwt/koa-jwt-tests.ts @@ -0,0 +1,13 @@ +import koa = require('koa'); +import jwt = require('koa-jwt'); + +var app = new koa(); + +app.use(jwt({ + secret: 'some-secret-key' +})); + +app.use(jwt({ + secret: 'some-secret-key', + key: 'auth' +})); diff --git a/koa-jwt/tsconfig.json b/koa-jwt/tsconfig.json new file mode 100644 index 0000000000..0a5cdb2419 --- /dev/null +++ b/koa-jwt/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "koa-jwt-tests.ts" + ] +} diff --git a/koa-jwt/tslint.json b/koa-jwt/tslint.json new file mode 100644 index 0000000000..f9e30021f4 --- /dev/null +++ b/koa-jwt/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +}