/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { CommissionableDevice } from "#common/Scanner.js";
import { NodeSession } from "#session/NodeSession.js";
import { Duration, ServerAddress } from "@matter/general";
/**
 * Attempts PASE establishments in parallel across all provided device candidates, returning the first successful
 * session.
 *
 * All candidates come from {@link CommissioningConnection.Options.devices}.  The first candidate launches
 * immediately; subsequent candidates are staggered by {@link PER_ADDRESS_STAGGER_DELAY} to avoid overwhelming a
 * device that exposes multiple addresses (the CHIP responder cannot serialise concurrent
 * PBKDFParamRequests).  This is used when addresses are already known (e.g. from a prior mDNS discovery or
 * a pre-configured address list).
 *
 * A PASE attempt is launched for each (device, address) candidate, so a single device may have multiple concurrent
 * attempts if it was discovered at multiple addresses.  If an attempt fails with a credential error the device is
 * permanently dropped.  If it fails with a transient network/timeout error the remaining addresses for that device
 * are still in-flight.  The process completes when one session is established, all candidates are exhausted, or the
 * overall timeout fires.
 *
 * When the first PASE session is established the abort signal passed to
 * {@link CommissioningConnection.Options.establishSession} fires on all remaining in-flight attempts, allowing
 * them to cancel cleanly (e.g. by sending an InvalidParam status to the device to prevent a 60-second pairing
 * lockout).
 */
export declare function CommissioningConnection(options: CommissioningConnection.Options): Promise<CommissioningConnection.Result>;
export declare namespace CommissioningConnection {
    interface Options {
        /**
         * Commissioning candidates to attempt PASE with.
         *
         * {@link CommissioningConnectionPool} merges entries by `deviceIdentifier` and expands each device's
         * address list into independent `(device, address)` attempts.  The stagger delay applies globally
         * across those generated attempts (slot 0 fires immediately, slot N fires at N × staggerDelay) —
         * the intent is to serialise addresses of one physical device so the CHIP responder isn't hit with
         * concurrent PBKDFParamRequests it cannot handle.
         *
         * Callers that discover genuinely distinct devices should coordinate fan-out at a higher layer
         * (e.g. {@link ParallelPaseDiscovery}); passing multiple distinct devices here will serialise them
         * by the same stagger, which is usually not what you want for a multi-device race.
         */
        devices: CommissionableDevice[];
        /** Overall timeout for the entire connection attempt. */
        timeout: Duration;
        /**
         * Establishes a PASE session for the given candidate.  The provided {@link AbortSignal} fires when the
         * overall timeout expires or when another candidate wins the race first.  Implementations should respect the
         * signal and abort cleanly (e.g. by sending an InvalidParam status to prevent a 60-second device lockout).
         */
        establishSession: (address: ServerAddress, device: CommissionableDevice, signal: AbortSignal) => Promise<NodeSession>;
        /**
         * An external abort signal.  When fired, terminates all in-flight PASE attempts immediately.
         */
        externalAbort?: AbortSignal;
        /**
         * Delay between consecutive PASE attempt starts.  Defaults to the internal 15s production value.
         * Exposed primarily for tests that need to disable or shorten the stagger; production callers
         * should not override this.
         */
        staggerDelay?: Duration;
    }
    interface Result {
        session: NodeSession;
        discoveryData: CommissionableDevice;
    }
}
//# sourceMappingURL=CommissioningConnection.d.ts.map