///
import type { Secret, SignOptions } from 'jsonwebtoken';
import { FindOneOptions, Repository, UpdateResult } from 'typeorm';
import type { AuthUser, AuthUserChannel, AuthUserType } from './base.entities';
import type { JwtPayload } from './auth.interfaces';
import type { PrimaryKey } from '../../common';
import type { Constructor } from '../../base';
import type { CreatedUser } from './auth.service';
export declare class PasswordHelper {
private static readonly cryptor;
static encrypt(password: string): {
hash: string;
salt: string;
};
static passwordVerify(password: string, user: AuthUser): boolean;
}
export interface CreatedToken {
expiresIn: number;
accessToken: string;
}
export declare class TokenHelper {
static decode(token: string): Payload;
static createToken(user: AuthUser, extra?: {
uid?: string;
}): Promise;
static createCustomToken(payload: string | Buffer | object, secretOrPrivateKey: Secret, options?: SignOptions): string;
}
export declare abstract class AbstractAuthService {
readonly AuthUserEntity: Constructor & AuthUserType;
readonly authUserRepository: Repository;
protected constructor(AuthUserEntity: Constructor & AuthUserType, authUserRepository: Repository);
abstract createUser(username: string, email: string, password: string, channel?: AuthUserChannel, roleNames?: string[]): Promise>;
validateUser(payload: JwtPayload): Promise;
createToken(authUser: U, extra?: {
uid: string;
}): Promise;
updateLastLoginDate(uid: PrimaryKey): Promise<{
sameDay?: boolean;
lastLoginAt?: Date;
}>;
getUser(identifier: {
email?: string;
username?: string;
}, isActive?: boolean, options?: FindOneOptions): Promise;
getUserWithPassword(identifier: {
email?: string;
username?: string;
}, isActive?: boolean): Promise;
updatePassword(uid: PrimaryKey, password: string, salt: string): Promise;
updateAccount(uid: PrimaryKey, { username, email }: {
username: string;
email?: string;
}): Promise;
}