import { type GatewayScope } from "./scoped-gateway.js";
export declare const PAIR_PORT = 47291;
export declare function newPairingCode(): string;
/** Codes are typed as ABC-234 or abc234; both mean the same code. */
export declare function normalizeCode(code: string): string;
export declare function pairingProof(code: string, label: "phone" | "computer", ...parts: string[]): string;
/**
 * The secret only the QR code and the phren://pair link carry: 128 random
 * bits, never typed and never sent. The six-character code can be recovered
 * from one captured request (about 30 bits, checked offline against its
 * proof), so a proof made with the code alone always needs the person at the
 * computer; a proof made with this secret shows the phone read the screen.
 */
export declare function newScanSecret(): string;
/** The proof of a phone that scanned: keyed by the code and the scan secret together. */
export declare function scanProof(code: string, secret: string, label: "phone" | "computer", ...parts: string[]): string;
/**
 * The short check a phone that typed the code shows to confirm: the first
 * eight characters of the host key fingerprint, as "abcd efgh". A typed code
 * alone could be guessed by someone on the network during pairing; matching
 * this shows the phone reached this computer. Same as the app's `checkCode`.
 */
export declare function pairingCheckCode(fingerprint: string | undefined | null): string | null;
/** OpenSSH's SHA256 fingerprint of a public key line, as the phone computes it. */
export declare function keyFingerprint(publicKeyLine: string): string | undefined;
export declare function hostFingerprint(file?: string): Promise<string | undefined>;
/** Addresses the phone can try, best first: Tailscale name and address, then LAN IPv4. */
export declare function pairingHosts(): Promise<string[]>;
/** The name people call this computer: macOS's Computer Name, else the host name. */
export declare function computerDisplayName(): Promise<string>;
export interface PairingOffer {
    hosts: string[];
    port: number;
    user: string;
    sshPort: number;
    fingerprint?: string;
    code: string;
    name: string;
    /** The scan secret (`k`); see `newScanSecret`. */
    secret?: string;
}
/** The QR payload; the phone opens phren://pair links from the camera too. */
export declare function pairingURL(offer: PairingOffer): string;
export interface Paired {
    device: "ios" | "android";
    name?: string;
    publicKey: string;
}
export interface PairingSession {
    port: number;
    done: Promise<Paired>;
    close(): void;
}
/** A phone that typed the code, waiting for the person at the computer to allow it. */
export interface PairingApproval {
    device: "ios" | "android";
    name?: string;
    check: string | null;
}
/** Listen for one phone. Resolves once its key is authorized; rejects on timeout. */
export declare function startPairing(options: {
    code: string;
    user: string;
    sshPort: number;
    fingerprint?: string;
    name: string;
    port?: number;
    timeoutMs?: number;
    sshDirectory?: string;
    /** The secret in the QR code. A phone that proves it is authorized at once; without one, no phone is. */
    scanSecret?: string;
    /**
     * Asked before a phone that proved only the code is authorized: the code
     * can be cracked from a captured request, so the person at the computer
     * allows the phone whose key check matches the one it shows. Without it,
     * typed pairing is refused.
     */
    approve?: (phone: PairingApproval) => Promise<boolean>;
    /** Called once, when wrong codes have turned typed pairing off for this session. */
    onTypedOff?: () => void;
}): Promise<PairingSession>;
export declare const PAIR_USAGE = "phren pair [--minutes <1-30>] [--port <n>] [--no-install] | phren pair --scope gitboy-read|gitboy-write|gitboy-ci --key <public-key-file|-> [--no-install]";
/** The authorized_keys line for a scoped key: no PTY, no forwarding, its own forced command. */
export declare function scopedKeyLine(scope: GatewayScope, publicKey: string): string;
/** Authorize a server's key for one scope. Options on the supplied line are discarded and rebuilt. */
export declare function acceptScopedKey(scope: GatewayScope, input: string, sshDirectory?: string): Promise<string>;
/** A name safe to print in a terminal: control and format characters dropped, at most 80 characters. */
export declare function printableName(name: string): string;
export declare function runPair(args: string[], version: string): Promise<number>;
