/** * @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 { Subscription } from "#interaction/Subscription.js"; import { PeerAddress } from "#peer/PeerAddress.js"; import { PeerLossContext } from "#peer/PeerLossContext.js"; import { MessageExchange } from "#protocol/MessageExchange.js"; import { SecureChannelMessenger } from "#securechannel/SecureChannelMessenger.js"; import { AsyncObservableValue, BasicSet, Bytes, Crypto, Logger } from "@matter/general"; import { CaseAuthenticatedTag, FabricIndex, NodeId } from "@matter/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; constructor(config: NodeSession.Config); get parameterDiagnostics(): Record; get caseAuthenticatedTags(): readonly CaseAuthenticatedTag[]; /** * The session parameters the peer sent while establishing this session, without fallbacks. Undefined when the peer * sent none. {@link parameters} holds the effective values. */ get reportedParameters(): Partial | undefined; get isPase(): boolean; get subscriptions(): BasicSet; 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; notifyActivity(messageReceived: boolean): void; get associatedFabric(): Fabric; closeSubscriptions(flush?: boolean, currentExchange?: MessageExchange): Promise; closeSubscriptionsForShutdown(): Promise; get closedByPeer(): AsyncObservableValue<[any, ...any[]]>; handlePeerClose(currentExchange?: MessageExchange): Promise; handlePeerLoss(context: PeerLossContext): Promise; get suppressPeerLoss(): boolean; 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): Promise; initiateForceClose(context: PeerLossContext): Promise; addExchange(exchange: MessageExchange): void; protected close(): Promise; /** * 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?: readonly CaseAuthenticatedTag[]; /** @see {@link NodeSession.suppressPeerLoss} */ suppressPeerLoss?: boolean; /** @see {@link NodeSession.reportedParameters} */ reportedSessionParameters?: SessionParameters.Config; } 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; /** * The effective parameters of the peer when they differ from what it reported, e.g. with values the initiator * already knew. Defaults to {@link reportedSessionParameters}. */ peerSessionParameters?: SessionParameters.Config; } } //# sourceMappingURL=NodeSession.d.ts.map