mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-21 13:27:15 +08:00
Change secretOrKey to union type of string or Buffer, and add relevant test.
This commit is contained in:
3
types/passport-jwt/index.d.ts
vendored
3
types/passport-jwt/index.d.ts
vendored
@@ -1,6 +1,7 @@
|
||||
// Type definitions for passport-jwt 2.0
|
||||
// Project: https://github.com/themikenicholson/passport-jwt
|
||||
// Definitions by: TANAKA Koichi <https://github.com/mugeso/>
|
||||
// Alex Young <https://github.com/alsiola/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import {Strategy as PassportStrategy} from 'passport-strategy';
|
||||
@@ -12,7 +13,7 @@ export declare class Strategy extends PassportStrategy {
|
||||
}
|
||||
|
||||
export interface StrategyOptions {
|
||||
secretOrKey: string;
|
||||
secretOrKey: string | Buffer;
|
||||
jwtFromRequest: JwtFromRequestFunction;
|
||||
issuer?: string;
|
||||
audience?: string;
|
||||
|
||||
@@ -33,5 +33,6 @@ opts.jwtFromRequest = ExtractJwt.fromUrlQueryParameter('param_name');
|
||||
opts.jwtFromRequest = ExtractJwt.fromAuthHeaderWithScheme('param_name');
|
||||
opts.jwtFromRequest = ExtractJwt.fromExtractors([ExtractJwt.fromHeader('x-api-key'), ExtractJwt.fromBodyField('field_name'), ExtractJwt.fromUrlQueryParameter('param_name')]);
|
||||
opts.jwtFromRequest = (req: Request) => { return req.query.token; };
|
||||
opts.secretOrKey = new Buffer('secret');
|
||||
|
||||
declare function findUser(condition: {id: string}, callback: (error: any, user :any) => void): void;
|
||||
|
||||
Reference in New Issue
Block a user