@matter/protocol 0.16.0-alpha.0-20251107-6bcb5baf4 → 0.16.0-alpha.0-20251110-c4c70a41b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/action/client/ClientInteraction.d.ts +7 -0
- package/dist/cjs/action/client/ClientInteraction.d.ts.map +1 -1
- package/dist/cjs/action/client/ClientInteraction.js +17 -5
- package/dist/cjs/action/client/ClientInteraction.js.map +1 -1
- package/dist/cjs/action/server/AccessControl.d.ts +5 -0
- package/dist/cjs/action/server/AccessControl.d.ts.map +1 -1
- package/dist/cjs/action/server/AccessControl.js +1 -0
- package/dist/cjs/action/server/AccessControl.js.map +1 -1
- package/dist/cjs/action/server/CommandInvokeResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/CommandInvokeResponse.js +12 -1
- package/dist/cjs/action/server/CommandInvokeResponse.js.map +1 -1
- package/dist/cjs/action/server/DataResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/DataResponse.js +1 -0
- package/dist/cjs/action/server/DataResponse.js.map +1 -1
- package/dist/cjs/ble/Ble.d.ts +1 -0
- package/dist/cjs/ble/Ble.d.ts.map +1 -1
- package/dist/cjs/ble/Ble.js +1 -0
- package/dist/cjs/ble/Ble.js.map +1 -1
- package/dist/cjs/common/FailsafeContext.js +1 -1
- package/dist/cjs/common/FailsafeContext.js.map +1 -1
- package/dist/cjs/fabric/Fabric.d.ts +8 -1
- package/dist/cjs/fabric/Fabric.d.ts.map +1 -1
- package/dist/cjs/fabric/Fabric.js +11 -2
- package/dist/cjs/fabric/Fabric.js.map +1 -1
- package/dist/cjs/fabric/FabricManager.d.ts +5 -1
- package/dist/cjs/fabric/FabricManager.d.ts.map +1 -1
- package/dist/cjs/fabric/FabricManager.js +7 -1
- package/dist/cjs/fabric/FabricManager.js.map +1 -1
- package/dist/cjs/interaction/FabricAccessControl.d.ts.map +1 -1
- package/dist/cjs/interaction/FabricAccessControl.js +4 -1
- package/dist/cjs/interaction/FabricAccessControl.js.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.js +7 -1
- package/dist/cjs/protocol/ExchangeManager.js.map +1 -1
- package/dist/cjs/protocol/MessageChannel.d.ts +5 -0
- package/dist/cjs/protocol/MessageChannel.d.ts.map +1 -1
- package/dist/cjs/protocol/MessageChannel.js +7 -0
- package/dist/cjs/protocol/MessageChannel.js.map +1 -1
- package/dist/cjs/session/NodeSession.d.ts +1 -1
- package/dist/cjs/session/NodeSession.d.ts.map +1 -1
- package/dist/cjs/session/NodeSession.js +2 -2
- package/dist/cjs/session/NodeSession.js.map +1 -1
- package/dist/cjs/session/Session.d.ts +1 -1
- package/dist/cjs/session/Session.d.ts.map +1 -1
- package/dist/cjs/session/Session.js.map +1 -1
- package/dist/cjs/session/SessionManager.d.ts +1 -1
- package/dist/cjs/session/SessionManager.d.ts.map +1 -1
- package/dist/cjs/session/case/CaseServer.js +1 -1
- package/dist/cjs/session/case/CaseServer.js.map +1 -1
- package/dist/cjs/session/pase/PaseServer.d.ts.map +1 -1
- package/dist/cjs/session/pase/PaseServer.js +29 -26
- package/dist/cjs/session/pase/PaseServer.js.map +1 -1
- package/dist/esm/action/client/ClientInteraction.d.ts +7 -0
- package/dist/esm/action/client/ClientInteraction.d.ts.map +1 -1
- package/dist/esm/action/client/ClientInteraction.js +18 -5
- package/dist/esm/action/client/ClientInteraction.js.map +1 -1
- package/dist/esm/action/server/AccessControl.d.ts +5 -0
- package/dist/esm/action/server/AccessControl.d.ts.map +1 -1
- package/dist/esm/action/server/AccessControl.js +1 -0
- package/dist/esm/action/server/AccessControl.js.map +1 -1
- package/dist/esm/action/server/CommandInvokeResponse.d.ts.map +1 -1
- package/dist/esm/action/server/CommandInvokeResponse.js +12 -1
- package/dist/esm/action/server/CommandInvokeResponse.js.map +1 -1
- package/dist/esm/action/server/DataResponse.d.ts.map +1 -1
- package/dist/esm/action/server/DataResponse.js +1 -0
- package/dist/esm/action/server/DataResponse.js.map +1 -1
- package/dist/esm/ble/Ble.d.ts +1 -0
- package/dist/esm/ble/Ble.d.ts.map +1 -1
- package/dist/esm/ble/Ble.js +1 -0
- package/dist/esm/ble/Ble.js.map +1 -1
- package/dist/esm/common/FailsafeContext.js +1 -1
- package/dist/esm/common/FailsafeContext.js.map +1 -1
- package/dist/esm/fabric/Fabric.d.ts +8 -1
- package/dist/esm/fabric/Fabric.d.ts.map +1 -1
- package/dist/esm/fabric/Fabric.js +11 -2
- package/dist/esm/fabric/Fabric.js.map +1 -1
- package/dist/esm/fabric/FabricManager.d.ts +5 -1
- package/dist/esm/fabric/FabricManager.d.ts.map +1 -1
- package/dist/esm/fabric/FabricManager.js +7 -1
- package/dist/esm/fabric/FabricManager.js.map +1 -1
- package/dist/esm/interaction/FabricAccessControl.d.ts.map +1 -1
- package/dist/esm/interaction/FabricAccessControl.js +4 -1
- package/dist/esm/interaction/FabricAccessControl.js.map +1 -1
- package/dist/esm/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/esm/protocol/ExchangeManager.js +7 -1
- package/dist/esm/protocol/ExchangeManager.js.map +1 -1
- package/dist/esm/protocol/MessageChannel.d.ts +5 -0
- package/dist/esm/protocol/MessageChannel.d.ts.map +1 -1
- package/dist/esm/protocol/MessageChannel.js +7 -0
- package/dist/esm/protocol/MessageChannel.js.map +1 -1
- package/dist/esm/session/NodeSession.d.ts +1 -1
- package/dist/esm/session/NodeSession.d.ts.map +1 -1
- package/dist/esm/session/NodeSession.js +2 -2
- package/dist/esm/session/NodeSession.js.map +1 -1
- package/dist/esm/session/Session.d.ts +1 -1
- package/dist/esm/session/Session.d.ts.map +1 -1
- package/dist/esm/session/Session.js.map +1 -1
- package/dist/esm/session/SessionManager.d.ts +1 -1
- package/dist/esm/session/SessionManager.d.ts.map +1 -1
- package/dist/esm/session/case/CaseServer.js +1 -1
- package/dist/esm/session/case/CaseServer.js.map +1 -1
- package/dist/esm/session/pase/PaseServer.d.ts.map +1 -1
- package/dist/esm/session/pase/PaseServer.js +29 -26
- package/dist/esm/session/pase/PaseServer.js.map +1 -1
- package/package.json +6 -6
- package/src/action/client/ClientInteraction.ts +25 -3
- package/src/action/server/AccessControl.ts +8 -0
- package/src/action/server/CommandInvokeResponse.ts +15 -1
- package/src/action/server/DataResponse.ts +1 -0
- package/src/ble/Ble.ts +1 -0
- package/src/common/FailsafeContext.ts +1 -1
- package/src/fabric/Fabric.ts +12 -2
- package/src/fabric/FabricManager.ts +12 -2
- package/src/interaction/FabricAccessControl.ts +4 -1
- package/src/protocol/ExchangeManager.ts +7 -1
- package/src/protocol/MessageChannel.ts +8 -0
- package/src/session/NodeSession.ts +2 -2
- package/src/session/Session.ts +5 -1
- package/src/session/SessionManager.ts +1 -1
- package/src/session/case/CaseServer.ts +1 -1
- package/src/session/pase/PaseServer.ts +41 -34
|
@@ -337,8 +337,8 @@ export class NodeSession extends SecureSession {
|
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
/** Destroys a session. Outstanding subscription data will be discarded. */
|
|
340
|
-
async destroy(sendClose = false, closeAfterExchangeFinished = true) {
|
|
341
|
-
await this.clearSubscriptions(
|
|
340
|
+
async destroy(sendClose = false, closeAfterExchangeFinished = true, flushSubscriptions = false) {
|
|
341
|
+
await this.clearSubscriptions(flushSubscriptions);
|
|
342
342
|
this.#fabric?.removeSession(this);
|
|
343
343
|
if (!sendClose) {
|
|
344
344
|
this.#sendCloseMessageWhenClosing = false;
|
package/src/session/Session.ts
CHANGED
|
@@ -218,7 +218,11 @@ export abstract class Session {
|
|
|
218
218
|
abstract decode(packet: DecodedPacket, aad?: Bytes): DecodedMessage;
|
|
219
219
|
abstract encode(message: Message): Packet;
|
|
220
220
|
abstract end(sendClose: boolean): Promise<void>;
|
|
221
|
-
abstract destroy(
|
|
221
|
+
abstract destroy(
|
|
222
|
+
sendClose?: boolean,
|
|
223
|
+
closeAfterExchangeFinished?: boolean,
|
|
224
|
+
flushSubscriptions?: boolean,
|
|
225
|
+
): Promise<void>;
|
|
222
226
|
|
|
223
227
|
protected get manager() {
|
|
224
228
|
return this.#manager;
|
|
@@ -49,7 +49,7 @@ export class CaseServer implements ProtocolHandler {
|
|
|
49
49
|
try {
|
|
50
50
|
await this.#handleSigma1(messenger);
|
|
51
51
|
} catch (error) {
|
|
52
|
-
logger.error("
|
|
52
|
+
logger.error("Error establishing CASE session", error);
|
|
53
53
|
|
|
54
54
|
if (error instanceof FabricNotFoundError) {
|
|
55
55
|
await messenger.sendError(SecureChannelStatusCode.NoSharedTrustRoots);
|
|
@@ -72,46 +72,53 @@ export class PaseServer implements ProtocolHandler {
|
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
const messenger = new PaseServerMessenger(exchange);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
75
|
+
|
|
76
|
+
// When a Commissioner is either in the process of establishing a PASE session with the Commissionee or has
|
|
77
|
+
// successfully established a session, the Commissionee SHALL NOT accept any more requests for new PASE
|
|
78
|
+
// sessions until session establishment fails or the successfully established PASE session is terminated on
|
|
79
|
+
// the commissioning channel.
|
|
80
|
+
const paseSession = this.sessions.getPaseSession();
|
|
81
|
+
if (paseSession !== undefined && !paseSession.isClosing) {
|
|
82
|
+
logger.info("Pase server: Pairing already in progress (PASE session exists), ignoring new exchange.");
|
|
83
|
+
} else if (this.#pairingTimer?.isRunning) {
|
|
84
|
+
logger.info(
|
|
85
|
+
"Pase server: Pairing already in progress (PASE establishment Timer running), ignoring new exchange.",
|
|
86
|
+
);
|
|
87
|
+
} else if (this.#pairingMessenger !== undefined) {
|
|
88
|
+
logger.info("Already handling a pairing request, ignoring new exchange.");
|
|
89
|
+
} else {
|
|
90
|
+
// All checks done, we handle the pairing request
|
|
91
|
+
try {
|
|
90
92
|
this.#pairingMessenger = messenger;
|
|
91
93
|
// Ok new pairing try, handle it
|
|
92
94
|
await this.handlePairingRequest(this.sessions.crypto);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
error,
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
// If we received a ChannelStatusResponseError we do not need to send one back, so just cancel pairing
|
|
102
|
-
const sendError = !(error instanceof ChannelStatusResponseError);
|
|
103
|
-
await this.cancelPairing(messenger, sendError);
|
|
104
|
-
|
|
105
|
-
if (this.#pairingErrors >= PASE_COMMISSIONING_MAX_ERRORS) {
|
|
106
|
-
throw new MaximumPasePairingErrorsReachedError(
|
|
107
|
-
`Pase server: Too many errors during PASE commissioning, aborting commissioning window`,
|
|
95
|
+
} catch (error) {
|
|
96
|
+
this.#pairingErrors++;
|
|
97
|
+
logger.error(
|
|
98
|
+
`An error occurred during the PASE commissioning (${this.#pairingErrors}/${PASE_COMMISSIONING_MAX_ERRORS}):`,
|
|
99
|
+
error,
|
|
108
100
|
);
|
|
101
|
+
|
|
102
|
+
// If we received a ChannelStatusResponseError we do not need to send one back, so just cancel pairing
|
|
103
|
+
const sendError = !(error instanceof ChannelStatusResponseError);
|
|
104
|
+
await this.cancelPairing(messenger, sendError);
|
|
105
|
+
|
|
106
|
+
if (this.#pairingErrors >= PASE_COMMISSIONING_MAX_ERRORS) {
|
|
107
|
+
throw new MaximumPasePairingErrorsReachedError(
|
|
108
|
+
`Pase server: Too many errors during PASE commissioning, aborting commissioning window`,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
} finally {
|
|
112
|
+
this.#pairingMessenger = undefined;
|
|
113
|
+
// Destroy the unsecure session used to establish the Pase session
|
|
114
|
+
await exchange.session.destroy();
|
|
109
115
|
}
|
|
110
|
-
|
|
111
|
-
this.#pairingMessenger = undefined;
|
|
112
|
-
// Destroy the unsecure session used to establish the Pase session
|
|
113
|
-
await exchange.session.destroy();
|
|
116
|
+
return;
|
|
114
117
|
}
|
|
118
|
+
|
|
119
|
+
// We are not handing the pairing request, send error and close messenger
|
|
120
|
+
await messenger.sendError(SecureChannelStatusCode.InvalidParam);
|
|
121
|
+
await messenger.close();
|
|
115
122
|
}
|
|
116
123
|
|
|
117
124
|
private async handlePairingRequest(crypto: Crypto) {
|