Files
DefinitelyTyped/types/koa-jwt/index.d.ts
Andy 954ee278de Update TypeScript Versions to be at least as high as dependencies' versions (#21288)
* Update `TypeScript Version`s to be at least as high as dependencies' versions

* Run through again
2017-11-08 09:12:14 -08:00

43 lines
1.1 KiB
TypeScript

// Type definitions for koa-jwt 3.2
// Project: https://github.com/koajs/jwt
// Definitions by: Bruno Krebs <https://github.com/brunokrebs>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import Koa = require("koa");
export = jwt;
declare function jwt(options: jwt.Options): jwt.Middleware;
declare namespace jwt {
interface Options {
secret: string | Buffer | SecretProvider;
key?: string;
getToken?(opts: Options): string;
passthrough?: boolean;
cookie?: string;
debug?: boolean;
}
interface UnlessOptions {
method?: string | string[];
path?: string | string[] | RegExp | RegExp[];
ext?: string| string[];
custom?(ctx?: Koa.Context): boolean;
useOriginalUrl?: boolean;
}
type Middleware = Koa.Middleware & {
unless(options?: UnlessOptions): any;
};
type SecretProvider = (header: TokenHeader) => Promise<string>;
interface TokenHeader {
alg: string;
kid: string;
typ: string;
}
}