@matter/node 0.16.0-alpha.0-20250814-484abe647 → 0.16.0-alpha.0-20250816-d22ad240d
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/behavior/state/validation/assertions.d.ts +2 -2
- package/dist/cjs/behavior/state/validation/assertions.d.ts.map +1 -1
- package/dist/cjs/behavior/state/validation/assertions.js +2 -2
- package/dist/cjs/behavior/state/validation/assertions.js.map +1 -1
- package/dist/cjs/behavior/state/validation/constraint.js +6 -4
- package/dist/cjs/behavior/state/validation/constraint.js.map +1 -1
- package/dist/cjs/behavior/system/commissioning/CommissioningServer.d.ts +1 -1
- package/dist/cjs/behavior/system/commissioning/CommissioningServer.d.ts.map +1 -1
- package/dist/cjs/behavior/system/commissioning/CommissioningServer.js.map +1 -1
- package/dist/cjs/behaviors/access-control/AccessControlServer.d.ts.map +1 -1
- package/dist/cjs/behaviors/access-control/AccessControlServer.js +2 -1
- package/dist/cjs/behaviors/access-control/AccessControlServer.js.map +1 -1
- package/dist/cjs/behaviors/administrator-commissioning/AdministratorCommissioningServer.js +2 -2
- package/dist/cjs/behaviors/administrator-commissioning/AdministratorCommissioningServer.js.map +1 -1
- package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts +2 -2
- package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts.map +1 -1
- package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.js +8 -5
- package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.js.map +1 -1
- package/dist/cjs/behaviors/groups/GroupsServer.d.ts.map +1 -1
- package/dist/cjs/behaviors/groups/GroupsServer.js +6 -2
- package/dist/cjs/behaviors/groups/GroupsServer.js.map +1 -1
- package/dist/cjs/behaviors/network-commissioning/NetworkCommissioningBehavior.d.ts +19 -19
- package/dist/cjs/behaviors/operational-credentials/OperationalCredentialsServer.d.ts +5 -5
- package/dist/cjs/behaviors/operational-credentials/OperationalCredentialsServer.js +2 -2
- package/dist/cjs/behaviors/operational-credentials/OperationalCredentialsServer.js.map +1 -1
- package/dist/cjs/behaviors/rvc-run-mode/RvcRunModeServer.d.ts.map +1 -1
- package/dist/cjs/behaviors/rvc-run-mode/RvcRunModeServer.js +0 -5
- package/dist/cjs/behaviors/rvc-run-mode/RvcRunModeServer.js.map +1 -1
- package/dist/cjs/behaviors/thermostat/ThermostatBehavior.d.ts +8 -8
- package/dist/cjs/devices/water-heater.d.ts +16 -16
- package/dist/cjs/node/server/InteractionServer.js +2 -2
- package/dist/esm/behavior/state/validation/assertions.d.ts +2 -2
- package/dist/esm/behavior/state/validation/assertions.d.ts.map +1 -1
- package/dist/esm/behavior/state/validation/assertions.js +3 -3
- package/dist/esm/behavior/state/validation/assertions.js.map +1 -1
- package/dist/esm/behavior/state/validation/constraint.js +6 -4
- package/dist/esm/behavior/state/validation/constraint.js.map +1 -1
- package/dist/esm/behavior/system/commissioning/CommissioningServer.d.ts +1 -1
- package/dist/esm/behavior/system/commissioning/CommissioningServer.d.ts.map +1 -1
- package/dist/esm/behavior/system/commissioning/CommissioningServer.js.map +1 -1
- package/dist/esm/behaviors/access-control/AccessControlServer.d.ts.map +1 -1
- package/dist/esm/behaviors/access-control/AccessControlServer.js +3 -2
- package/dist/esm/behaviors/access-control/AccessControlServer.js.map +1 -1
- package/dist/esm/behaviors/administrator-commissioning/AdministratorCommissioningServer.js +2 -2
- package/dist/esm/behaviors/administrator-commissioning/AdministratorCommissioningServer.js.map +1 -1
- package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts +2 -2
- package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts.map +1 -1
- package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.js +8 -5
- package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.js.map +1 -1
- package/dist/esm/behaviors/groups/GroupsServer.d.ts.map +1 -1
- package/dist/esm/behaviors/groups/GroupsServer.js +6 -2
- package/dist/esm/behaviors/groups/GroupsServer.js.map +1 -1
- package/dist/esm/behaviors/network-commissioning/NetworkCommissioningBehavior.d.ts +19 -19
- package/dist/esm/behaviors/operational-credentials/OperationalCredentialsServer.d.ts +5 -5
- package/dist/esm/behaviors/operational-credentials/OperationalCredentialsServer.js +2 -2
- package/dist/esm/behaviors/operational-credentials/OperationalCredentialsServer.js.map +1 -1
- package/dist/esm/behaviors/rvc-run-mode/RvcRunModeServer.d.ts.map +1 -1
- package/dist/esm/behaviors/rvc-run-mode/RvcRunModeServer.js +0 -5
- package/dist/esm/behaviors/rvc-run-mode/RvcRunModeServer.js.map +1 -1
- package/dist/esm/behaviors/thermostat/ThermostatBehavior.d.ts +8 -8
- package/dist/esm/devices/water-heater.d.ts +16 -16
- package/dist/esm/node/server/InteractionServer.js +2 -2
- package/package.json +7 -7
- package/src/behavior/state/validation/assertions.ts +5 -5
- package/src/behavior/state/validation/constraint.ts +6 -4
- package/src/behavior/system/commissioning/CommissioningServer.ts +1 -1
- package/src/behaviors/access-control/AccessControlServer.ts +7 -2
- package/src/behaviors/administrator-commissioning/AdministratorCommissioningServer.ts +2 -2
- package/src/behaviors/general-diagnostics/GeneralDiagnosticsServer.ts +10 -7
- package/src/behaviors/groups/GroupsServer.ts +6 -2
- package/src/behaviors/operational-credentials/OperationalCredentialsServer.ts +2 -2
- package/src/behaviors/rvc-run-mode/RvcRunModeServer.ts +0 -7
- package/src/node/server/InteractionServer.ts +2 -2
|
@@ -579,7 +579,7 @@ class InteractionServer {
|
|
|
579
579
|
// Assume for now we have multiple responses when having multiple invokes
|
|
580
580
|
};
|
|
581
581
|
const emptyInvokeResponseBytes = TlvInvokeResponseForSend.encode(invokeResponseMessage);
|
|
582
|
-
let messageSize = emptyInvokeResponseBytes.
|
|
582
|
+
let messageSize = emptyInvokeResponseBytes.byteLength;
|
|
583
583
|
let invokeResultsProcessed = 0;
|
|
584
584
|
const processResponseResult = async (invokeResponse) => {
|
|
585
585
|
invokeResultsProcessed++;
|
|
@@ -617,7 +617,7 @@ class InteractionServer {
|
|
|
617
617
|
}
|
|
618
618
|
);
|
|
619
619
|
invokeResponseMessage.invokeResponses = [];
|
|
620
|
-
messageSize = emptyInvokeResponseBytes.
|
|
620
|
+
messageSize = emptyInvokeResponseBytes.byteLength;
|
|
621
621
|
}
|
|
622
622
|
if (!lastMessageProcessed) {
|
|
623
623
|
invokeResultsProcessed--;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matter/node",
|
|
3
|
-
"version": "0.16.0-alpha.0-
|
|
3
|
+
"version": "0.16.0-alpha.0-20250816-d22ad240d",
|
|
4
4
|
"description": "API for building Matter nodes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"iot",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"#*": "./src/*"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@matter/general": "0.16.0-alpha.0-
|
|
46
|
-
"@matter/model": "0.16.0-alpha.0-
|
|
47
|
-
"@matter/types": "0.16.0-alpha.0-
|
|
48
|
-
"@matter/protocol": "0.16.0-alpha.0-
|
|
45
|
+
"@matter/general": "0.16.0-alpha.0-20250816-d22ad240d",
|
|
46
|
+
"@matter/model": "0.16.0-alpha.0-20250816-d22ad240d",
|
|
47
|
+
"@matter/types": "0.16.0-alpha.0-20250816-d22ad240d",
|
|
48
|
+
"@matter/protocol": "0.16.0-alpha.0-20250816-d22ad240d"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@matter/tools": "0.16.0-alpha.0-
|
|
52
|
-
"@matter/testing": "0.16.0-alpha.0-
|
|
51
|
+
"@matter/tools": "0.16.0-alpha.0-20250816-d22ad240d",
|
|
52
|
+
"@matter/testing": "0.16.0-alpha.0-20250816-d22ad240d"
|
|
53
53
|
},
|
|
54
54
|
"files": [
|
|
55
55
|
"dist/**/*",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { isObject } from "#general";
|
|
7
|
+
import { Bytes, isObject } from "#general";
|
|
8
8
|
import { SchemaErrorPath } from "#model";
|
|
9
9
|
import { DatatypeError, Val } from "#protocol";
|
|
10
10
|
|
|
@@ -43,15 +43,15 @@ export function assertString(value: Val, path: SchemaErrorPath): asserts value i
|
|
|
43
43
|
throw new DatatypeError(path, "a string", value);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export function assertBytes(value: Val, path: SchemaErrorPath): asserts value is
|
|
47
|
-
if (value
|
|
46
|
+
export function assertBytes(value: Val, path: SchemaErrorPath): asserts value is BufferSource {
|
|
47
|
+
if (Bytes.isBytes(value)) {
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
throw new DatatypeError(path, "a byte array", value);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export function assertSequence(value: Val, path: SchemaErrorPath): asserts value is string |
|
|
54
|
-
if (typeof value === "string" || value
|
|
53
|
+
export function assertSequence(value: Val, path: SchemaErrorPath): asserts value is string | BufferSource {
|
|
54
|
+
if (typeof value === "string" || Bytes.isBytes(value)) {
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
throw new DatatypeError(path, "a string or byte array", value);
|
|
@@ -97,11 +97,12 @@ function create(
|
|
|
97
97
|
case Metatype.string: {
|
|
98
98
|
const validateLength: ValueSupervisor.Validate = (value: Val, _session, location) => {
|
|
99
99
|
assertSequence(value, location);
|
|
100
|
-
|
|
100
|
+
const length = typeof value === "string" ? value.length : value.byteLength;
|
|
101
|
+
if (!constraint.test(length, nameResolverFactory(location))) {
|
|
101
102
|
throw new ConstraintError(
|
|
102
103
|
schema,
|
|
103
104
|
location,
|
|
104
|
-
`String length of ${
|
|
105
|
+
`String length of ${length} is not within bounds defined by constraint`,
|
|
105
106
|
);
|
|
106
107
|
}
|
|
107
108
|
};
|
|
@@ -129,11 +130,12 @@ function create(
|
|
|
129
130
|
case Metatype.bytes:
|
|
130
131
|
return (value: Val, _session, location) => {
|
|
131
132
|
assertSequence(value, location);
|
|
132
|
-
|
|
133
|
+
const length = typeof value === "string" ? value.length : value.byteLength;
|
|
134
|
+
if (!constraint.test(length, nameResolverFactory(location))) {
|
|
133
135
|
throw new ConstraintError(
|
|
134
136
|
schema,
|
|
135
137
|
location,
|
|
136
|
-
`Byte length of ${
|
|
138
|
+
`Byte length of ${length} is not within bounds defined by constraint`,
|
|
137
139
|
);
|
|
138
140
|
}
|
|
139
141
|
};
|
|
@@ -374,7 +374,7 @@ export namespace CommissioningServer {
|
|
|
374
374
|
passcode = -1;
|
|
375
375
|
discriminator = -1;
|
|
376
376
|
flowType = CommissioningFlowType.Standard;
|
|
377
|
-
additionalBleAdvertisementData?:
|
|
377
|
+
additionalBleAdvertisementData?: BufferSource = undefined;
|
|
378
378
|
pairingCodes = {} as PairingCodes;
|
|
379
379
|
mdns?: MdnsAdvertiser.Options;
|
|
380
380
|
ble?: BleAdvertiser.Options;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { ActionContext } from "#behavior/context/ActionContext.js";
|
|
8
8
|
import { AccessControl as AccessControlTypes } from "#clusters/access-control";
|
|
9
|
-
import { deepCopy, InternalError, Logger, MaybePromise } from "#general";
|
|
9
|
+
import { Bytes, deepCopy, InternalError, Logger, MaybePromise } from "#general";
|
|
10
10
|
import { NodeLifecycle } from "#node/NodeLifecycle.js";
|
|
11
11
|
import {
|
|
12
12
|
AccessControl,
|
|
@@ -401,7 +401,12 @@ export class AccessControlServer extends AccessControlBehavior.with("Extension")
|
|
|
401
401
|
*/
|
|
402
402
|
protected extensionEntryValidator(extension: AccessControlTypes.AccessControlExtension) {
|
|
403
403
|
const { data } = extension;
|
|
404
|
-
|
|
404
|
+
const extensionBytes = Bytes.of(data);
|
|
405
|
+
if (
|
|
406
|
+
extensionBytes.length < 2 ||
|
|
407
|
+
extensionBytes[0] !== TlvType.List ||
|
|
408
|
+
extensionBytes[extensionBytes.length - 1] !== TlvType.EndOfContainer
|
|
409
|
+
) {
|
|
405
410
|
// Easier to check that way that it is an Listen without any tags in general
|
|
406
411
|
throw new StatusResponseError("Extension must be a valid TLV", StatusCode.ConstraintError);
|
|
407
412
|
}
|
|
@@ -74,13 +74,13 @@ export class AdministratorCommissioningServer extends AdministratorCommissioning
|
|
|
74
74
|
commissioningTimeout,
|
|
75
75
|
}: AdministratorCommissioning.OpenCommissioningWindowRequest) {
|
|
76
76
|
// We monkey patched the Tlv definition above, so take care about correct error handling
|
|
77
|
-
if (pakePasscodeVerifier.
|
|
77
|
+
if (pakePasscodeVerifier.byteLength !== PAKE_PASSCODE_VERIFIER_LENGTH) {
|
|
78
78
|
throw new AdministratorCommissioning.PakeParameterError("PAKE passcode verifier length is invalid");
|
|
79
79
|
}
|
|
80
80
|
if (iterations < 1000 || iterations > 100_000) {
|
|
81
81
|
throw new AdministratorCommissioning.PakeParameterError("PAKE iterations invalid");
|
|
82
82
|
}
|
|
83
|
-
if (salt.
|
|
83
|
+
if (salt.byteLength < 16 || salt.byteLength > 32) {
|
|
84
84
|
throw new AdministratorCommissioning.PakeParameterError("PAKE salt has invalid length.");
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -53,7 +53,8 @@ export class GeneralDiagnosticsServer extends Base {
|
|
|
53
53
|
if (this.state.testEventTriggersEnabled === undefined) {
|
|
54
54
|
this.state.testEventTriggersEnabled = false;
|
|
55
55
|
} else if (this.state.testEventTriggersEnabled) {
|
|
56
|
-
|
|
56
|
+
const enableKey = Bytes.of(this.state.deviceTestEnableKey);
|
|
57
|
+
if (enableKey.every(byte => byte === 0)) {
|
|
57
58
|
throw new ImplementationError("Test event triggers are enabled but no deviceTestEnableKey is set.");
|
|
58
59
|
}
|
|
59
60
|
logger.warn("Test event triggers are enabled. Make sure to disable them in production.");
|
|
@@ -80,12 +81,14 @@ export class GeneralDiagnosticsServer extends Base {
|
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
#validateTestEnabledKey(enableKey:
|
|
84
|
-
|
|
84
|
+
#validateTestEnabledKey(enableKey: Bytes) {
|
|
85
|
+
const keyData = Bytes.of(enableKey);
|
|
86
|
+
if (keyData.every(byte => byte === 0)) {
|
|
85
87
|
throw new StatusResponseError("Invalid test enable key, all zeros", StatusCode.ConstraintError);
|
|
86
88
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
const expectedKeyData = Bytes.of(this.state.deviceTestEnableKey);
|
|
90
|
+
keyData.forEach((byte, index) => {
|
|
91
|
+
if (byte !== expectedKeyData[index]) {
|
|
89
92
|
throw new StatusResponseError("Invalid test enable key", StatusCode.ConstraintError);
|
|
90
93
|
}
|
|
91
94
|
});
|
|
@@ -154,7 +157,7 @@ export class GeneralDiagnosticsServer extends Base {
|
|
|
154
157
|
},
|
|
155
158
|
},
|
|
156
159
|
],
|
|
157
|
-
}).
|
|
160
|
+
}).byteLength;
|
|
158
161
|
|
|
159
162
|
const exchange = this.context.exchange;
|
|
160
163
|
if (exchange === undefined) {
|
|
@@ -390,7 +393,7 @@ export namespace GeneralDiagnosticsServer {
|
|
|
390
393
|
totalOperationalHoursCounter: number = 0;
|
|
391
394
|
|
|
392
395
|
/** The TestEnableKey set for this device for the test commands. Default means "not enabled"." */
|
|
393
|
-
deviceTestEnableKey = new Uint8Array(16).fill(0);
|
|
396
|
+
deviceTestEnableKey: Bytes = new Uint8Array(16).fill(0);
|
|
394
397
|
|
|
395
398
|
[Val.properties](endpoint: Endpoint, _session: ValueSupervisor.Session) {
|
|
396
399
|
return {
|
|
@@ -75,8 +75,12 @@ export class GroupsServer extends GroupsBase {
|
|
|
75
75
|
return rootEndpoint;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
#actOnGroupKeyManagement(act: (groupKeyManagement: GroupKeyManagementServer) =>
|
|
79
|
-
|
|
78
|
+
async #actOnGroupKeyManagement<T>(act: (groupKeyManagement: GroupKeyManagementServer) => T): Promise<T> {
|
|
79
|
+
const agent = this.context.agentFor(this.#rootEndpoint());
|
|
80
|
+
const gkm = agent.get(GroupKeyManagementServer);
|
|
81
|
+
await agent.context.transaction.addResources(gkm);
|
|
82
|
+
await agent.context.transaction.begin();
|
|
83
|
+
return act(gkm);
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
override async addGroup({ groupId, groupName }: Groups.AddGroupRequest): Promise<Groups.AddGroupResponse> {
|
|
@@ -94,7 +94,7 @@ export class OperationalCredentialsServer extends OperationalCredentialsBehavior
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
override async attestationRequest({ attestationNonce }: OperationalCredentials.AttestationRequest) {
|
|
97
|
-
if (attestationNonce.
|
|
97
|
+
if (attestationNonce.byteLength !== 32) {
|
|
98
98
|
throw new StatusResponseError("Invalid attestation nonce length", StatusCode.InvalidCommand);
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -115,7 +115,7 @@ export class OperationalCredentialsServer extends OperationalCredentialsBehavior
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
override async csrRequest({ csrNonce, isForUpdateNoc }: OperationalCredentials.CsrRequest) {
|
|
118
|
-
if (csrNonce.
|
|
118
|
+
if (csrNonce.byteLength !== 32) {
|
|
119
119
|
throw new StatusResponseError("Invalid csr nonce length", StatusCode.InvalidCommand);
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -36,13 +36,6 @@ export class RvcRunModeServer extends RvcRunModeBehavior {
|
|
|
36
36
|
) {
|
|
37
37
|
throw new ImplementationError("Provided supportedModes need to include at least one Cleaning mode tag");
|
|
38
38
|
}
|
|
39
|
-
if (
|
|
40
|
-
!this.state.supportedModes.some(({ modeTags }) =>
|
|
41
|
-
modeTags.some(({ value }) => value === RvcRunMode.ModeTag.Cleaning),
|
|
42
|
-
)
|
|
43
|
-
) {
|
|
44
|
-
throw new ImplementationError("Provided supportedModes need to include at least one Cleaning mode tag");
|
|
45
|
-
}
|
|
46
39
|
if (
|
|
47
40
|
this.state.supportedModes.some(({ modeTags }) => {
|
|
48
41
|
let exclusiveModeCounter = 0;
|
|
@@ -714,7 +714,7 @@ export class InteractionServer implements ProtocolHandler, InteractionRecipient
|
|
|
714
714
|
moreChunkedMessages: invokeRequests.length > 1, // Assume for now we have multiple responses when having multiple invokes
|
|
715
715
|
};
|
|
716
716
|
const emptyInvokeResponseBytes = TlvInvokeResponseForSend.encode(invokeResponseMessage);
|
|
717
|
-
let messageSize = emptyInvokeResponseBytes.
|
|
717
|
+
let messageSize = emptyInvokeResponseBytes.byteLength;
|
|
718
718
|
let invokeResultsProcessed = 0;
|
|
719
719
|
|
|
720
720
|
// To lower potential latency when we would process all invoke messages and just send responses at the end we
|
|
@@ -766,7 +766,7 @@ export class InteractionServer implements ProtocolHandler, InteractionRecipient
|
|
|
766
766
|
},
|
|
767
767
|
);
|
|
768
768
|
invokeResponseMessage.invokeResponses = [];
|
|
769
|
-
messageSize = emptyInvokeResponseBytes.
|
|
769
|
+
messageSize = emptyInvokeResponseBytes.byteLength;
|
|
770
770
|
}
|
|
771
771
|
if (!lastMessageProcessed) {
|
|
772
772
|
invokeResultsProcessed--; // Correct counter again because we recall the method
|