/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { TransientPeerCommunicationError } from "#peer/PeerCommunicationError.js";
import { Bytes, Duration } from "@matter/general";
import { GeneralStatusCode, SecureChannelStatusCode, SecureMessageType, TlvSchema, VendorId } from "@matter/types";
import { Message } from "../codec/MessageCodec.js";
import { ExchangeSendOptions, MessageExchange } from "../protocol/MessageExchange.js";
/** Error base Class for all errors related to the status response messages. */
export declare class ChannelStatusResponseError extends TransientPeerCommunicationError {
    readonly generalStatusCode: GeneralStatusCode;
    readonly protocolStatusCode: SecureChannelStatusCode;
    readonly vendorId?: VendorId | undefined;
    readonly protocolData?: Bytes | undefined;
    busyDelay?: Duration;
    constructor(message: string, generalStatusCode: GeneralStatusCode, protocolStatusCode: SecureChannelStatusCode, vendorId?: VendorId | undefined, protocolData?: Bytes | undefined);
}
/** Chip SDK uses this value when performance wise heavy crypto operations are expected. */
export declare const EXPECTED_CRYPTO_PROCESSING_TIME: Duration;
/** This value is used by chip SDK when normal processing time is expected. */
export declare const DEFAULT_NORMAL_PROCESSING_TIME: Duration;
export declare class SecureChannelMessenger {
    #private;
    readonly exchange: MessageExchange;
    constructor(exchange: MessageExchange, defaultExpectedProcessingTime?: Duration);
    get channel(): import("../index.js").MessageChannel;
    get via(): string;
    /**
     * Waits for the next message and returns it.
     *
     * {@link expectedProcessingTime} defaults to {@link EXPECTED_CRYPTO_PROCESSING_TIME}.
     */
    nextMessage({ type, expectedProcessingTime, description, abort, }?: SecureChannelMessenger.ReadOptions): Promise<Message>;
    /**
     * Waits for the next message and decodes it.
     *
     * When no expectedProcessingTimeMs is provided, the default value of EXPECTED_CRYPTO_PROCESSING_TIME is used.
     */
    nextMessageDecoded<T>(schema: TlvSchema<T>, options?: SecureChannelMessenger.ReadOptions): Promise<T>;
    /**
     * Waits for the next message and returns it.
     *
     * When no expectedProcessingTimeMs is provided, the default value of EXPECTED_CRYPTO_PROCESSING_TIME is used.
     */
    waitForSuccess(options?: Omit<SecureChannelMessenger.ReadOptions, "type">): Promise<void>;
    /**
     * Sends a message of the given type with the given payload.
     *
     * If no ExchangeSendOptions are provided, the expectedProcessingTimeMs will be set to
     * EXPECTED_CRYPTO_PROCESSING_TIME.
     */
    send<T>(message: T, type: number, schema: TlvSchema<T>, options?: ExchangeSendOptions): Promise<AllowSharedBufferSource>;
    sendError(code: SecureChannelStatusCode, abort?: AbortSignal): Promise<void>;
    sendSuccess(abort?: AbortSignal): Promise<void>;
    sendBusy(minimumRetryInterval: Duration, abort?: AbortSignal): Promise<void>;
    sendCloseSession(abort?: AbortSignal): Promise<void>;
    get channelName(): string;
    [Symbol.asyncDispose](): Promise<void>;
    close(): Promise<void>;
    protected throwIfErrorStatusReport(message: Message, logHint?: string): void;
}
export declare namespace SecureChannelMessenger {
    /**
     * Controls message read.
     */
    interface ReadOptions {
        /**
         * The expected type of the message.
         *
         * The messenger throws an error if a message arrives that is not of this type.
         */
        type?: SecureMessageType;
        /**
         * Processing time used as input to timeout algorithms.
         */
        expectedProcessingTime?: Duration;
        /**
         * Description of read operation used in diagnostic messages.
         */
        description?: string;
        /**
         * Aborts the read.
         */
        abort?: AbortSignal;
    }
}
//# sourceMappingURL=SecureChannelMessenger.d.ts.map