import EventEmitter from 'eventemitter3';
import { AccessTokenProvider, TokenProviderEvents } from './access-token-provider.interface';
import { PasswordGrant } from './password-grant.interface';
/**
 * The interval is used to send the requests to the platform to refresh an access token
 * if first attempt to refresh was failed with the timeout error
 * Seconds.
 */
export declare const RETRY_REFRESH_TIMEOUT = 30;
export declare const DEFAULT_TOKEN_EXPIRY_TIME_SEC: number;
/**
 * If 'expiresIn' time is equal to 300 seconds
 * This interval reduce that time, e.g. 300-5=295 sec
 *
 * This parameter is introduced to start reconnection process a bit earlier then token becomes invalid
 *
 * Seconds
 */
export declare const TOKEN_REDUCING_VALIDITY_TIME = 5;
/**
 * Class is responsible for retrieving an access token and managing token refreshing
 * To start the process of token receiving/refreshing you should call login() method first and wait until promise will be resolved
 * If login is successful - the loop to refresh the token with half of 'expiresIn' interval will be started
 * To get an access token you can use getToken() method after login promise is resolved
 *
 * Events:
 * TokenProviderEvent.AuthenticationSucceeded - the token is received successfully. Token is available in the callback
 * TokenProviderEvent.AuthenticationFailed - request to get the token is failed.
 * TokenProviderEvent.RefreshSucceeded - the token is refreshed successfully. Token is available in the callback
 * TokenProviderEvent.RefreshFailed - error during the token refreshing.
 * TokenProviderEvent.TokenExpired - Access token has been expired due to 'expiresIn' timeout.
 */
export declare class AccessTokenProviderImpl extends EventEmitter<TokenProviderEvents> implements AccessTokenProvider {
    private appKey;
    private getAuthUrl;
    private oAuthGrantType;
    private httpClient;
    private refreshTimeoutId?;
    private expireTimeoutId?;
    private platformAuthParams?;
    private limit;
    private log;
    private isStopped;
    /**
     *
     * @param appKey Your application key
     * @param url The url to get an access token e.g. 'https://api.refinitiv.com/auth/oauth2/v1/token'
     * @param oAuthGrantType Optional parameters to provide OAuth grant options
     */
    constructor(appKey: string, getAuthUrl: () => string, oAuthGrantType: PasswordGrant, httpClient?: import("..").HttpClient);
    /**
     * This method makes request to get an access token
     * Once promise is resolved that means the access token is received successfully and it is available using getToken() method
     * @returns Promise<void>.
     */
    login(): Promise<void>;
    emit<T extends EventEmitter.EventNames<TokenProviderEvents>>(event: T, ...args: EventEmitter.EventArgs<TokenProviderEvents, T>): boolean;
    /**
     * Use to get the access token
     *
     * @returns The access token if .login() promise has already been resolved.
     * If .login() promise is not resolved yet - throws an error
     */
    getToken(): string;
    /**
     * Clear the timeout interval which is used to refresh the access token
     */
    stopRefresh(): void;
    private processRefreshRequest;
    private executeAuthenticationWithSafeGuard;
    private getValidExpiresIn;
    private autoReconnectEnabled;
    private reLogin;
    /**
     * Run two timers
     * 1. Expire timer: to emit the error if the access token was not refreshed during the 'expiresIn' interval
     * 2. Refresh token timer: to send the request to refresh the access token
     * @param expireTime Seconds
     */
    private runTimers;
    private clearAllTimers;
    private startRefreshTimer;
    private startExpireTimer;
    private onRetryLoginFailed;
    private clearRefreshTimeout;
    private clearExpiresTimeout;
    private stopWithError;
}
