import type { Hash, HashManager } from '@adonisjs/core/hash'; import { type BaseModel } from '@adonisjs/lucid/orm'; import type { NormalizeConstructor } from '@adonisjs/core/types/helpers'; type UserWithUserFinderRow = { verifyPassword(plainPassword: string): Promise; validatePassword(plainPassword: string, passwordFieldName?: string): Promise; }; type UserWithUserFinderClass = NormalizeConstructor> = Model & { hashPassword(this: T, user: InstanceType): Promise; findForAuth(this: T, uids: string[], value: string): Promise | null>; verifyCredentials(this: T, uid: string, password: string): Promise>; new (...args: any[]): UserWithUserFinderRow; }; /** * Mixing to add user lookup and password verification methods * on a model. * * Under the hood, this mixin defines following methods and hooks * * - beforeSave hook to hash user password * - findForAuth method to find a user during authentication * - verifyCredentials method to verify user credentials and prevent * timing attacks. * * @param hash - Function that returns a Hash instance for password hashing * @param options - Configuration options with uids and password column name * * @example * import { withAuthFinder } from '@adonisjs/auth/mixins/lucid' * * class User extends withAuthFinder(hash, { * uids: ['email', 'username'], * passwordColumnName: 'password' * })(BaseModel) { * // User model implementation * } */ export declare function withAuthFinder(hash: (() => Hash) | HashManager, options?: { uids?: string[]; passwordColumnName?: string; }): >(superclass: Model) => UserWithUserFinderClass; export {};