UNPKG

@greenpress/auth

Version:

Express Passport authentication service

19 lines (18 loc) 1.08 kB
import { UserDocument, UserModel } from '../models/user'; import { Types } from 'mongoose'; export declare function getUser(query: any): Promise<UserDocument>; export declare function updateUser(user: UserDocument | { _id: string | Types.ObjectId; tenant: string; }, { email, password, name, roles }: { email?: any; password?: any; name?: any; roles?: any; }): Promise<UserDocument | import("mongoose").UpdateWriteOpResult>; export declare function deleteUser(userId: string, tenant: string): void; export declare function comparePassword(user: UserModel, password: string): Promise<unknown>; export declare function setToken(user: UserDocument, authType: string): any; export declare function updateToken(user: UserModel, authType: string, currentToken: string, newToken: string): Promise<UserDocument>; export declare function deleteToken(tenant: string, userId: string, authType: string, token: string, isRelatedToken: boolean): Promise<boolean>; export declare function getUserIfTokenExists(tenant: string, userId: string, tokenId: string): Promise<any>;