import {Request, Response} from "express"; import {Session} from "express-session"; import AuthProof from "./AuthProof.js"; import User from "./models/User.js"; export default interface AuthMethod

> { /** * @return A unique name. */ getName(): string; /** * Used for automatic auth method detection. Won't affect forced auth method. * * @return {@code 0} if the request is not conform to this auth method, otherwise the exact count of matching * fields. */ getWeightForRequest(req: Request): number; findUserByIdentifier(identifier: string): Promise; getProofsForSession?(session: Session): Promise; getProofsForRequest?(req: Request): Promise; /** * @return {@code true} if interrupted, {@code false} otherwise. */ interruptAuth?(req: Request, res: Response): Promise; attemptLogin(req: Request, res: Response, user: User): Promise; attemptRegister(req: Request, res: Response, identifier: string): Promise; }