import IConfig from './IConfig';
import IObject from './IObject';
import ITokenResponse from './ITokenResponse';
import ICorsOptions from './ICorsOptions';
export default class PKCE {
    private readonly STATE_KEY;
    private readonly CODE_VERIFIER_KEY;
    private config;
    private corsRequestOptions;
    /**
     * Initialize the instance with configuration
     * @param {IConfig} config
     */
    constructor(config: IConfig);
    /**
     * Generate the authorize url
     * @param  {object} additionalParams include additional parameters in the query
     * @return Promise<string>
     */
    authorizeUrl(additionalParams?: IObject): string;
    /**
     * Allow the user to enable cross domain cors requests
     * @param  enable turn the cross domain request options on.
     * @return ICorsOptions
     */
    enableCorsCredentials(enable: boolean): ICorsOptions;
    /**
     * Given the return url, get a token from the oauth server
     * @param  url current urlwith params from server
     * @param  {object} additionalParams include additional parameters in the request body
     * @return {Promise<ITokenResponse>}
     */
    exchangeForAccessToken(url: string, additionalParams?: IObject): Promise<ITokenResponse>;
    /**
     * Get the current codeVerifier
     * @return {string}
     */
    getCodeVerifier(): string;
    /**
     * Get the current state
     * @return {string}
     */
    getState(): string;
    /**
     * Given a refresh token, return a new token from the oauth server
     * @param  refreshTokens current refresh token from server
     * @return {Promise<ITokenResponse>}
     */
    refreshAccessToken(refreshToken: string): Promise<ITokenResponse>;
    /**
     * Revoke an existing token.
     * Optionally send a token_type_hint as second parameter
     * @param {string} tokenToExpire the token to be expired
     * @param {string} hint when not empty, token_type_hint will be sent with request
     * @returns
     */
    revokeToken(tokenToExpire: string, hint?: string): Promise<boolean>;
    /**
     * Check if an endpoint from configuration is set and using https protocol
     * Allow http on localhost
     * @param {string} propertyName the key of the item in configuration to check
     */
    private checkEndpoint;
    /**
     * Generate a random string
     * @return {string}
     */
    private generateRandomString;
    /**
     * Get the query params as json from a auth response url
     * @param  {string} url a url expected to have AuthResponse params
     * @return {Promise<IAuthResponse>}
     */
    private parseAuthResponseUrl;
    /**
     * Generate a code challenge
     * @return {Promise<string>}
     */
    private pkceChallengeFromVerifier;
    /**
     * Set the code verifier in storage to a random string
     * @return {void}
     */
    private setCodeVerifier;
    /**
     * Set the state in storage to a random string.
     * Optionally set an explicit state
     * @param {string | null} explicit when set, we will use this value for the state value
     * @return {void}
     */
    private setState;
    /**
     * Validates params from auth response
     * @param  {AuthResponse} queryParams
     * @return {Promise<IAuthResponse>}
     */
    private validateAuthResponse;
    /**
     * Get the instance of Storage interface to use.
     * Defaults to sessionStorage.
     * @return {Storage}
     */
    private getStore;
}
