/** RFC 8628 §3.4 — the fallback when the server names no interval. */ export declare const DEFAULT_POLL_INTERVAL_SECONDS = 5; /** RFC 8628 §3.5 — what a bare `slow_down` costs, when it carries no interval. */ export declare const SLOW_DOWN_INCREMENT_SECONDS = 5; /** RFC 8628 §3.4 — the grant this flow redeems with. */ export declare const GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code"; /** As the control plane knows this client. Stays "djc": the server half pins * the id, and the wire is not where a deprecation is spelled. */ export declare const CLIENT_ID = "djc"; /** A failure a person can act on, with no stack behind it. */ export declare class DeviceFlowError extends Error { code: string; constructor(code: string, message: string); } export interface DeviceAuthorization { device_code: string; user_code: string; verification_uri?: string; verification_uri_complete?: string; interval?: number; expires_in?: number; } /** POST /api/auth/device/code — the authorization request (RFC 8628 §3.1/§3.2). */ export declare function requestDeviceCode(origin: string, { clientId }?: { clientId?: string; }): Promise; /** * Poll /api/auth/device/token until the person approves, or the flow dies. * * The rules, in the order they matter: never faster than the server's * `interval` (the first poll waits too); `authorization_pending` is the normal * case and is silent; `slow_down` ADOPTS the interval the error carries, else * adds five seconds; the terminal errors stop the loop at once, storing nothing. */ export declare function pollForToken(origin: string, authorization: DeviceAuthorization, { sleep, now, clientId, onWait }?: { sleep?: (ms: number) => Promise; now?: () => number; clientId?: string; onWait?: (interval: number) => void; }): Promise;