/**
 * @module trust-integration
 * Trust registry integration for Xchange fast onboarding.
 *
 * Automatically registers Xchange connections in the trust registry
 * when accepting invites. Enables seamless integration with xBind
 * and other ACIs.
 */
import { Result } from '@private.me/shared';
import type { XchangeServiceInfo } from './invite-client.js';
/**
 * Trust registry error codes.
 */
export type XchangeRegistryError = 'NOT_FOUND' | 'ALREADY_REGISTERED' | 'REVOKED' | 'NETWORK_ERROR';
/**
 * Metadata stored for a registered DID with Xchange support.
 */
export interface XchangeRegistryEntry {
    readonly did: string;
    readonly publicKey: Uint8Array;
    readonly name: string;
    readonly scopes: ReadonlySet<string>;
    readonly revoked: boolean;
    /** Optional X25519 public key for ECDH forward secrecy. */
    readonly x25519PublicKey?: Uint8Array;
    /** Optional ML-KEM-768 public key for hybrid post-quantum KEM (1184 bytes). */
    readonly mlKemPublicKey?: Uint8Array;
    /** Whether this agent supports Xchange (XorIDA key transport). */
    readonly xchange: boolean;
}
/**
 * Trust registry for Xchange DID registration and resolution.
 *
 * MemoryXchangeTrustRegistry for development, HttpXchangeTrustRegistry for production.
 */
export interface XchangeTrustRegistry {
    /** Register a DID with Xchange support. */
    register(did: string, publicKey: Uint8Array, name: string, scopes?: string[], x25519PublicKey?: Uint8Array, mlKemPublicKey?: Uint8Array): Promise<Result<void, XchangeRegistryError>>;
    /** Resolve a DID to its raw public key bytes. */
    resolve(did: string): Promise<Result<Uint8Array, XchangeRegistryError>>;
    /** Check if a DID has a specific scope permission. */
    hasScope(did: string, scope: string): Promise<boolean>;
    /** Revoke a DID immediately. */
    revoke(did: string): Promise<Result<void, XchangeRegistryError>>;
    /** Get the full registry entry for a DID. */
    getEntry(did: string): Promise<Result<XchangeRegistryEntry, XchangeRegistryError>>;
}
/**
 * In-memory trust registry for Xchange development and testing.
 */
export declare class MemoryXchangeTrustRegistry implements XchangeTrustRegistry {
    private readonly entries;
    register(did: string, publicKey: Uint8Array, name: string, scopes?: string[], x25519PublicKey?: Uint8Array, mlKemPublicKey?: Uint8Array): Promise<Result<void, XchangeRegistryError>>;
    resolve(did: string): Promise<Result<Uint8Array, XchangeRegistryError>>;
    hasScope(did: string, scope: string): Promise<boolean>;
    revoke(did: string): Promise<Result<void, XchangeRegistryError>>;
    getEntry(did: string): Promise<Result<XchangeRegistryEntry, XchangeRegistryError>>;
}
/**
 * Auto-accept and register a Xchange invite.
 *
 * Reads XCHANGE_AUTO_ACCEPT and XCHANGE_INVITE_CODE env vars.
 * If enabled, automatically accepts the invite and registers
 * the service in the trust registry.
 *
 * @param options - Configuration
 * @param options.registry - Trust registry instance
 * @param options.inviteCode - Invite code (defaults to XCHANGE_INVITE_CODE env var)
 * @param options.autoAccept - Auto-accept flag (defaults to XCHANGE_AUTO_ACCEPT env var)
 * @param options.registryUrl - Registry URL (defaults to XCHANGE_REGISTRY_URL env var)
 * @returns Result with service info or error
 *
 * @example
 * ```ts
 * const registry = new MemoryXchangeTrustRegistry();
 * const result = await autoAcceptXchangeInvite({ registry });
 * if (result.ok) {
 *   console.log('Connected to:', result.value.fromName);
 * }
 * ```
 */
export declare function autoAcceptXchangeInvite(options: {
    registry: XchangeTrustRegistry;
    inviteCode?: string;
    autoAccept?: boolean;
    registryUrl?: string;
}): Promise<Result<{
    fromDid: string;
    fromName: string;
    scopes: string[];
}, XchangeRegistryError | 'INVALID_INVITE_CODE' | 'AUTO_ACCEPT_DISABLED'>>;
/**
 * Register a service info in the trust registry.
 *
 * Helper function to convert XchangeServiceInfo to registry entry.
 *
 * @param registry - Trust registry instance
 * @param serviceInfo - Service information
 * @param scopes - Optional scopes to grant
 * @returns Result of registration
 */
export declare function registerXchangeService(registry: XchangeTrustRegistry, serviceInfo: XchangeServiceInfo, scopes?: string[]): Promise<Result<void, XchangeRegistryError>>;
