/**
 * @module invite
 * Viral invite system for XBind connections.
 *
 * Enables one-click invites:
 * - Generate: `xbind invite payments-service`
 * - Accept: Click link or `xbind accept https://xbind.to/invite/abc123`
 *
 * The viral loop:
 * 1. Service A invites Service B
 * 2. Service B clicks link (< 60 sec setup)
 * 3. Connection established
 * 4. Service B invites Service C
 */
import { Result } from '@private.me/shared';
import type { ServiceInfo } from './discovery.js';
/**
 * Invite data structure.
 */
export interface Invite {
    /** Unique invite ID */
    id: string;
    /** Service that sent the invite */
    from: {
        name: string;
        did: string;
        endpoint: string;
        publicKey: string;
        x25519PublicKey?: string;
        mlKemPublicKey?: string;
    };
    /** 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 InviteErrorCode {
    INVALID_INVITE = "INVITE_INVALID",
    EXPIRED_INVITE = "INVITE_EXPIRED",
    INVITE_NOT_FOUND = "INVITE_NOT_FOUND",
    NETWORK_ERROR = "INVITE_NETWORK_ERROR",
    ALREADY_CONNECTED = "INVITE_ALREADY_CONNECTED"
}
/**
 * Invite error.
 */
export interface InviteError {
    code: InviteErrorCode;
    message: string;
    hint?: string;
}
/**
 * Invite service for creating and accepting invites.
 */
export declare class InviteService {
    private inviteApiUrl;
    /**
     * Create invite service.
     *
     * @param options - Configuration
     * @param options.inviteApiUrl - Invite API URL (default: https://xbind.to)
     */
    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., "payment-processing")
     * @param options.permissions - Custom permissions
     * @param options.expiresIn - Expiration in seconds (default: 7 days)
     * @returns Invite or error
     *
     * @example
     * ```ts
     * const inviteService = new InviteService();
     * const invite = await inviteService.create({
     *   from: {
     *     name: 'billing-service',
     *     did: 'did:key:z6Mk...',
     *     endpoint: 'https://billing.example.com',
     *     publicKey: '...',
     *   },
     *   target: {
     *     name: 'payments-service',
     *   },
     *   template: 'payment-processing',
     * });
     *
     * // Share invite.value.url or invite.value.qr
     * ```
     */
    create(options: {
        from: ServiceInfo;
        target?: {
            name?: string;
            email?: string;
        };
        template?: string;
        permissions?: string[];
        expiresIn?: number;
    }): Promise<Result<Invite, InviteError>>;
    /**
     * Accept an invite.
     *
     * @param options - Accept options
     * @param options.inviteUrl - Invite URL (e.g., https://xbind.to/invite/abc123)
     * @param options.acceptor - Acceptor service info
     * @returns Connection info or error
     *
     * @example
     * ```ts
     * const inviteService = new InviteService();
     * const result = await inviteService.accept({
     *   inviteUrl: 'https://xbind.to/invite/abc123',
     *   acceptor: {
     *     name: 'payments-service',
     *     did: 'did:key:z6Mk...',
     *     endpoint: 'https://payments.example.com',
     *     publicKey: '...',
     *   }
     * });
     *
     * if (result.ok) {
     *   console.log('Connected!');
     * }
     * ```
     */
    accept(options: {
        inviteUrl: string;
        acceptor: ServiceInfo;
    }): Promise<Result<{
        success: boolean;
        connection: ServiceInfo;
    }, InviteError>>;
    /**
     * Get invite details without accepting.
     *
     * @param inviteUrl - Invite URL
     * @returns Invite details or error
     */
    get(inviteUrl: string): Promise<Result<Invite, InviteError>>;
    /**
     * Revoke an invite.
     *
     * @param inviteId - Invite ID to revoke
     * @returns Success or error
     *
     * @example
     * ```ts
     * const inviteService = new InviteService();
     * const result = await inviteService.revoke('inv_abc123');
     *
     * if (result.ok) {
     *   console.log('Invite revoked');
     * }
     * ```
     */
    revoke(inviteId: string): Promise<Result<{
        success: boolean;
    }, InviteError>>;
    /**
     * Extract invite ID from URL.
     *
     * @param url - Invite URL
     * @returns Invite ID or null
     *
     * @example
     * ```ts
     * extractInviteId('https://xbind.to/invite/abc123') // 'abc123'
     * extractInviteId('https://xbind.to/billing/invite/xyz') // 'xyz'
     * ```
     */
    private extractInviteId;
}
