mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 11:57:33 +08:00
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
// 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/DefinitelyTyped/DefinitelyTyped
|
|
|
|
import express = require('express');
|
|
import unless = require('express-unless');
|
|
|
|
export = jwt;
|
|
|
|
declare function jwt(options: jwt.Options): jwt.RequestHandler;
|
|
declare namespace jwt {
|
|
export type secretType = string | Buffer
|
|
export interface SecretCallback {
|
|
(req: express.Request, header: any, payload: any, done: (err: any, secret?: boolean) => void): void;
|
|
(req: express.Request, payload: any, done: (err: any, secret?: secretType) => void): void;
|
|
}
|
|
|
|
export interface IsRevokedCallback {
|
|
(req: express.Request, payload: any, done: (err: any, revoked?: boolean) => void): void;
|
|
}
|
|
|
|
export interface GetTokenCallback {
|
|
(req: express.Request): any;
|
|
}
|
|
export interface Options {
|
|
secret: secretType | SecretCallback;
|
|
userProperty?: string;
|
|
skip?: string[];
|
|
credentialsRequired?: boolean;
|
|
isRevoked?: IsRevokedCallback;
|
|
requestProperty?: string;
|
|
getToken?: GetTokenCallback;
|
|
[property: string]: any;
|
|
}
|
|
export interface RequestHandler extends express.RequestHandler {
|
|
unless?: typeof unless;
|
|
}
|
|
}
|