mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-29 01:45:49 +08:00
Apply new lint rules to ever more packages (#15551)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import Hapi = require('hapi');
|
||||
import hapiAuthJwt2 = require('hapi-auth-jwt2');
|
||||
|
||||
var server = new Hapi.Server();
|
||||
const server = new Hapi.Server();
|
||||
server.connection({port: 8000});
|
||||
|
||||
interface User {
|
||||
@@ -13,7 +13,7 @@ interface Users {
|
||||
[id: number]: User;
|
||||
}
|
||||
|
||||
var users: Users = {
|
||||
const users: Users = {
|
||||
1: {
|
||||
id: 1,
|
||||
name: 'Test User'
|
||||
|
||||
98
types/hapi-auth-jwt2/index.d.ts
vendored
98
types/hapi-auth-jwt2/index.d.ts
vendored
@@ -33,93 +33,93 @@ type KeyLookupCallback = (err: any, key: string, extraInfo?: any) => void;
|
||||
type ValidateCallback = (err: any, valid: boolean, credentials?: any) => void;
|
||||
|
||||
/**
|
||||
* Options passed to `hapi.auth.strategy` when this plugin is used
|
||||
*/
|
||||
* Options passed to `hapi.auth.strategy` when this plugin is used
|
||||
*/
|
||||
export interface Options {
|
||||
/**
|
||||
* The secret key used to check the signature of the token *or* a *key lookup function*
|
||||
*/
|
||||
* The secret key used to check the signature of the token *or* a *key lookup function*
|
||||
*/
|
||||
key?: string | KeyLookup;
|
||||
|
||||
/**
|
||||
* The function which is run once the Token has been decoded
|
||||
*
|
||||
* @param decoded the *decoded* and *verified* JWT received from the client in *request.headers.authorization*
|
||||
* @param request the original *request* received from the client
|
||||
* @param callback the validation callback
|
||||
*/
|
||||
* The function which is run once the Token has been decoded
|
||||
*
|
||||
* @param decoded the *decoded* and *verified* JWT received from the client in *request.headers.authorization*
|
||||
* @param request the original *request* received from the client
|
||||
* @param callback the validation callback
|
||||
*/
|
||||
validateFunc(decoded: {}, request: Request, callback: ValidateCallback): void;
|
||||
|
||||
/**
|
||||
* Settings to define how tokens are verified by the jsonwebtoken library
|
||||
*/
|
||||
* Settings to define how tokens are verified by the jsonwebtoken library
|
||||
*/
|
||||
verifyOptions?: {
|
||||
/**
|
||||
* Ignore expired tokens
|
||||
*/
|
||||
* Ignore expired tokens
|
||||
*/
|
||||
ignoreExpiration?: boolean;
|
||||
|
||||
/**
|
||||
* Do not enforce token audience
|
||||
*/
|
||||
* Do not enforce token audience
|
||||
*/
|
||||
audience?: boolean;
|
||||
|
||||
/**
|
||||
* Do not require the issuer to be valid
|
||||
*/
|
||||
* Do not require the issuer to be valid
|
||||
*/
|
||||
issuer?: boolean;
|
||||
|
||||
/**
|
||||
* List of allowed algorithms
|
||||
*/
|
||||
* List of allowed algorithms
|
||||
*/
|
||||
algorithms?: string[];
|
||||
};
|
||||
|
||||
/**
|
||||
* function called to decorate the response with authentication headers
|
||||
* before the response headers or payload is written
|
||||
*
|
||||
* @param request the Request object
|
||||
* @param reply is called if an error occurred
|
||||
*/
|
||||
* function called to decorate the response with authentication headers
|
||||
* before the response headers or payload is written
|
||||
*
|
||||
* @param request the Request object
|
||||
* @param reply is called if an error occurred
|
||||
*/
|
||||
responseFunc?(request: Request, reply: (err: any, response: Response) => void): void;
|
||||
|
||||
/**
|
||||
* If you prefer to pass your token via url, simply add a token url
|
||||
* parameter to your request or use a custom parameter by setting `urlKey.
|
||||
* To disable the url parameter set urlKey to `false` or ''.
|
||||
* @default 'token'
|
||||
*/
|
||||
* If you prefer to pass your token via url, simply add a token url
|
||||
* parameter to your request or use a custom parameter by setting `urlKey.
|
||||
* To disable the url parameter set urlKey to `false` or ''.
|
||||
* @default 'token'
|
||||
*/
|
||||
urlKey?: string | boolean;
|
||||
|
||||
/**
|
||||
* If you prefer to set your own cookie key or your project has a cookie
|
||||
* called 'token' for another purpose, you can set a custom key for your
|
||||
* cookie by setting `options.cookieKey='yourkeyhere'`. To disable cookies
|
||||
* set cookieKey to `false` or ''.
|
||||
* @default 'token'
|
||||
*/
|
||||
* If you prefer to set your own cookie key or your project has a cookie
|
||||
* called 'token' for another purpose, you can set a custom key for your
|
||||
* cookie by setting `options.cookieKey='yourkeyhere'`. To disable cookies
|
||||
* set cookieKey to `false` or ''.
|
||||
* @default 'token'
|
||||
*/
|
||||
cookieKey?: string | boolean;
|
||||
|
||||
/**
|
||||
* If you want to set a custom key for your header token use the
|
||||
* `headerKey` option. To disable header token set headerKey to `false` or
|
||||
* ''.
|
||||
* @default 'authorization'
|
||||
*/
|
||||
* If you want to set a custom key for your header token use the
|
||||
* `headerKey` option. To disable header token set headerKey to `false` or
|
||||
* ''.
|
||||
* @default 'authorization'
|
||||
*/
|
||||
headerKey?: string | boolean;
|
||||
|
||||
/**
|
||||
* Allow custom token type, e.g. `Authorization: <tokenType> 12345678`
|
||||
*/
|
||||
* Allow custom token type, e.g. `Authorization: <tokenType> 12345678`
|
||||
*/
|
||||
tokenType?: string;
|
||||
|
||||
/**
|
||||
* Set to `true` to receive the complete token (`decoded.header`,
|
||||
* `decoded.payload` and `decoded.signature`) as decoded argument to key
|
||||
* lookup and `verifyFunc` callbacks (*not `validateFunc`*)
|
||||
* @default false
|
||||
*/
|
||||
* Set to `true` to receive the complete token (`decoded.header`,
|
||||
* `decoded.payload` and `decoded.signature`) as decoded argument to key
|
||||
* lookup and `verifyFunc` callbacks (*not `validateFunc`*)
|
||||
* @default false
|
||||
*/
|
||||
complete?: boolean;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user