import { PathEventEmitter } from './core';
import { Momentum } from './momentum';
import { Totp, TotpMethods } from './totp';
import { User } from './users';
export type SessionData = {
    /** User token */
    token: string | null;
    /** Current user */
    user: User | null;
    /** Combined custom values */
    custom: any;
    /** UI dashboard page */
    dashboardUrl: string | null;
    /** Redirect user to URL on login */
    loginRedirect: string | null;
    /** Combined permissions */
    permissions: string[];
};
/** Manage User Authentication */
export declare class Auth extends PathEventEmitter {
    protected momentum: Momentum;
    /** Manage user 2FA */
    totp: Totp;
    session?: SessionData | null;
    private _user?;
    /** Get current user, undefined if not yet initialized */
    get user(): User | null | undefined;
    /** Update user info without changing the session */
    set user(user: User | null | undefined);
    constructor(momentum: Momentum);
    handleLogin(reload?: boolean): Promise<SessionData | null | undefined>;
    /**
     * Check if origin is recognized & whitelisted
     * @param {string} host Origin to check
     * @return {Promise<void>} Resolves in known, 401 code otherwise
     */
    knownHost(host?: string): Promise<void>;
    /**
     * Login a user & return the account
     * @param {string} id username
     * @param {string} password user's password
     * @param {{totp: string, totpMethod: TotpMethods, expire: null | number | Date}} opts 2FA code, 2FA code push method, and expiry options (null to never expire)
     * @return {Promise<{reset?: string, token?: string} | null>} User account on success
     */
    login(id: string, password?: string, opts?: {
        totp?: string;
        totpMethod?: TotpMethods;
        expire?: number | Date | null;
    }): Promise<{
        reset?: string;
        token?: string;
    } | null>;
    /**
     * Login via Momentum single sign on
     * @param {string} host Host origin attempting to login
     * @return {Promise<string>} Token on success
     */
    loginRedirect(host?: string): Promise<string>;
    /**
     * Logout current user
     */
    logout(): Promise<void>;
    /**
     * Create a new user with login
     * @param {Partial<User> & {password: string}} user User data with password
     * @return {Promise<User>} Registered user data
     */
    register(user: Partial<User> & {
        _id: string;
        password: string;
    }): Promise<User>;
    /**
     * Finish user account reset
     * @param password New password
     * @param token Reset token
     * @return {Promise<void>} Resolves once complete
     */
    reset(password: string, token?: string): Promise<void>;
    /**
     * Initiate user account reset
     * @param email New password
     * @return {Promise<void>} Resolves once complete
     */
    reset(email: string): Promise<void>;
    /**
     * Get session information
     * @param {string} token Token to fetch session info for
     * @param {boolean} set Set as current active session
     * @return {Promise<{token: string, user: User, permissions: string[], custom: any} | null>} Session information
     */
    readSession(token?: string | null, set?: boolean): Promise<SessionData | null>;
    /** Unlock an account that has been locked from too many login attempts */
    unlock(username: string): Promise<any>;
    /**
     * Update password for user
     * @param {string} username User to reset
     * @param {string} password New user password
     * @param {string} oldPassword Old password for validation
     * @return {Promise<void>} Resolves once complete
     */
    updatePassword(username: string, password: string, oldPassword?: string): Promise<void>;
}
//# sourceMappingURL=auth.d.ts.map