diff --git a/types/passport-local-mongoose/index.d.ts b/types/passport-local-mongoose/index.d.ts index 512b68179f..e175dc8d1e 100644 --- a/types/passport-local-mongoose/index.d.ts +++ b/types/passport-local-mongoose/index.d.ts @@ -10,18 +10,33 @@ declare module 'mongoose' { import passportLocal = require('passport-local'); + export interface AuthenticationResult { + user: any; + error: any; + } + // methods export interface PassportLocalDocument extends Document { + setPassword(password: string): Promise; setPassword(password: string, cb: (err: any, res: any) => void): void; - authenticate(password: string, cb: (err: any, res: any, error: any) => void): void; + changePassword(oldPassword: string, newPassword: string): Promise; + changePassword(oldPassword: string, newPassword: string, cb: (err: any, res: any) => void): void; + authenticate(password: string): Promise; + authenticate(password: string, cb: (err: any, user: any, error: any) => void): void; + resetAttempts(): Promise; + resetAttempts(cb: (err: any, res: any) => void): void; } // statics interface PassportLocalModel extends Model { - authenticate(): (username: string, password: string, cb: (err: any, res: T, error: any) => void) => void; + authenticate(): (username: string, password: string) => Promise; + authenticate(): (username: string, password: string, cb: (err: any, user: T | boolean, error: any) => void) => void; serializeUser(): (user: PassportLocalModel, cb: (err: any, id?: any) => void) => void; deserializeUser(): (username: string, cb: (err: any, user?: any) => void) => void; + + register(user: T, password: string): Promise; register(user: T, password: string, cb: (err: any, account: any) => void): void; + findByUsername(username: string, selectHashSaltFields: boolean): Query; findByUsername(username: string, selectHashSaltFields: boolean, cb: (err: any, account: any) => void): any; createStrategy(): passportLocal.Strategy; }