UNPKG

@greenpress/auth

Version:

Express Passport authentication service

23 lines (22 loc) 871 B
import { Document, Model } from 'mongoose'; export interface IUser { tenant: string; email: string; password: string; name: string; salt: string; roles: string[]; tokens: any[]; } export interface UserDocument extends IUser, Document { } export interface UserModel extends Model<UserDocument> { comparePassword(password: string, callback: (err: Error, success: boolean) => void): void; getToken(authType: string, expiresIn?: string): any; getRefreshToken(relatedToken: string): any; updateToken(authType: string, currentIdentifier: string, newIdentifier: string, relatedToken?: string): Promise<UserDocument>; deleteToken(authType: string, tokenIdentifier: string): Promise<UserDocument>; getTokenByRelatedTokens(authType: string, tokenIdentifier: string): string; } declare const User: UserModel; export default User;