import { DataSource } from 'typeorm'; import { AuthToken } from '../persistance/entity/AuthToken'; /** * AuthService performs all tasks related to User authentication */ declare class AuthService { private dataSource; private static readonly SALT_ROUNDS; private userRepo; private authTokenRepo; constructor(dataSource: DataSource); /** * Authenticate a user given the username and password. If it is a valid combination a new AuthToken will be returned and internally associated to the user * The token inside the returned AuthToken must be included in all authenticated requests for that user (as a ) * @param username The username of the user * @param password The password of the user * @returns A new AuthToken which contains the token needed for the user to make authenticated requests */ authenticate(username: string, password: string): Promise; /** * Retrieve a User's AuthToken or null if one does not exist, or the username does not exist * @param username The username of the user whose AuthToken is to be retrieved * @returns The AuthToken for the User with the matching username, or null if the username does not exist or the AuthToken is null */ getUserAuthToken(username: string): Promise; /** * Retrieve a full AuthToken based on it's 'token' field * @param token The token value of the AuthToken to be retrieved * @returns The AuthToken with the matching 'token' value, or null in none exists */ getAuthTokenByToken(token: string): Promise; /** * Determine if an AuthToken is valid or invalid based on its 'expires' field * @param authToken The AuthToken to validate * @returns If the AuthToken's 'expires' field is in the future return true, otherwise return false */ isAuthTokenValid(authToken: AuthToken): boolean; /** * Get a salted hash of a password * @param password The password to salt and hash * @returns A salted hash of the password */ private getPasswordHash; } export declare const authService: AuthService; export {};