@matter/protocol 0.16.8-alpha.0-20260123-dff2cae52 → 0.16.8-alpha.0-20260127-65e1b40e2
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 +4 -4
- package/dist/cjs/action/client/ClientInteraction.d.ts.map +1 -1
- package/dist/cjs/action/client/ClientInteraction.js +48 -6
- package/dist/cjs/action/client/ClientInteraction.js.map +1 -1
- package/dist/cjs/action/client/QueuedClientInteraction.d.ts +0 -1
- package/dist/cjs/action/client/QueuedClientInteraction.d.ts.map +1 -1
- package/dist/cjs/action/client/QueuedClientInteraction.js +0 -1
- package/dist/cjs/action/client/QueuedClientInteraction.js.map +1 -1
- package/dist/cjs/action/client/subscription/ClientSubscriptionHandler.d.ts.map +1 -1
- package/dist/cjs/action/client/subscription/ClientSubscriptionHandler.js +5 -2
- package/dist/cjs/action/client/subscription/ClientSubscriptionHandler.js.map +1 -1
- package/dist/cjs/action/server/AttributeWriteResponse.d.ts +1 -1
- package/dist/cjs/action/server/AttributeWriteResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/AttributeWriteResponse.js +0 -6
- package/dist/cjs/action/server/AttributeWriteResponse.js.map +1 -1
- package/dist/cjs/action/server/DataResponse.d.ts +5 -0
- package/dist/cjs/action/server/DataResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/DataResponse.js +7 -0
- package/dist/cjs/action/server/DataResponse.js.map +1 -1
- package/dist/cjs/action/server/ServerInteraction.js.map +1 -1
- package/dist/cjs/dcl/DclCertificateService.d.ts.map +1 -1
- package/dist/cjs/dcl/DclCertificateService.js +3 -0
- package/dist/cjs/dcl/DclCertificateService.js.map +1 -1
- package/dist/cjs/dcl/DclOtaUpdateService.d.ts.map +1 -1
- package/dist/cjs/dcl/DclOtaUpdateService.js +6 -4
- package/dist/cjs/dcl/DclOtaUpdateService.js.map +1 -1
- package/dist/cjs/interaction/InteractionMessenger.d.ts +30 -30
- package/dist/cjs/interaction/InteractionMessenger.d.ts.map +1 -1
- package/dist/cjs/interaction/InteractionMessenger.js +81 -12
- package/dist/cjs/interaction/InteractionMessenger.js.map +1 -1
- package/dist/cjs/mdns/MdnsClient.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsClient.js +163 -102
- package/dist/cjs/mdns/MdnsClient.js.map +1 -1
- package/dist/cjs/mdns/MdnsServer.d.ts +2 -0
- package/dist/cjs/mdns/MdnsServer.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsServer.js +45 -5
- package/dist/cjs/mdns/MdnsServer.js.map +1 -1
- package/dist/cjs/peer/ControllerCommissioningFlow.d.ts.map +1 -1
- package/dist/cjs/peer/ControllerCommissioningFlow.js +3 -1
- package/dist/cjs/peer/ControllerCommissioningFlow.js.map +1 -1
- package/dist/cjs/peer/Peer.d.ts +2 -1
- package/dist/cjs/peer/Peer.d.ts.map +1 -1
- package/dist/cjs/peer/Peer.js +20 -3
- package/dist/cjs/peer/Peer.js.map +1 -1
- package/dist/cjs/peer/PeerAddressStore.d.ts +1 -11
- package/dist/cjs/peer/PeerAddressStore.d.ts.map +1 -1
- package/dist/cjs/peer/PeerAddressStore.js +1 -4
- package/dist/cjs/peer/PeerAddressStore.js.map +1 -1
- package/dist/cjs/peer/PeerDescriptor.d.ts +1 -9
- package/dist/cjs/peer/PeerDescriptor.d.ts.map +1 -1
- package/dist/cjs/peer/PeerDescriptor.js +1 -6
- package/dist/cjs/peer/PeerDescriptor.js.map +1 -1
- package/dist/cjs/peer/PeerSet.d.ts +1 -1
- package/dist/cjs/peer/PeerSet.d.ts.map +1 -1
- package/dist/cjs/peer/PeerSet.js +55 -22
- package/dist/cjs/peer/PeerSet.js.map +2 -2
- package/dist/cjs/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.js +2 -2
- package/dist/cjs/protocol/ExchangeManager.js.map +1 -1
- package/dist/cjs/protocol/ExchangeProvider.d.ts.map +1 -1
- package/dist/cjs/protocol/ExchangeProvider.js +3 -3
- package/dist/cjs/protocol/ExchangeProvider.js.map +1 -1
- package/dist/cjs/protocol/MRP.d.ts +54 -0
- package/dist/cjs/protocol/MRP.d.ts.map +1 -0
- package/dist/cjs/protocol/MRP.js +96 -0
- package/dist/cjs/protocol/MRP.js.map +6 -0
- package/dist/cjs/protocol/MessageChannel.d.ts +0 -23
- package/dist/cjs/protocol/MessageChannel.d.ts.map +1 -1
- package/dist/cjs/protocol/MessageChannel.js +15 -47
- package/dist/cjs/protocol/MessageChannel.js.map +2 -2
- package/dist/cjs/protocol/MessageExchange.d.ts.map +1 -1
- package/dist/cjs/protocol/MessageExchange.js +7 -7
- package/dist/cjs/protocol/MessageExchange.js.map +1 -1
- package/dist/cjs/protocol/index.d.ts +1 -0
- package/dist/cjs/protocol/index.d.ts.map +1 -1
- package/dist/cjs/protocol/index.js +1 -0
- package/dist/cjs/protocol/index.js.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 -0
- package/dist/cjs/session/Session.d.ts.map +1 -1
- package/dist/cjs/session/case/CaseClient.d.ts.map +1 -1
- package/dist/cjs/session/case/CaseClient.js +1 -1
- package/dist/cjs/session/case/CaseClient.js.map +1 -1
- package/dist/cjs/session/case/CaseServer.d.ts.map +1 -1
- package/dist/cjs/session/case/CaseServer.js +4 -1
- package/dist/cjs/session/case/CaseServer.js.map +1 -1
- package/dist/esm/action/client/ClientInteraction.d.ts +4 -4
- package/dist/esm/action/client/ClientInteraction.d.ts.map +1 -1
- package/dist/esm/action/client/ClientInteraction.js +49 -6
- package/dist/esm/action/client/ClientInteraction.js.map +1 -1
- package/dist/esm/action/client/QueuedClientInteraction.d.ts +0 -1
- package/dist/esm/action/client/QueuedClientInteraction.d.ts.map +1 -1
- package/dist/esm/action/client/QueuedClientInteraction.js +0 -1
- package/dist/esm/action/client/QueuedClientInteraction.js.map +1 -1
- package/dist/esm/action/client/subscription/ClientSubscriptionHandler.d.ts.map +1 -1
- package/dist/esm/action/client/subscription/ClientSubscriptionHandler.js +5 -2
- package/dist/esm/action/client/subscription/ClientSubscriptionHandler.js.map +1 -1
- package/dist/esm/action/server/AttributeWriteResponse.d.ts +1 -1
- package/dist/esm/action/server/AttributeWriteResponse.d.ts.map +1 -1
- package/dist/esm/action/server/AttributeWriteResponse.js +0 -6
- package/dist/esm/action/server/AttributeWriteResponse.js.map +1 -1
- package/dist/esm/action/server/DataResponse.d.ts +5 -0
- package/dist/esm/action/server/DataResponse.d.ts.map +1 -1
- package/dist/esm/action/server/DataResponse.js +7 -0
- package/dist/esm/action/server/DataResponse.js.map +1 -1
- package/dist/esm/action/server/ServerInteraction.js.map +1 -1
- package/dist/esm/dcl/DclCertificateService.d.ts.map +1 -1
- package/dist/esm/dcl/DclCertificateService.js +3 -0
- package/dist/esm/dcl/DclCertificateService.js.map +1 -1
- package/dist/esm/dcl/DclOtaUpdateService.d.ts.map +1 -1
- package/dist/esm/dcl/DclOtaUpdateService.js +6 -4
- package/dist/esm/dcl/DclOtaUpdateService.js.map +1 -1
- package/dist/esm/interaction/InteractionMessenger.d.ts +30 -30
- package/dist/esm/interaction/InteractionMessenger.d.ts.map +1 -1
- package/dist/esm/interaction/InteractionMessenger.js +82 -12
- package/dist/esm/interaction/InteractionMessenger.js.map +1 -1
- package/dist/esm/mdns/MdnsClient.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsClient.js +163 -102
- package/dist/esm/mdns/MdnsClient.js.map +1 -1
- package/dist/esm/mdns/MdnsServer.d.ts +2 -0
- package/dist/esm/mdns/MdnsServer.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsServer.js +45 -5
- package/dist/esm/mdns/MdnsServer.js.map +1 -1
- package/dist/esm/peer/ControllerCommissioningFlow.d.ts.map +1 -1
- package/dist/esm/peer/ControllerCommissioningFlow.js +3 -1
- package/dist/esm/peer/ControllerCommissioningFlow.js.map +1 -1
- package/dist/esm/peer/Peer.d.ts +2 -1
- package/dist/esm/peer/Peer.d.ts.map +1 -1
- package/dist/esm/peer/Peer.js +20 -3
- package/dist/esm/peer/Peer.js.map +1 -1
- package/dist/esm/peer/PeerAddressStore.d.ts +1 -11
- package/dist/esm/peer/PeerAddressStore.d.ts.map +1 -1
- package/dist/esm/peer/PeerAddressStore.js +1 -4
- package/dist/esm/peer/PeerAddressStore.js.map +1 -1
- package/dist/esm/peer/PeerDescriptor.d.ts +1 -9
- package/dist/esm/peer/PeerDescriptor.d.ts.map +1 -1
- package/dist/esm/peer/PeerDescriptor.js +1 -6
- package/dist/esm/peer/PeerDescriptor.js.map +1 -1
- package/dist/esm/peer/PeerSet.d.ts +1 -1
- package/dist/esm/peer/PeerSet.d.ts.map +1 -1
- package/dist/esm/peer/PeerSet.js +60 -24
- package/dist/esm/peer/PeerSet.js.map +2 -2
- package/dist/esm/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/esm/protocol/ExchangeManager.js +2 -2
- package/dist/esm/protocol/ExchangeManager.js.map +1 -1
- package/dist/esm/protocol/ExchangeProvider.d.ts.map +1 -1
- package/dist/esm/protocol/ExchangeProvider.js +3 -3
- package/dist/esm/protocol/ExchangeProvider.js.map +1 -1
- package/dist/esm/protocol/MRP.d.ts +54 -0
- package/dist/esm/protocol/MRP.d.ts.map +1 -0
- package/dist/esm/protocol/MRP.js +76 -0
- package/dist/esm/protocol/MRP.js.map +6 -0
- package/dist/esm/protocol/MessageChannel.d.ts +0 -23
- package/dist/esm/protocol/MessageChannel.d.ts.map +1 -1
- package/dist/esm/protocol/MessageChannel.js +16 -54
- package/dist/esm/protocol/MessageChannel.js.map +2 -2
- package/dist/esm/protocol/MessageExchange.d.ts.map +1 -1
- package/dist/esm/protocol/MessageExchange.js +3 -3
- package/dist/esm/protocol/MessageExchange.js.map +1 -1
- package/dist/esm/protocol/index.d.ts +1 -0
- package/dist/esm/protocol/index.d.ts.map +1 -1
- package/dist/esm/protocol/index.js +1 -0
- package/dist/esm/protocol/index.js.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 -0
- package/dist/esm/session/Session.d.ts.map +1 -1
- package/dist/esm/session/case/CaseClient.d.ts.map +1 -1
- package/dist/esm/session/case/CaseClient.js +2 -2
- package/dist/esm/session/case/CaseClient.js.map +1 -1
- package/dist/esm/session/case/CaseServer.d.ts.map +1 -1
- package/dist/esm/session/case/CaseServer.js +4 -1
- package/dist/esm/session/case/CaseServer.js.map +1 -1
- package/package.json +6 -6
- package/src/action/client/ClientInteraction.ts +62 -6
- package/src/action/client/QueuedClientInteraction.ts +0 -1
- package/src/action/client/subscription/ClientSubscriptionHandler.ts +5 -2
- package/src/action/server/AttributeWriteResponse.ts +4 -16
- package/src/action/server/DataResponse.ts +8 -0
- package/src/action/server/ServerInteraction.ts +2 -2
- package/src/dcl/DclCertificateService.ts +3 -0
- package/src/dcl/DclOtaUpdateService.ts +11 -5
- package/src/interaction/InteractionMessenger.ts +113 -15
- package/src/mdns/MdnsClient.ts +216 -104
- package/src/mdns/MdnsServer.ts +79 -6
- package/src/peer/ControllerCommissioningFlow.ts +5 -1
- package/src/peer/Peer.ts +28 -5
- package/src/peer/PeerAddressStore.ts +1 -19
- package/src/peer/PeerDescriptor.ts +1 -15
- package/src/peer/PeerSet.ts +82 -35
- package/src/protocol/ExchangeManager.ts +5 -2
- package/src/protocol/ExchangeProvider.ts +3 -3
- package/src/protocol/MRP.ts +146 -0
- package/src/protocol/MessageChannel.ts +16 -101
- package/src/protocol/MessageExchange.ts +4 -3
- package/src/protocol/index.ts +1 -0
- package/src/session/NodeSession.ts +3 -3
- package/src/session/Session.ts +1 -0
- package/src/session/case/CaseClient.ts +8 -2
- package/src/session/case/CaseServer.ts +4 -0
|
@@ -6,60 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
import { Message, MessageCodec } from "#codec/MessageCodec.js";
|
|
8
8
|
import { Mark } from "#common/Mark.js";
|
|
9
|
-
import {
|
|
10
|
-
Bytes,
|
|
11
|
-
Channel,
|
|
12
|
-
Diagnostic,
|
|
13
|
-
Duration,
|
|
14
|
-
IpNetworkChannel,
|
|
15
|
-
Logger,
|
|
16
|
-
MatterFlowError,
|
|
17
|
-
MaybePromise,
|
|
18
|
-
Millis,
|
|
19
|
-
Seconds,
|
|
20
|
-
} from "#general";
|
|
9
|
+
import { Bytes, Channel, Diagnostic, Duration, IpNetworkChannel, Logger, MaybePromise } from "#general";
|
|
21
10
|
import type { ExchangeLogContext } from "#protocol/MessageExchange.js";
|
|
22
11
|
import type { Session } from "#session/Session.js";
|
|
23
12
|
import type { SessionParameters } from "#session/SessionParameters.js";
|
|
13
|
+
import { MRP } from "./MRP.js";
|
|
24
14
|
|
|
25
15
|
const logger = new Logger("MessageChannel");
|
|
26
16
|
|
|
27
|
-
/**
|
|
28
|
-
* Default expected processing time for a messages in milliseconds. The value is derived from kExpectedIMProcessingTime
|
|
29
|
-
* from chip implementation. This is basically the default used with different names, also kExpectedLowProcessingTime or
|
|
30
|
-
* kExpectedSigma1ProcessingTime.
|
|
31
|
-
*/
|
|
32
|
-
export const DEFAULT_EXPECTED_PROCESSING_TIME = Seconds(2);
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* The buffer time in milliseconds to add to the peer response time to also consider network delays and other factors.
|
|
36
|
-
* TODO: This is a pure guess and should be adjusted in the future.
|
|
37
|
-
*/
|
|
38
|
-
const PEER_RESPONSE_TIME_BUFFER = Seconds(5);
|
|
39
|
-
|
|
40
|
-
export namespace MRP {
|
|
41
|
-
/**
|
|
42
|
-
* The maximum number of transmission attempts for a given reliable message. The sender MAY choose this value as it
|
|
43
|
-
* sees fit.
|
|
44
|
-
*/
|
|
45
|
-
export const MAX_TRANSMISSIONS = 5;
|
|
46
|
-
|
|
47
|
-
/** The base number for the exponential backoff equation. */
|
|
48
|
-
export const BACKOFF_BASE = 1.6;
|
|
49
|
-
|
|
50
|
-
/** The scaler for random jitter in the backoff equation. */
|
|
51
|
-
export const BACKOFF_JITTER = 0.25;
|
|
52
|
-
|
|
53
|
-
/** The scaler margin increase to backoff over the peer sleepy interval. */
|
|
54
|
-
export const BACKOFF_MARGIN = 1.1;
|
|
55
|
-
|
|
56
|
-
/** The number of retransmissions before transitioning from linear to exponential backoff. */
|
|
57
|
-
export const BACKOFF_THRESHOLD = 1;
|
|
58
|
-
|
|
59
|
-
/** @see {@link MatterSpecification.v12.Core}, section 4.11.8 */
|
|
60
|
-
export const STANDALONE_ACK_TIMEOUT = Millis(200);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
17
|
export class MessageChannel implements Channel<Message> {
|
|
64
18
|
public closed = false;
|
|
65
19
|
#onClose?: () => MaybePromise<void>;
|
|
@@ -135,35 +89,16 @@ export class MessageChannel implements Channel<Message> {
|
|
|
135
89
|
calculateMaximumPeerResponseTime(
|
|
136
90
|
peerSessionParameters: SessionParameters,
|
|
137
91
|
localSessionParameters: SessionParameters,
|
|
138
|
-
expectedProcessingTime
|
|
92
|
+
expectedProcessingTime?: Duration,
|
|
139
93
|
): Duration {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
throw new MatterFlowError("No response expected for this message exchange because UDP and no MRP.");
|
|
149
|
-
}
|
|
150
|
-
// Calculate the maximum time till the peer got our last retry and worst case for the way back
|
|
151
|
-
return Millis(
|
|
152
|
-
this.#calculateMrpMaximumPeerResponseTime(peerSessionParameters) +
|
|
153
|
-
this.#calculateMrpMaximumPeerResponseTime(localSessionParameters) +
|
|
154
|
-
expectedProcessingTime +
|
|
155
|
-
PEER_RESPONSE_TIME_BUFFER,
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
case "ble":
|
|
159
|
-
// chip sdk uses BTP_ACK_TIMEOUT_MS which is wrong in my eyes, so we use static 30s as like TCP here
|
|
160
|
-
return Millis(Seconds(30) + PEER_RESPONSE_TIME_BUFFER);
|
|
161
|
-
|
|
162
|
-
default:
|
|
163
|
-
throw new MatterFlowError(
|
|
164
|
-
`Can not calculate expected timeout for unknown channel type: ${this.channel.type}`,
|
|
165
|
-
);
|
|
166
|
-
}
|
|
94
|
+
return MRP.maxPeerResponseTimeOf({
|
|
95
|
+
peerSessionParameters,
|
|
96
|
+
localSessionParameters,
|
|
97
|
+
channelType: this.channel.type,
|
|
98
|
+
isPeerActive: this.session.isPeerActive,
|
|
99
|
+
usesMrp: this.session.usesMrp,
|
|
100
|
+
expectedProcessingTime,
|
|
101
|
+
});
|
|
167
102
|
}
|
|
168
103
|
|
|
169
104
|
/**
|
|
@@ -175,30 +110,10 @@ export class MessageChannel implements Channel<Message> {
|
|
|
175
110
|
* @see {@link MatterSpecification.v10.Core}, section 4.11.2.1
|
|
176
111
|
*/
|
|
177
112
|
getMrpResubmissionBackOffTime(retransmissionCount: number, sessionParameters?: SessionParameters) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
return Millis.floor(
|
|
184
|
-
Millis(
|
|
185
|
-
baseInterval *
|
|
186
|
-
MRP.BACKOFF_MARGIN *
|
|
187
|
-
Math.pow(MRP.BACKOFF_BASE, Math.max(0, retransmissionCount - MRP.BACKOFF_THRESHOLD)) *
|
|
188
|
-
(1 + (sessionParameters !== undefined ? 1 : Math.random()) * MRP.BACKOFF_JITTER),
|
|
189
|
-
),
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/** Calculates the maximum time the peer might take to respond when using MRP for one direction. */
|
|
194
|
-
#calculateMrpMaximumPeerResponseTime(sessionParameters: SessionParameters) {
|
|
195
|
-
let finalWaitTime = 0;
|
|
196
|
-
|
|
197
|
-
// and then add the time the other side needs for a full resubmission cycle under the assumption we are active
|
|
198
|
-
for (let i = 0; i < MRP.MAX_TRANSMISSIONS; i++) {
|
|
199
|
-
finalWaitTime = Millis(finalWaitTime + this.getMrpResubmissionBackOffTime(i, sessionParameters));
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return finalWaitTime;
|
|
113
|
+
return MRP.maxRetransmissionIntervalOf({
|
|
114
|
+
transmissionNumber: retransmissionCount,
|
|
115
|
+
sessionParameters: sessionParameters ?? this.session.parameters,
|
|
116
|
+
isPeerActive: this.session.isPeerActive,
|
|
117
|
+
});
|
|
203
118
|
}
|
|
204
119
|
}
|
|
@@ -37,7 +37,8 @@ import {
|
|
|
37
37
|
StatusResponseError,
|
|
38
38
|
} from "#types";
|
|
39
39
|
import { RetransmissionLimitReachedError, SessionClosedError, UnexpectedMessageError } from "./errors.js";
|
|
40
|
-
import {
|
|
40
|
+
import { MessageChannel } from "./MessageChannel.js";
|
|
41
|
+
import { MRP } from "./MRP.js";
|
|
41
42
|
|
|
42
43
|
const logger = Logger.get("MessageExchange");
|
|
43
44
|
|
|
@@ -311,7 +312,7 @@ export class MessageExchange {
|
|
|
311
312
|
// Ignore if this is a standalone ack, probably this was a retransmission.
|
|
312
313
|
} else {
|
|
313
314
|
throw new MatterFlowError(
|
|
314
|
-
`Incorrect ack received. Expected ${sentMessageIdToAck}, received: ${ackedMessageId}`,
|
|
315
|
+
`Incorrect ack received. Expected ${hex.fixed(sentMessageIdToAck, 8)}, received: ${hex.fixed(ackedMessageId, 8)}`,
|
|
315
316
|
);
|
|
316
317
|
}
|
|
317
318
|
} else {
|
|
@@ -349,7 +350,7 @@ export class MessageExchange {
|
|
|
349
350
|
const {
|
|
350
351
|
expectAckOnly = false,
|
|
351
352
|
disableMrpLogic,
|
|
352
|
-
expectedProcessingTime = DEFAULT_EXPECTED_PROCESSING_TIME,
|
|
353
|
+
expectedProcessingTime = MRP.DEFAULT_EXPECTED_PROCESSING_TIME,
|
|
353
354
|
includeAcknowledgeMessageId,
|
|
354
355
|
logContext,
|
|
355
356
|
protocolId = this.#protocolId,
|
package/src/protocol/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./MessageChannel.js";
|
|
|
13
13
|
export * from "./MessageCounter.js";
|
|
14
14
|
export * from "./MessageExchange.js";
|
|
15
15
|
export * from "./MessageReceptionState.js";
|
|
16
|
+
export * from "./MRP.js";
|
|
16
17
|
export * from "./ProtocolHandler.js";
|
|
17
18
|
export * from "./ProtocolMocks.js";
|
|
18
19
|
export * from "./ProtocolStatusMessage.js";
|
|
@@ -125,14 +125,14 @@ export class NodeSession extends SecureSession {
|
|
|
125
125
|
this.#caseAuthenticatedTags = caseAuthenticatedTags ?? [];
|
|
126
126
|
this.#isInitiator = isInitiator;
|
|
127
127
|
|
|
128
|
-
manager?.sessions.add(this);
|
|
129
|
-
fabric?.addSession(this);
|
|
130
|
-
|
|
131
128
|
logger.debug(
|
|
132
129
|
`Created secure ${this.isPase ? "PASE" : "CASE"} session for fabric index ${fabric?.fabricIndex}`,
|
|
133
130
|
this.via,
|
|
134
131
|
this.parameterDiagnostics,
|
|
135
132
|
);
|
|
133
|
+
|
|
134
|
+
manager?.sessions.add(this);
|
|
135
|
+
fabric?.addSession(this);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
get parameterDiagnostics() {
|
package/src/session/Session.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { Icac } from "#certificate/kinds/Icac.js";
|
|
8
8
|
import { Noc } from "#certificate/kinds/Noc.js";
|
|
9
9
|
import { Fabric } from "#fabric/Fabric.js";
|
|
10
|
-
import { Bytes, Duration, EcdsaSignature, Logger, PublicKey, UnexpectedDataError } from "#general";
|
|
10
|
+
import { AbortedError, Bytes, Duration, EcdsaSignature, Logger, PublicKey, UnexpectedDataError } from "#general";
|
|
11
11
|
import { MessageExchange } from "#protocol/MessageExchange.js";
|
|
12
12
|
import { RetransmissionLimitReachedError } from "#protocol/errors.js";
|
|
13
13
|
import { ChannelStatusResponseError } from "#securechannel/SecureChannelMessenger.js";
|
|
@@ -45,7 +45,13 @@ export class CaseClient {
|
|
|
45
45
|
try {
|
|
46
46
|
return await this.#doPair(messenger, exchange, fabric, peerNodeId, caseAuthenticatedTags);
|
|
47
47
|
} catch (error) {
|
|
48
|
-
if (
|
|
48
|
+
if (
|
|
49
|
+
!(
|
|
50
|
+
error instanceof ChannelStatusResponseError ||
|
|
51
|
+
error instanceof RetransmissionLimitReachedError ||
|
|
52
|
+
error instanceof AbortedError
|
|
53
|
+
)
|
|
54
|
+
) {
|
|
49
55
|
await messenger.sendError(SecureChannelStatusCode.InvalidParam);
|
|
50
56
|
}
|
|
51
57
|
throw error;
|
|
@@ -153,6 +153,7 @@ export class CaseServer implements ProtocolHandler {
|
|
|
153
153
|
isResumption: true,
|
|
154
154
|
peerSessionParameters: cx.peerSessionParams,
|
|
155
155
|
caseAuthenticatedTags,
|
|
156
|
+
delayManagerRegistration: true, // Session establishment could still fail, so add session ourselves to the manager
|
|
156
157
|
});
|
|
157
158
|
|
|
158
159
|
// Generate sigma 2 resume
|
|
@@ -173,8 +174,11 @@ export class CaseServer implements ProtocolHandler {
|
|
|
173
174
|
throw error;
|
|
174
175
|
}
|
|
175
176
|
|
|
177
|
+
// Now we are sure, add the session to the manager
|
|
176
178
|
NodeSession.logNew(logger, "Resumed", secureSession, cx.messenger, fabric, peerNodeId);
|
|
177
179
|
|
|
180
|
+
this.#sessions.sessions.add(secureSession);
|
|
181
|
+
|
|
178
182
|
cx.resumptionRecord.resumptionId = cx.localResumptionId; /* Update the ID */
|
|
179
183
|
|
|
180
184
|
// Wait for success on the peer side
|