forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
express-jwt.d.ts
37 lines (31 loc) · 1.15 KB
/
express-jwt.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Type definitions for express-jwt
// Project: https://www.npmjs.org/package/express-jwt
// Definitions by: Wonshik Kim <https://github.com/wokim/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../express/express.d.ts" />
/// <reference path="../express-unless/express-unless.d.ts" />
declare module "express-jwt" {
import express = require('express');
import unless = require('express-unless');
function jwt(options: jwt.Options): jwt.RequestHandler;
interface IDoneCallback<T> {
(err: Error, result: T): void;
}
type ICallback = <T>(req: express.Request, payload: T, done: IDoneCallback<boolean>) => void;
module jwt {
export interface Options {
secret: string|ICallback;
userProperty?: string;
skip?: string[];
credentialsRequired?: boolean;
isRevoked?: boolean;
requestProperty?: string;
getToken?: ICallback;
[property: string]: any;
}
export interface RequestHandler extends express.RequestHandler {
unless?: typeof unless;
}
}
export = jwt;
}