/**
 * @module auto-accept
 * Auto-accept invite on first Xchange call for zero-click onboarding.
 *
 * Enables services to accept invites automatically without explicit
 * accept commands. Invite code comes from environment variable.
 *
 * @example
 * ```ts
 * // Environment: XCHANGE_INVITE_CODE=XCH-abc123, XCHANGE_AUTO_ACCEPT=true
 *
 * // Auto-accept happens on first Xchange method call:
 * const xchange = Xchange.lazy({ name: 'my-service' });
 * await xchange.sendWithXchange({ to: partnerDid, payload: data, scope: 'test' });
 * // ↑ Invite auto-accepted before send()
 * ```
 */
import { Result } from '@private.me/shared';
/**
 * Service information for invite acceptance.
 */
export interface ServiceInfo {
    /** Service name. */
    name: string;
    /** Service DID. */
    did: string;
    /** Service endpoint URL. */
    endpoint: string;
    /** Public key in base64. */
    publicKey: string;
    /** X25519 public key in base64 (optional). */
    x25519PublicKey?: string;
}
/**
 * Invite details.
 */
export interface Invite {
    /** Invite code. */
    code: string;
    /** Inviter service info. */
    from: ServiceInfo;
    /** Permissions granted to acceptor. */
    permissions: string[];
    /** Invite metadata. */
    metadata?: Record<string, any>;
}
/**
 * Auto-accept configuration options.
 */
export interface AutoAcceptConfig {
    /** Invite code (e.g., 'XCH-abc123') or URL. If omitted, reads from XCHANGE_INVITE_CODE env var. */
    inviteCode?: string;
    /** Whether to enable auto-accept. Default: true if XCHANGE_INVITE_CODE is set. */
    enabled?: boolean;
    /** Custom invite API URL (default: https://xchange.to). */
    inviteApiUrl?: string;
    /** Custom trust registry (default: use in-memory registry). */
    registry?: any;
}
/**
 * Auto-accept error codes.
 */
export declare enum AutoAcceptErrorCode {
    NO_INVITE_CODE = "AUTO_ACCEPT_NO_INVITE_CODE",
    DISABLED = "AUTO_ACCEPT_DISABLED",
    INVITE_FAILED = "AUTO_ACCEPT_INVITE_FAILED",
    REGISTRY_SETUP_FAILED = "AUTO_ACCEPT_REGISTRY_SETUP_FAILED"
}
/**
 * Auto-accept error.
 */
export interface AutoAcceptError {
    code: AutoAcceptErrorCode;
    message: string;
    hint?: string;
    cause?: any;
}
/**
 * Result of auto-accept operation.
 */
export interface AcceptDetails {
    /** The invite that was accepted. */
    invite: Invite;
    /** Service info of the inviter. */
    from: ServiceInfo;
    /** Trust registry URL (if provided in invite). */
    registryUrl?: string;
    /** Whether registry was auto-configured. */
    registryAutoconfigured: boolean;
}
/**
 * Auto-accept an invite on first Xchange call.
 *
 * Reads invite code from config or environment variable `XCHANGE_INVITE_CODE`.
 * If `XCHANGE_AUTO_ACCEPT` is false, returns error with code DISABLED.
 *
 * When successful:
 * 1. Fetches invite details from invite server
 * 2. Adds inviter to trust registry
 * 3. Auto-detects registry endpoint from invite metadata (if present)
 * 4. Marks invite as accepted
 *
 * This is called internally by `LazyXchange` before the first send/receive.
 *
 * @param config - Auto-accept configuration
 * @param acceptorInfo - Acceptor service info (DID, endpoint, publicKey)
 * @returns Accept details or error
 *
 * @example
 * ```ts
 * // Manual usage (typically called internally by LazyXchange):
 * const result = await autoAcceptInvite(
 *   { inviteCode: 'XCH-abc123' },
 *   {
 *     name: 'my-service',
 *     did: 'did:key:z6Mk...',
 *     endpoint: 'https://my-service.com',
 *     publicKey: '...',
 *   }
 * );
 *
 * if (result.ok) {
 *   console.log('Auto-accepted invite from:', result.value.from.name);
 * }
 * ```
 */
export declare function autoAcceptInvite(config: AutoAcceptConfig, acceptorInfo: ServiceInfo): Promise<Result<AcceptDetails, AutoAcceptError>>;
