UNPKG

2.08 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/passport-local`
3
4# Summary
5This package contains type definitions for passport-local (https://github.com/jaredhanson/passport-local).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/passport-local.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/passport-local/index.d.ts)
10````ts
11/// <reference types="passport"/>
12
13import { Strategy as PassportStrategy } from "passport-strategy";
14import express = require("express");
15
16interface IStrategyOptions {
17 usernameField?: string | undefined;
18 passwordField?: string | undefined;
19 session?: boolean | undefined;
20 passReqToCallback?: false | undefined;
21}
22
23interface IStrategyOptionsWithRequest {
24 usernameField?: string | undefined;
25 passwordField?: string | undefined;
26 session?: boolean | undefined;
27 passReqToCallback: true;
28}
29
30interface IVerifyOptions {
31 message: string;
32}
33
34interface VerifyFunctionWithRequest {
35 (
36 req: express.Request,
37 username: string,
38 password: string,
39 done: (error: any, user?: Express.User | false, options?: IVerifyOptions) => void,
40 ): void;
41}
42
43interface VerifyFunction {
44 (
45 username: string,
46 password: string,
47 done: (error: any, user?: Express.User | false, options?: IVerifyOptions) => void,
48 ): void;
49}
50
51declare class Strategy extends PassportStrategy {
52 constructor(options: IStrategyOptionsWithRequest, verify: VerifyFunctionWithRequest);
53 constructor(options: IStrategyOptions, verify: VerifyFunction);
54 constructor(verify: VerifyFunction);
55
56 name: string;
57}
58
59````
60
61### Additional Details
62 * Last updated: Tue, 07 Nov 2023 09:09:39 GMT
63 * Dependencies: [@types/express](https://npmjs.com/package/@types/express), [@types/passport](https://npmjs.com/package/@types/passport), [@types/passport-strategy](https://npmjs.com/package/@types/passport-strategy)
64
65# Credits
66These definitions were written by [Maxime LUCE](https://github.com/SomaticIT).
67
\No newline at end of file