import { OAuth2Client } from '../client';
import { OAuth2Token } from '../token';
type GetAuthorizeUrlParams = {
    /**
     * Where to redirect the user back to after authentication.
     */
    redirectUri: string;
    /**
     * The 'state' is a string that can be sent to the authentication server,
     * and back to the redirectUri.
     */
    state?: string;
    /**
     * Code verifier for PKCE support. If you used this in the redirect
     * to the authorization endpoint, you also need to use this again
     * when getting the access_token on the token endpoint.
     */
    codeVerifier?: string;
    /**
     * List of scopes.
     */
    scope?: string[];
};
type ValidateResponseResult = {
    /**
     * The authorization code. This code should be used to obtain an access token.
     */
    code: string;
    /**
     * List of scopes that the client requested.
     */
    scope?: string[];
};
export declare class OAuth2AuthorizationCodeClient {
    client: OAuth2Client;
    constructor(client: OAuth2Client);
    /**
     * Returns the URi that the user should open in a browser to initiate the
     * authorization_code flow.
     */
    getAuthorizeUri(params: GetAuthorizeUrlParams): Promise<string>;
    getTokenFromCodeRedirect(url: string | URL, params: {
        redirectUri: string;
        state?: string;
        codeVerifier?: string;
    }): Promise<OAuth2Token>;
    /**
     * After the user redirected back from the authorization endpoint, the
     * url will contain a 'code' and other information.
     *
     * This function takes the url and validate the response. If the user
     * redirected back with an error, an error will be thrown.
     */
    validateResponse(url: string | URL, params: {
        state?: string;
    }): Promise<ValidateResponseResult>;
    /**
     * Receives an OAuth2 token using 'authorization_code' grant
     */
    getToken(params: {
        code: string;
        redirectUri: string;
        codeVerifier?: string;
    }): Promise<OAuth2Token>;
}
export declare function generateCodeVerifier(): Promise<string>;
export declare function getCodeChallenge(codeVerifier: string): Promise<['plain' | 'S256', string]>;
export {};
