import { AsyncCreatable } from '@salesforce/kit';
import { OAuth2Options } from 'jsforce';
import { Nullable, JsonMap } from '@salesforce/ts-types';
import { AuthInfo } from './org/authInfo';
export interface DeviceCodeResponse extends JsonMap {
    device_code: string;
    interval: number;
    user_code: string;
    verification_uri: string;
}
export interface DeviceCodePollingResponse extends JsonMap {
    access_token: string;
    refresh_token: string;
    signature: string;
    scope: string;
    instance_url: string;
    id: string;
    token_type: string;
    issued_at: string;
}
/**
 * Handles device based login flows
 *
 * Usage:
 * ```
 * const oauthConfig = {
 *   loginUrl: this.flags.instanceurl,
 *   clientId: this.flags.clientid,
 * };
 * const deviceOauthService = await DeviceOauthService.create(oauthConfig);
 * const loginData = await deviceOauthService.requestDeviceLogin();
 * console.log(loginData);
 * const approval = await deviceOauthService.awaitDeviceApproval(loginData);
 * const authInfo = await deviceOauthService.authorizeAndSave(approval);
 * ```
 */
export declare class DeviceOauthService extends AsyncCreatable<OAuth2Options> {
    static RESPONSE_TYPE: string;
    static GRANT_TYPE: string;
    static SCOPE: string;
    private static POLLING_COUNT_MAX;
    private logger;
    private options;
    private pollingCount;
    constructor(options: OAuth2Options);
    /**
     * Begin the authorization flow by requesting the login
     *
     * @returns {Promise<DeviceCodeResponse>}
     */
    requestDeviceLogin(): Promise<DeviceCodeResponse>;
    /**
     * Polls the server until successful response OR max attempts have been made
     *
     * @returns {Promise<Nullable<DeviceCodePollingResponse>>}
     */
    awaitDeviceApproval(loginData: DeviceCodeResponse): Promise<Nullable<DeviceCodePollingResponse>>;
    /**
     * Creates and saves new AuthInfo
     *
     * @returns {Promise<AuthInfo>}
     */
    authorizeAndSave(approval: DeviceCodePollingResponse): Promise<AuthInfo>;
    protected init(): Promise<void>;
    private getLoginOptions;
    private getPollingOptions;
    private getDeviceFlowRequestUrl;
    private poll;
    private shouldContinuePolling;
    private pollForDeviceApproval;
}
