/** Backend GitHub App helpers: installation discovery, repo creation, and
 * short-lived installation tokens. */
/** Raised when the GITHUB_APP_* environment is missing or incomplete. */
export declare class GithubAppConfigError extends Error {
    constructor(message: string);
}
/** Raised when minting an installation token fails because the app is no longer
 * installed (GitHub 401/404). */
export declare class ReinstallRequiredError extends Error {
    constructor(message: string);
}
/** Raised when repo creation fails because the name is already taken (422). */
export declare class RepoAlreadyExistsError extends Error {
    constructor(message: string);
}
export type InstallationToken = {
    token: string;
    expiresAt: string;
};
/**
 * Mint a ~1h installation access token. When `repoName` is given, the token is
 * scoped to that single repository with Contents access only. Throws
 * {@link ReinstallRequiredError} if the app has been uninstalled.
 */
export declare function mintInstallationToken(installationId: string, repoName?: string): Promise<InstallationToken>;
export type CreatedRepo = {
    fullName: string;
    url: string;
};
/** Create a blank private repo in the user's account with their access token. */
export declare function createRepo(userAccessToken: string, name: string): Promise<CreatedRepo>;
/**
 * The id of this app's installation on `repoFullName` (`owner/repo`), or null if
 * the app is not installed on that repo. Resolved from the app's own JWT, so it
 * needs no user token.
 */
export declare function findRepoInstallationId(repoFullName: string): Promise<string | null>;
/**
 * Find a repo named `name` in the authenticated user's account, returning its
 * full name and URL, or null if they have no such repo.
 */
export declare function findUserRepo(userAccessToken: string, name: string): Promise<CreatedRepo | null>;
export type DeviceFlowStart = {
    deviceCode: string;
    userCode: string;
    verificationUri: string;
    expiresIn: number;
    interval: number;
};
/**
 * Begin GitHub App device authorization (`POST /login/device/code`); returns the
 * `user_code`, verification URL, and `device_code`.
 */
export declare function startDeviceFlow(): Promise<DeviceFlowStart>;
/** The outcome of exchanging a device_code (`POST /login/oauth/access_token`). */
export type DeviceFlowExchange = {
    status: "authorized";
    accessToken: string;
} | {
    status: "pending";
} | {
    status: "slowDown";
} | {
    status: "expired";
} | {
    status: "denied";
};
/**
 * Exchange a device_code for a user access token, mapping GitHub's polling
 * responses to a discriminated status.
 */
export declare function exchangeDeviceCode(deviceCode: string): Promise<DeviceFlowExchange>;
//# sourceMappingURL=github-app.d.ts.map