/**
 * @module invite-client
 * Fast onboarding client for Xchange connections.
 *
 * Enables one-click invites for Xchange key transport:
 * - Generate: Create invite code
 * - Accept: Click link or accept via code
 *
 * The viral loop:
 * 1. Service A invites Service B
 * 2. Service B accepts via XCHANGE_INVITE_CODE env var
 * 3. Connection established (Xchange key transport enabled)
 * 4. Service B invites Service C
 */
import { Result } from '@private.me/shared';
/**
 * Service info for Xchange connections.
 */
export interface XchangeServiceInfo {
    /** Service name */
    name: string;
    /** Service DID */
    did: string;
    /** Service endpoint */
    endpoint: string;
    /** Ed25519 public key (base64) */
    publicKey: string;
    /** Optional X25519 public key for hybrid KEM */
    x25519PublicKey?: string;
    /** Optional ML-KEM public key */
    mlKemPublicKey?: string;
}
/**
 * Invite data structure for Xchange.
 */
export interface XchangeInvite {
    /** Unique invite ID */
    id: string;
    /** Service that sent the invite */
    from: XchangeServiceInfo;
    /** Target service (optional, can be open invite) */
    to?: {
        name?: string;
        email?: string;
    };
    /** Suggested permissions/template */
    template?: string;
    /** Custom permissions */
    permissions?: string[];
    /** Invite expiration (ISO timestamp) */
    expires: string;
    /** Invite URL */
    url: string;
    /** QR code data URL (for airgapped) */
    qr?: string;
}
/**
 * Invite error codes.
 */
export declare enum XchangeInviteErrorCode {
    INVALID_INVITE = "XCHANGE_INVITE_INVALID",
    EXPIRED_INVITE = "XCHANGE_INVITE_EXPIRED",
    INVITE_NOT_FOUND = "XCHANGE_INVITE_NOT_FOUND",
    NETWORK_ERROR = "XCHANGE_INVITE_NETWORK_ERROR",
    ALREADY_CONNECTED = "XCHANGE_INVITE_ALREADY_CONNECTED"
}
/**
 * Invite error.
 */
export interface XchangeInviteError {
    code: XchangeInviteErrorCode;
    message: string;
    hint?: string;
}
/**
 * Invite service for creating and accepting Xchange invites.
 */
export declare class XchangeInviteService {
    private inviteApiUrl;
    /**
     * Create invite service.
     *
     * @param options - Configuration
     * @param options.inviteApiUrl - Invite API URL (default: https://xchange.private.me)
     */
    constructor(options?: {
        inviteApiUrl?: string;
    });
    /**
     * Create an invite.
     *
     * @param options - Invite options
     * @param options.from - Sender service info
     * @param options.target - Target service (optional)
     * @param options.template - Suggested template (e.g., "fast-encryption")
     * @param options.permissions - Custom permissions
     * @param options.expiresIn - Expiration in seconds (default: 7 days)
     * @returns Invite or error
     *
     * @example
     * ```ts
     * const inviteService = new XchangeInviteService();
     * const invite = await inviteService.create({
     *   from: {
     *     name: 'billing-service',
     *     did: 'did:key:z6Mk...',
     *     endpoint: 'https://billing.example.com',
     *     publicKey: '...',
     *   },
     *   target: {
     *     name: 'payments-service',
     *   },
     *   template: 'fast-encryption',
     * });
     *
     * // Share invite.value.url or invite.value.qr
     * ```
     */
    create(options: {
        from: XchangeServiceInfo;
        target?: {
            name?: string;
            email?: string;
        };
        template?: string;
        permissions?: string[];
        expiresIn?: number;
    }): Promise<Result<XchangeInvite, XchangeInviteError>>;
    /**
     * Accept an invite.
     *
     * @param inviteUrl - Invite URL (e.g., https://xchange.private.me/invite/abc123)
     * @param acceptor - Acceptor service info
     * @returns Connection info or error
     *
     * @example
     * ```ts
     * const inviteService = new XchangeInviteService();
     * const result = await inviteService.accept(
     *   'https://xchange.private.me/invite/abc123',
     *   {
     *     name: 'payments-service',
     *     did: 'did:key:z6Mk...',
     *     endpoint: 'https://payments.example.com',
     *     publicKey: '...',
     *   }
     * );
     *
     * if (result.ok) {
     *   console.log('Connected to:', result.value.from.name);
     * }
     * ```
     */
    accept(inviteUrl: string, acceptor: XchangeServiceInfo): Promise<Result<{
        from: XchangeServiceInfo;
        invite: XchangeInvite;
    }, XchangeInviteError>>;
    /**
     * Get invite details without accepting.
     *
     * @param inviteUrl - Invite URL
     * @returns Invite details or error
     */
    get(inviteUrl: string): Promise<Result<XchangeInvite, XchangeInviteError>>;
    /**
     * Extract invite ID from URL.
     *
     * @param url - Invite URL
     * @returns Invite ID or null
     *
     * @example
     * ```ts
     * extractInviteId('https://xchange.private.me/invite/abc123') // 'abc123'
     * extractInviteId('https://xchange.private.me/billing/invite/xyz') // 'xyz'
     * ```
     */
    private extractInviteId;
}
