UNPKG

@brontosaurus/db

Version:
33 lines (32 loc) 1.78 kB
import { Basics } from "@brontosaurus/definition"; import { ObjectID } from "bson"; import { Document, Model } from "mongoose"; import { IAccount, PreviousPassword, PreviousPasswordReason } from "../interface/account"; export interface IAccountModel extends IAccount, Document { resetAttempt(amount?: number): IAccountModel; useAttemptPoint(point: number): IAccountModel; addAttemptPoint(point: number): IAccountModel; generateAndSetTwoFA(systemName?: string): string; verifyTwoFA(code: string): boolean; getInfoRecords(): Record<string, Basics>; getBeaconRecords(): Record<string, Basics>; addGroup(id: ObjectID): IAccountModel; removeGroup(id: ObjectID): IAccountModel; setPassword(password: string, reason: PreviousPasswordReason): IAccountModel; addPreviousPassword(password: string, reason: PreviousPasswordReason): IAccountModel; setTempPassword(length?: number): IAccountModel; resetMint(): IAccountModel; generateApplicationPassword(by: ObjectID, expireAt: Date, tails?: number): string; suspendApplicationPassword(id: string, by: ObjectID): boolean; generateTemporaryPassword(by: ObjectID, expireAt: Date, tails?: number): string; suspendTemporaryPassword(id: string, by: ObjectID): boolean; generateResetToken(expireAt: Date): string; verifyPassword(password: string): boolean; verifyPreviousPassword(password: string): PreviousPassword | null; verifyTemporaryPassword(password: string): boolean; verifyApplicationPassword(password: string): boolean; verifySpecialPasswords(password: string): boolean; verifyResetToken(password: string): boolean; clearResetTokens(): IAccountModel; } export declare const AccountModel: Model<IAccountModel>;