/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { Subject } from "#action/server/Subject.js";
import { DecodedMessage, DecodedPacket, Message, Packet, SessionType } from "#codec/MessageCodec.js";
import { Fabric } from "#fabric/Fabric.js";
import { AsyncObservableValue, BasicSet, Bytes, Crypto, Logger } from "#general";
import { Subscription } from "#interaction/Subscription.js";
import { PeerAddress } from "#peer/PeerAddress.js";
import { MessageExchange } from "#protocol/MessageExchange.js";
import { SecureChannelMessenger } from "#securechannel/SecureChannelMessenger.js";
import { CaseAuthenticatedTag, FabricIndex, NodeId } from "#types";
import { SecureSession } from "./SecureSession.js";
import { Session } from "./Session.js";
import { SessionParameters } from "./SessionParameters.js";
export declare class NodeSession extends SecureSession {
    #private;
    readonly supportsMRP = true;
    readonly type = SessionType.Unicast;
    static create(config: NodeSession.CreateConfig): Promise<NodeSession>;
    constructor(config: NodeSession.Config);
    get parameterDiagnostics(): Record<string, unknown>;
    get caseAuthenticatedTags(): CaseAuthenticatedTag[];
    get isPase(): boolean;
    get subscriptions(): BasicSet<Subscription, Subscription>;
    get isInitiator(): boolean;
    subjectFor(_message?: Message): Subject;
    decode({ header, applicationPayload, messageExtension }: DecodedPacket, aad: Bytes): DecodedMessage;
    encode(message: Message): Packet;
    get attestationChallengeKey(): Bytes;
    get fabric(): Fabric | undefined;
    set fabric(fabric: Fabric);
    get id(): number;
    get via(): string;
    get peerSessionId(): number;
    get nodeId(): NodeId;
    get peerNodeId(): NodeId;
    get hasAssociatedFabric(): boolean;
    get associatedFabric(): Fabric;
    closeSubscriptions(flush?: boolean): Promise<number>;
    get closedByPeer(): AsyncObservableValue<[any, ...any[]]>;
    handlePeerClose(): Promise<void>;
    handlePeerLoss(data?: {
        currentExchange?: MessageExchange;
        keepSubscriptions?: boolean;
    }): Promise<void>;
    get isPeerLost(): boolean;
    /**
     * Close the session.
     *
     * If there are open subscriptions they are closed without flushing.  To flush, use {@link closeSubscriptions}
     * before invoking.
     *
     * TODO - subscription handling is only relevant for server; needs to move to server-specific component
     *
     * If there are active exchanges the close is deferred until the final exchange closes.  To close sooner, use
     * {@link initiateForceClose}.
     *
     * A final exchange will be opened to notify the peer of closure unless the peer is marked as lost.
     */
    initiateClose(shutdownLogic?: () => Promise<void>): Promise<void>;
    initiateForceClose(currentExchange?: MessageExchange, keepSubscriptions?: boolean): Promise<void>;
    addExchange(exchange: MessageExchange): void;
    protected close(): Promise<void>;
    /**
     * The peer node's address.
     */
    get peerAddress(): {
        fabricIndex: FabricIndex;
        nodeId: NodeId;
    };
    /**
     * Indicates whether a peer matches a specific address.
     */
    peerIs(address: PeerAddress): boolean;
}
export declare namespace NodeSession {
    function assert(session?: Session, errorText?: string): asserts session is NodeSession;
    function is(session?: Session): session is NodeSession;
    function logNew(logger: Logger, operation: "New" | "Resumed", session: NodeSession, messenger: SecureChannelMessenger, fabric: Fabric, peerNodeId: NodeId): void;
}
export declare namespace NodeSession {
    interface CommonConfig extends Session.CommonConfig {
        crypto: Crypto;
        id: number;
        fabric?: Fabric;
        peerNodeId: NodeId;
        peerSessionId: number;
        caseAuthenticatedTags?: CaseAuthenticatedTag[];
    }
    interface Config extends CommonConfig {
        decryptKey: Bytes;
        encryptKey: Bytes;
        attestationKey: Bytes;
        sessionParameters?: SessionParameters.Config;
        isInitiator: boolean;
    }
    interface CreateConfig extends CommonConfig {
        sharedSecret: Bytes;
        salt: Bytes;
        isInitiator: boolean;
        isResumption: boolean;
        peerSessionParameters?: SessionParameters.Config;
    }
}
//# sourceMappingURL=NodeSession.d.ts.map