mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
* Update `TypeScript Version`s to be at least as high as dependencies' versions * Run through again
43 lines
1.1 KiB
TypeScript
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;
|
|
}
|
|
}
|