@matter/node 0.16.11-alpha.0-20260228-3ee9c97df → 0.16.11
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/managed/Datasource.d.ts +2 -2
- package/dist/cjs/behavior/state/managed/Datasource.d.ts.map +1 -1
- package/dist/cjs/behavior/state/managed/Datasource.js +10 -11
- package/dist/cjs/behavior/state/managed/Datasource.js.map +1 -1
- package/dist/cjs/behavior/system/http/HttpInterface.js +1 -1
- package/dist/cjs/behavior/system/http/HttpInterface.js.map +1 -1
- package/dist/cjs/behavior/system/index.d.ts +0 -1
- package/dist/cjs/behavior/system/index.d.ts.map +1 -1
- package/dist/cjs/behavior/system/index.js +0 -1
- package/dist/cjs/behavior/system/index.js.map +1 -1
- package/dist/cjs/behavior/system/mqtt/MqttInterface.d.ts.map +1 -1
- package/dist/cjs/behavior/system/mqtt/MqttInterface.js +0 -2
- package/dist/cjs/behavior/system/mqtt/MqttInterface.js.map +1 -1
- package/dist/cjs/behavior/system/remote/RemoteInterface.d.ts +3 -11
- package/dist/cjs/behavior/system/remote/RemoteInterface.d.ts.map +1 -1
- package/dist/cjs/behavior/system/remote/RemoteInterface.js +9 -16
- package/dist/cjs/behavior/system/remote/RemoteInterface.js.map +1 -1
- package/dist/cjs/behavior/system/remote/RemoteServer.d.ts +0 -8
- package/dist/cjs/behavior/system/remote/RemoteServer.d.ts.map +1 -1
- package/dist/cjs/behavior/system/remote/RemoteServer.js +2 -58
- package/dist/cjs/behavior/system/remote/RemoteServer.js.map +1 -1
- package/dist/cjs/behavior/system/websocket/WebSocketInterface.js +1 -1
- package/dist/cjs/behavior/system/websocket/WebSocketInterface.js.map +1 -1
- package/dist/cjs/node/client/ClientStructure.d.ts.map +1 -1
- package/dist/cjs/node/client/ClientStructure.js +11 -9
- package/dist/cjs/node/client/ClientStructure.js.map +1 -1
- package/dist/cjs/storage/client/DatasourceCache.d.ts.map +1 -1
- package/dist/cjs/storage/client/DatasourceCache.js +4 -6
- package/dist/cjs/storage/client/DatasourceCache.js.map +1 -1
- package/dist/esm/behavior/state/managed/Datasource.d.ts +2 -2
- package/dist/esm/behavior/state/managed/Datasource.d.ts.map +1 -1
- package/dist/esm/behavior/state/managed/Datasource.js +10 -11
- package/dist/esm/behavior/state/managed/Datasource.js.map +1 -1
- package/dist/esm/behavior/system/http/HttpInterface.js +1 -1
- package/dist/esm/behavior/system/http/HttpInterface.js.map +1 -1
- package/dist/esm/behavior/system/index.d.ts +0 -1
- package/dist/esm/behavior/system/index.d.ts.map +1 -1
- package/dist/esm/behavior/system/index.js +0 -1
- package/dist/esm/behavior/system/index.js.map +1 -1
- package/dist/esm/behavior/system/mqtt/MqttInterface.d.ts.map +1 -1
- package/dist/esm/behavior/system/mqtt/MqttInterface.js +0 -2
- package/dist/esm/behavior/system/mqtt/MqttInterface.js.map +1 -1
- package/dist/esm/behavior/system/remote/RemoteInterface.d.ts +3 -11
- package/dist/esm/behavior/system/remote/RemoteInterface.d.ts.map +1 -1
- package/dist/esm/behavior/system/remote/RemoteInterface.js +9 -16
- package/dist/esm/behavior/system/remote/RemoteInterface.js.map +1 -1
- package/dist/esm/behavior/system/remote/RemoteServer.d.ts +0 -8
- package/dist/esm/behavior/system/remote/RemoteServer.d.ts.map +1 -1
- package/dist/esm/behavior/system/remote/RemoteServer.js +3 -72
- package/dist/esm/behavior/system/remote/RemoteServer.js.map +1 -1
- package/dist/esm/behavior/system/websocket/WebSocketInterface.js +1 -1
- package/dist/esm/behavior/system/websocket/WebSocketInterface.js.map +1 -1
- package/dist/esm/node/client/ClientStructure.d.ts.map +1 -1
- package/dist/esm/node/client/ClientStructure.js +11 -9
- package/dist/esm/node/client/ClientStructure.js.map +1 -1
- package/dist/esm/storage/client/DatasourceCache.d.ts.map +1 -1
- package/dist/esm/storage/client/DatasourceCache.js +4 -6
- package/dist/esm/storage/client/DatasourceCache.js.map +1 -1
- package/package.json +7 -7
- package/src/behavior/state/managed/Datasource.ts +16 -17
- package/src/behavior/system/http/HttpInterface.ts +1 -1
- package/src/behavior/system/index.ts +0 -1
- package/src/behavior/system/mqtt/MqttInterface.ts +0 -2
- package/src/behavior/system/remote/RemoteInterface.ts +12 -27
- package/src/behavior/system/remote/RemoteServer.ts +2 -79
- package/src/behavior/system/websocket/WebSocketInterface.ts +1 -1
- package/src/node/client/ClientStructure.ts +15 -11
- package/src/storage/client/DatasourceCache.ts +5 -7
- package/dist/cjs/behavior/system/dcl/DclBehavior.d.ts +0 -68
- package/dist/cjs/behavior/system/dcl/DclBehavior.d.ts.map +0 -1
- package/dist/cjs/behavior/system/dcl/DclBehavior.js +0 -88
- package/dist/cjs/behavior/system/dcl/DclBehavior.js.map +0 -6
- package/dist/cjs/behavior/system/dcl/index.d.ts +0 -7
- package/dist/cjs/behavior/system/dcl/index.d.ts.map +0 -1
- package/dist/cjs/behavior/system/dcl/index.js +0 -24
- package/dist/cjs/behavior/system/dcl/index.js.map +0 -6
- package/dist/esm/behavior/system/dcl/DclBehavior.d.ts +0 -68
- package/dist/esm/behavior/system/dcl/DclBehavior.d.ts.map +0 -1
- package/dist/esm/behavior/system/dcl/DclBehavior.js +0 -68
- package/dist/esm/behavior/system/dcl/DclBehavior.js.map +0 -6
- package/dist/esm/behavior/system/dcl/index.d.ts +0 -7
- package/dist/esm/behavior/system/dcl/index.d.ts.map +0 -1
- package/dist/esm/behavior/system/dcl/index.js +0 -7
- package/dist/esm/behavior/system/dcl/index.js.map +0 -6
- package/src/behavior/system/dcl/DclBehavior.ts +0 -103
- package/src/behavior/system/dcl/index.ts +0 -7
|
@@ -6,27 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
import { Behavior } from "#behavior/Behavior.js";
|
|
8
8
|
import { EndpointInitializer } from "#endpoint/properties/EndpointInitializer.js";
|
|
9
|
-
import {
|
|
10
|
-
AppAddress,
|
|
11
|
-
Crypto,
|
|
12
|
-
CurveType,
|
|
13
|
-
Diagnostic,
|
|
14
|
-
ImplementationError,
|
|
15
|
-
InternalError,
|
|
16
|
-
Key,
|
|
17
|
-
KeyType,
|
|
18
|
-
Logger,
|
|
19
|
-
X509,
|
|
20
|
-
X520,
|
|
21
|
-
X962,
|
|
22
|
-
} from "#general";
|
|
9
|
+
import { AppAddress, ImplementationError, InternalError } from "#general";
|
|
23
10
|
import { DatatypeModel, FieldElement } from "#model";
|
|
24
11
|
import type { ServerNode } from "#node/ServerNode.js";
|
|
25
12
|
import { ServerEndpointInitializer } from "#node/server/ServerEndpointInitializer.js";
|
|
26
13
|
import { RemoteInterface } from "./RemoteInterface.js";
|
|
27
14
|
|
|
28
|
-
const logger = Logger.get("RemoteServer");
|
|
29
|
-
|
|
30
15
|
/**
|
|
31
16
|
* Base class for {@link Behavior}s that enable remote access to a {@link ServerNode} via a non-Matter API.
|
|
32
17
|
*
|
|
@@ -48,14 +33,6 @@ export abstract class RemoteServer extends Behavior {
|
|
|
48
33
|
declare state: RemoteServer.State;
|
|
49
34
|
|
|
50
35
|
override async initialize() {
|
|
51
|
-
if (this.state.key === undefined) {
|
|
52
|
-
this.state.key = await this.#createKey();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (this.state.certificate === undefined) {
|
|
56
|
-
this.state.certificate = await this.#createCertificate(this.state.key);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
36
|
if (!(this.env.get(EndpointInitializer) instanceof ServerEndpointInitializer)) {
|
|
60
37
|
throw new ImplementationError("Remote server is not installed in a ServerNode");
|
|
61
38
|
}
|
|
@@ -87,17 +64,9 @@ export abstract class RemoteServer extends Behavior {
|
|
|
87
64
|
}
|
|
88
65
|
|
|
89
66
|
const address = new AppAddress(this.state.address);
|
|
90
|
-
const
|
|
91
|
-
const intf = await interfaceType.create({
|
|
92
|
-
node: this.endpoint as ServerNode,
|
|
93
|
-
address,
|
|
94
|
-
key,
|
|
95
|
-
certificate,
|
|
96
|
-
});
|
|
67
|
+
const intf = await interfaceType.create(this.endpoint as ServerNode, address);
|
|
97
68
|
|
|
98
69
|
this.internal.interface = intf;
|
|
99
|
-
|
|
100
|
-
logger.info("Listening on", Diagnostic.strong(intf.address));
|
|
101
70
|
}
|
|
102
71
|
|
|
103
72
|
async #stop() {
|
|
@@ -125,43 +94,7 @@ export abstract class RemoteServer extends Behavior {
|
|
|
125
94
|
FieldElement({ name: "address", type: "string" }),
|
|
126
95
|
FieldElement({ name: "enabled", type: "bool" }),
|
|
127
96
|
FieldElement({ name: "allowOfflineUse", type: "bool" }),
|
|
128
|
-
FieldElement({ name: "certificate", type: "octstr" }),
|
|
129
|
-
FieldElement({ name: "key", type: "octstr" }),
|
|
130
97
|
);
|
|
131
|
-
|
|
132
|
-
async #createKey() {
|
|
133
|
-
const key = await this.env.get(Crypto).createKeyPair();
|
|
134
|
-
if (key.pem === undefined) {
|
|
135
|
-
throw new InternalError("PEM form of new private key is missing");
|
|
136
|
-
}
|
|
137
|
-
return key.pem;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
async #createCertificate(pkcs8: string) {
|
|
141
|
-
const crypto = this.env.get(Crypto);
|
|
142
|
-
const key = Key({ pem: pkcs8, kty: KeyType.EC, crv: CurveType.p256 });
|
|
143
|
-
const notBefore = new Date();
|
|
144
|
-
const notAfter = new Date();
|
|
145
|
-
notAfter.setFullYear(notAfter.getFullYear() + 10);
|
|
146
|
-
const unsigned: X509.UnsignedCertificate = {
|
|
147
|
-
serialNumber: crypto.randomBytes(20),
|
|
148
|
-
subject: { commonName: X520.CommonName("localhost") },
|
|
149
|
-
validity: {
|
|
150
|
-
notBefore,
|
|
151
|
-
notAfter,
|
|
152
|
-
},
|
|
153
|
-
issuer: { commonName: X520.CommonName("matter.js") },
|
|
154
|
-
extensions: {
|
|
155
|
-
basicConstraints: {
|
|
156
|
-
isCa: true,
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
signatureAlgorithm: X962.EcdsaWithSHA256,
|
|
160
|
-
publicKey: X962.PublicKeyEcPrime256v1(key.publicBits!),
|
|
161
|
-
};
|
|
162
|
-
const certificate = await X509.sign(this.env.get(Crypto), key, unsigned);
|
|
163
|
-
return X509.certificateToPem(certificate);
|
|
164
|
-
}
|
|
165
98
|
}
|
|
166
99
|
|
|
167
100
|
export namespace RemoteServer {
|
|
@@ -195,15 +128,5 @@ export namespace RemoteServer {
|
|
|
195
128
|
* also online.
|
|
196
129
|
*/
|
|
197
130
|
allowOfflineUse = true;
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Certificate for encrypted endpoints in PEM format.
|
|
201
|
-
*/
|
|
202
|
-
certificate?: string;
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Private key for encrypted endpoints in PEM format.
|
|
206
|
-
*/
|
|
207
|
-
key?: string;
|
|
208
131
|
}
|
|
209
132
|
}
|
|
@@ -25,7 +25,7 @@ export class WebSocketInterface extends RemoteInterface {
|
|
|
25
25
|
#mutex = new Mutex(this);
|
|
26
26
|
|
|
27
27
|
protected override async start() {
|
|
28
|
-
this.#http = await this.env.get(HttpService).create(this);
|
|
28
|
+
this.#http = await this.env.get(HttpService).create(this.address);
|
|
29
29
|
this.#http.ws = this.#handleConnection.bind(this);
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
} from "#model";
|
|
26
26
|
import type { ClientNode } from "#node/ClientNode.js";
|
|
27
27
|
import type { Node } from "#node/Node.js";
|
|
28
|
-
import { ReadScope,
|
|
28
|
+
import { ReadScope, type Read, type ReadResult } from "#protocol";
|
|
29
29
|
import { ClientNodeStore } from "#storage/client/ClientNodeStore.js";
|
|
30
30
|
import { DatasourceCache } from "#storage/client/DatasourceCache.js";
|
|
31
31
|
import type { AttributeId, ClusterId, ClusterType, CommandId, EndpointNumber } from "#types";
|
|
@@ -287,16 +287,18 @@ export class ClientStructure {
|
|
|
287
287
|
currentUpdates = {
|
|
288
288
|
endpointId,
|
|
289
289
|
clusterId,
|
|
290
|
-
values:
|
|
290
|
+
values: {
|
|
291
|
+
[attributeId]: change.value,
|
|
292
|
+
},
|
|
291
293
|
};
|
|
292
294
|
|
|
293
295
|
// Update version but only if this was a wildcard read
|
|
294
296
|
if (scope.isWildcard(endpointId, clusterId)) {
|
|
295
|
-
currentUpdates.values
|
|
297
|
+
currentUpdates.values[DatasourceCache.VERSION_KEY] = change.version;
|
|
296
298
|
}
|
|
297
299
|
} else {
|
|
298
300
|
// Add value to change set for current endpoint/cluster
|
|
299
|
-
currentUpdates.values
|
|
301
|
+
currentUpdates.values[attributeId] = change.value;
|
|
300
302
|
}
|
|
301
303
|
|
|
302
304
|
return currentUpdates;
|
|
@@ -345,14 +347,14 @@ export class ClientStructure {
|
|
|
345
347
|
const endpoint = this.#endpointFor(attrs.endpointId);
|
|
346
348
|
const cluster = this.#clusterFor(endpoint, attrs.clusterId);
|
|
347
349
|
|
|
348
|
-
if (cluster.behavior && attrs.values
|
|
349
|
-
if (!isDeepEqual(cluster.features, attrs.values
|
|
350
|
+
if (cluster.behavior && FeatureMap.id in attrs.values) {
|
|
351
|
+
if (!isDeepEqual(cluster.features, attrs.values[FeatureMap.id])) {
|
|
350
352
|
cluster.behavior = undefined;
|
|
351
353
|
}
|
|
352
354
|
}
|
|
353
355
|
|
|
354
|
-
if (cluster.behavior && attrs.values
|
|
355
|
-
const attributeList = attrs.values
|
|
356
|
+
if (cluster.behavior && AttributeList.id in attrs.values) {
|
|
357
|
+
const attributeList = attrs.values[AttributeList.id];
|
|
356
358
|
if (
|
|
357
359
|
Array.isArray(attributeList) &&
|
|
358
360
|
!isDeepEqual(
|
|
@@ -364,8 +366,8 @@ export class ClientStructure {
|
|
|
364
366
|
}
|
|
365
367
|
}
|
|
366
368
|
|
|
367
|
-
if (cluster.behavior && attrs.values
|
|
368
|
-
const acceptedCommands = attrs.values
|
|
369
|
+
if (cluster.behavior && AcceptedCommandList.id in attrs.values) {
|
|
370
|
+
const acceptedCommands = attrs.values[AcceptedCommandList.id];
|
|
369
371
|
if (
|
|
370
372
|
Array.isArray(acceptedCommands) &&
|
|
371
373
|
!isDeepEqual(
|
|
@@ -836,7 +838,9 @@ export class ClientStructure {
|
|
|
836
838
|
interface AttributeUpdates {
|
|
837
839
|
endpointId: EndpointNumber;
|
|
838
840
|
clusterId: ClusterId;
|
|
839
|
-
values:
|
|
841
|
+
values: {
|
|
842
|
+
[K in number | typeof DatasourceCache.VERSION_KEY]?: unknown;
|
|
843
|
+
};
|
|
840
844
|
}
|
|
841
845
|
|
|
842
846
|
interface EndpointStructure {
|
|
@@ -45,14 +45,12 @@ export function DatasourceCache(
|
|
|
45
45
|
participant.set(store.number, behaviorId, values);
|
|
46
46
|
},
|
|
47
47
|
|
|
48
|
-
async externalSet(values: Val.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
version = versionVal;
|
|
48
|
+
async externalSet(values: Val.Struct) {
|
|
49
|
+
if (typeof values[DatasourceCache.VERSION_KEY] === "number") {
|
|
50
|
+
version = values[DatasourceCache.VERSION_KEY];
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
await store.set({ [behaviorId]: valuesStruct });
|
|
53
|
+
await store.set({ [behaviorId]: values });
|
|
56
54
|
|
|
57
55
|
if (this.externalChangeListener) {
|
|
58
56
|
await this.externalChangeListener(values);
|
|
@@ -60,7 +58,7 @@ export function DatasourceCache(
|
|
|
60
58
|
if (!this.initialValues) {
|
|
61
59
|
this.initialValues = {};
|
|
62
60
|
}
|
|
63
|
-
Object.assign(this.initialValues,
|
|
61
|
+
Object.assign(this.initialValues, values);
|
|
64
62
|
}
|
|
65
63
|
},
|
|
66
64
|
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2026 Matter.js Authors
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { Behavior } from "#behavior/Behavior.js";
|
|
7
|
-
import { DclCertificateService, DclConfig, DclOtaUpdateService } from "#protocol";
|
|
8
|
-
/**
|
|
9
|
-
* DCL (Distributed Compliance Ledger) configuration behavior.
|
|
10
|
-
*
|
|
11
|
-
* This behavior provides centralized configuration for DCL-related services.
|
|
12
|
-
* Configuration can be set via:
|
|
13
|
-
* - Environment variables (MATTER_DCL_PRODUCTIONURL, MATTER_DCL_TESTURL, etc.)
|
|
14
|
-
* - Configuration file ({ "dcl": { "productionUrl": "..." } })
|
|
15
|
-
* - Programmatically when building the node
|
|
16
|
-
*
|
|
17
|
-
* Environment variables:
|
|
18
|
-
* - MATTER_DCL_PRODUCTIONURL - Production DCL API endpoint
|
|
19
|
-
* - MATTER_DCL_TESTURL - Test DCL API endpoint
|
|
20
|
-
* - MATTER_DCL_FETCHTESTCERTIFICATES - Enable test certificate fetching (true/false)
|
|
21
|
-
* - MATTER_DCL_FETCHGITHUBCERTIFICATES - Enable GitHub dev cert fetching (true/false)
|
|
22
|
-
*
|
|
23
|
-
* @example Programmatic configuration:
|
|
24
|
-
* ```typescript
|
|
25
|
-
* const node = await ServerNode.create({
|
|
26
|
-
* behaviors: {
|
|
27
|
-
* dcl: {
|
|
28
|
-
* productionUrl: "https://custom.dcl.url",
|
|
29
|
-
* fetchTestCertificates: true,
|
|
30
|
-
* }
|
|
31
|
-
* }
|
|
32
|
-
* });
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare class DclBehavior extends Behavior {
|
|
36
|
-
static readonly id = "dcl";
|
|
37
|
-
state: DclBehavior.State;
|
|
38
|
-
/** Get DclConfig for production DCL based on current state. */
|
|
39
|
-
get productionConfig(): DclConfig;
|
|
40
|
-
/** Get DclConfig for test DCL based on current state. */
|
|
41
|
-
get testConfig(): DclConfig;
|
|
42
|
-
/**
|
|
43
|
-
* Get DclConfig based on production flag.
|
|
44
|
-
* @param isProduction - true for production, false for test
|
|
45
|
-
*/
|
|
46
|
-
configForProduction(isProduction: boolean): DclConfig;
|
|
47
|
-
/** Get or create the DclCertificateService with current configuration. */
|
|
48
|
-
get certificateService(): DclCertificateService;
|
|
49
|
-
/** Get or create the DclOtaUpdateService with current configuration. */
|
|
50
|
-
get otaUpdateService(): DclOtaUpdateService;
|
|
51
|
-
}
|
|
52
|
-
export declare namespace DclBehavior {
|
|
53
|
-
class State {
|
|
54
|
-
/**
|
|
55
|
-
* Production DCL API endpoint URL.
|
|
56
|
-
*
|
|
57
|
-
* Swagger docs: https://zigbee-alliance.github.io/distributed-compliance-ledger/#/
|
|
58
|
-
*/
|
|
59
|
-
productionUrl: string;
|
|
60
|
-
/** Test/Development DCL API endpoint URL. */
|
|
61
|
-
testUrl: string;
|
|
62
|
-
/** Whether to fetch test certificates in addition to production ones. */
|
|
63
|
-
fetchTestCertificates: boolean;
|
|
64
|
-
/** Whether to fetch development certificates from GitHub (only when fetchTestCertificates is true). */
|
|
65
|
-
fetchGithubCertificates: boolean;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=DclBehavior.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DclBehavior.d.ts","sourceRoot":"","sources":["../../../../../src/behavior/system/dcl/DclBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,WAAY,SAAQ,QAAQ;IACrC,gBAAyB,EAAE,SAAS;IAE5B,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC;IAEjC,+DAA+D;IAC/D,IAAI,gBAAgB,IAAI,SAAS,CAEhC;IAED,yDAAyD;IACzD,IAAI,UAAU,IAAI,SAAS,CAE1B;IAED;;;OAGG;IACH,mBAAmB,CAAC,YAAY,EAAE,OAAO,GAAG,SAAS;IAIrD,0EAA0E;IAC1E,IAAI,kBAAkB,IAAI,qBAAqB,CAU9C;IAED,wEAAwE;IACxE,IAAI,gBAAgB,IAAI,mBAAmB,CAQ1C;CACJ;AAED,yBAAiB,WAAW,CAAC;IACzB,MAAa,KAAK;QACd;;;;WAIG;QACH,aAAa,SAA4B;QAEzC,6CAA6C;QAC7C,OAAO,SAAsB;QAE7B,yEAAyE;QACzE,qBAAqB,UAAS;QAE9B,uGAAuG;QACvG,uBAAuB,UAAQ;KAClC;CACJ"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var DclBehavior_exports = {};
|
|
20
|
-
__export(DclBehavior_exports, {
|
|
21
|
-
DclBehavior: () => DclBehavior
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(DclBehavior_exports);
|
|
24
|
-
var import_Behavior = require("#behavior/Behavior.js");
|
|
25
|
-
var import_protocol = require("#protocol");
|
|
26
|
-
/**
|
|
27
|
-
* @license
|
|
28
|
-
* Copyright 2026 Matter.js Authors
|
|
29
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
30
|
-
*/
|
|
31
|
-
class DclBehavior extends import_Behavior.Behavior {
|
|
32
|
-
static id = "dcl";
|
|
33
|
-
/** Get DclConfig for production DCL based on current state. */
|
|
34
|
-
get productionConfig() {
|
|
35
|
-
return { url: this.state.productionUrl };
|
|
36
|
-
}
|
|
37
|
-
/** Get DclConfig for test DCL based on current state. */
|
|
38
|
-
get testConfig() {
|
|
39
|
-
return { url: this.state.testUrl };
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Get DclConfig based on production flag.
|
|
43
|
-
* @param isProduction - true for production, false for test
|
|
44
|
-
*/
|
|
45
|
-
configForProduction(isProduction) {
|
|
46
|
-
return isProduction ? this.productionConfig : this.testConfig;
|
|
47
|
-
}
|
|
48
|
-
/** Get or create the DclCertificateService with current configuration. */
|
|
49
|
-
get certificateService() {
|
|
50
|
-
if (!this.env.has(import_protocol.DclCertificateService)) {
|
|
51
|
-
new import_protocol.DclCertificateService(this.env, {
|
|
52
|
-
fetchTestCertificates: this.state.fetchTestCertificates,
|
|
53
|
-
fetchGithubCertificates: this.state.fetchGithubCertificates,
|
|
54
|
-
dclConfig: this.productionConfig,
|
|
55
|
-
testDclConfig: this.state.fetchTestCertificates ? this.testConfig : void 0
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
return this.env.get(import_protocol.DclCertificateService);
|
|
59
|
-
}
|
|
60
|
-
/** Get or create the DclOtaUpdateService with current configuration. */
|
|
61
|
-
get otaUpdateService() {
|
|
62
|
-
if (!this.env.has(import_protocol.DclOtaUpdateService)) {
|
|
63
|
-
new import_protocol.DclOtaUpdateService(this.env, {
|
|
64
|
-
productionDclConfig: this.productionConfig,
|
|
65
|
-
testDclConfig: this.testConfig
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
return this.env.get(import_protocol.DclOtaUpdateService);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
((DclBehavior2) => {
|
|
72
|
-
class State {
|
|
73
|
-
/**
|
|
74
|
-
* Production DCL API endpoint URL.
|
|
75
|
-
*
|
|
76
|
-
* Swagger docs: https://zigbee-alliance.github.io/distributed-compliance-ledger/#/
|
|
77
|
-
*/
|
|
78
|
-
productionUrl = import_protocol.DclConfig.production.url;
|
|
79
|
-
/** Test/Development DCL API endpoint URL. */
|
|
80
|
-
testUrl = import_protocol.DclConfig.test.url;
|
|
81
|
-
/** Whether to fetch test certificates in addition to production ones. */
|
|
82
|
-
fetchTestCertificates = false;
|
|
83
|
-
/** Whether to fetch development certificates from GitHub (only when fetchTestCertificates is true). */
|
|
84
|
-
fetchGithubCertificates = true;
|
|
85
|
-
}
|
|
86
|
-
DclBehavior2.State = State;
|
|
87
|
-
})(DclBehavior || (DclBehavior = {}));
|
|
88
|
-
//# sourceMappingURL=DclBehavior.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/behavior/system/dcl/DclBehavior.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,sBAAyB;AACzB,sBAAsE;AAPtE;AAAA;AAAA;AAAA;AAAA;AAoCO,MAAM,oBAAoB,yBAAS;AAAA,EACtC,OAAyB,KAAK;AAAA;AAAA,EAK9B,IAAI,mBAA8B;AAC9B,WAAO,EAAE,KAAK,KAAK,MAAM,cAAc;AAAA,EAC3C;AAAA;AAAA,EAGA,IAAI,aAAwB;AACxB,WAAO,EAAE,KAAK,KAAK,MAAM,QAAQ;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,oBAAoB,cAAkC;AAClD,WAAO,eAAe,KAAK,mBAAmB,KAAK;AAAA,EACvD;AAAA;AAAA,EAGA,IAAI,qBAA4C;AAC5C,QAAI,CAAC,KAAK,IAAI,IAAI,qCAAqB,GAAG;AACtC,UAAI,sCAAsB,KAAK,KAAK;AAAA,QAChC,uBAAuB,KAAK,MAAM;AAAA,QAClC,yBAAyB,KAAK,MAAM;AAAA,QACpC,WAAW,KAAK;AAAA,QAChB,eAAe,KAAK,MAAM,wBAAwB,KAAK,aAAa;AAAA,MACxE,CAAC;AAAA,IACL;AACA,WAAO,KAAK,IAAI,IAAI,qCAAqB;AAAA,EAC7C;AAAA;AAAA,EAGA,IAAI,mBAAwC;AACxC,QAAI,CAAC,KAAK,IAAI,IAAI,mCAAmB,GAAG;AACpC,UAAI,oCAAoB,KAAK,KAAK;AAAA,QAC9B,qBAAqB,KAAK;AAAA,QAC1B,eAAe,KAAK;AAAA,MACxB,CAAC;AAAA,IACL;AACA,WAAO,KAAK,IAAI,IAAI,mCAAmB;AAAA,EAC3C;AACJ;AAAA,CAEO,CAAUA,iBAAV;AAAA,EACI,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMf,gBAAgB,0BAAU,WAAW;AAAA;AAAA,IAGrC,UAAU,0BAAU,KAAK;AAAA;AAAA,IAGzB,wBAAwB;AAAA;AAAA,IAGxB,0BAA0B;AAAA,EAC9B;AAhBO,EAAAA,aAAM;AAAA,GADA;",
|
|
5
|
-
"names": ["DclBehavior"]
|
|
6
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/behavior/system/dcl/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var dcl_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(dcl_exports);
|
|
18
|
-
__reExport(dcl_exports, require("./DclBehavior.js"), module.exports);
|
|
19
|
-
/**
|
|
20
|
-
* @license
|
|
21
|
-
* Copyright 2026 Matter.js Authors
|
|
22
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
23
|
-
*/
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2026 Matter.js Authors
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { Behavior } from "#behavior/Behavior.js";
|
|
7
|
-
import { DclCertificateService, DclConfig, DclOtaUpdateService } from "#protocol";
|
|
8
|
-
/**
|
|
9
|
-
* DCL (Distributed Compliance Ledger) configuration behavior.
|
|
10
|
-
*
|
|
11
|
-
* This behavior provides centralized configuration for DCL-related services.
|
|
12
|
-
* Configuration can be set via:
|
|
13
|
-
* - Environment variables (MATTER_DCL_PRODUCTIONURL, MATTER_DCL_TESTURL, etc.)
|
|
14
|
-
* - Configuration file ({ "dcl": { "productionUrl": "..." } })
|
|
15
|
-
* - Programmatically when building the node
|
|
16
|
-
*
|
|
17
|
-
* Environment variables:
|
|
18
|
-
* - MATTER_DCL_PRODUCTIONURL - Production DCL API endpoint
|
|
19
|
-
* - MATTER_DCL_TESTURL - Test DCL API endpoint
|
|
20
|
-
* - MATTER_DCL_FETCHTESTCERTIFICATES - Enable test certificate fetching (true/false)
|
|
21
|
-
* - MATTER_DCL_FETCHGITHUBCERTIFICATES - Enable GitHub dev cert fetching (true/false)
|
|
22
|
-
*
|
|
23
|
-
* @example Programmatic configuration:
|
|
24
|
-
* ```typescript
|
|
25
|
-
* const node = await ServerNode.create({
|
|
26
|
-
* behaviors: {
|
|
27
|
-
* dcl: {
|
|
28
|
-
* productionUrl: "https://custom.dcl.url",
|
|
29
|
-
* fetchTestCertificates: true,
|
|
30
|
-
* }
|
|
31
|
-
* }
|
|
32
|
-
* });
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare class DclBehavior extends Behavior {
|
|
36
|
-
static readonly id = "dcl";
|
|
37
|
-
state: DclBehavior.State;
|
|
38
|
-
/** Get DclConfig for production DCL based on current state. */
|
|
39
|
-
get productionConfig(): DclConfig;
|
|
40
|
-
/** Get DclConfig for test DCL based on current state. */
|
|
41
|
-
get testConfig(): DclConfig;
|
|
42
|
-
/**
|
|
43
|
-
* Get DclConfig based on production flag.
|
|
44
|
-
* @param isProduction - true for production, false for test
|
|
45
|
-
*/
|
|
46
|
-
configForProduction(isProduction: boolean): DclConfig;
|
|
47
|
-
/** Get or create the DclCertificateService with current configuration. */
|
|
48
|
-
get certificateService(): DclCertificateService;
|
|
49
|
-
/** Get or create the DclOtaUpdateService with current configuration. */
|
|
50
|
-
get otaUpdateService(): DclOtaUpdateService;
|
|
51
|
-
}
|
|
52
|
-
export declare namespace DclBehavior {
|
|
53
|
-
class State {
|
|
54
|
-
/**
|
|
55
|
-
* Production DCL API endpoint URL.
|
|
56
|
-
*
|
|
57
|
-
* Swagger docs: https://zigbee-alliance.github.io/distributed-compliance-ledger/#/
|
|
58
|
-
*/
|
|
59
|
-
productionUrl: string;
|
|
60
|
-
/** Test/Development DCL API endpoint URL. */
|
|
61
|
-
testUrl: string;
|
|
62
|
-
/** Whether to fetch test certificates in addition to production ones. */
|
|
63
|
-
fetchTestCertificates: boolean;
|
|
64
|
-
/** Whether to fetch development certificates from GitHub (only when fetchTestCertificates is true). */
|
|
65
|
-
fetchGithubCertificates: boolean;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=DclBehavior.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DclBehavior.d.ts","sourceRoot":"","sources":["../../../../../src/behavior/system/dcl/DclBehavior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,WAAY,SAAQ,QAAQ;IACrC,gBAAyB,EAAE,SAAS;IAE5B,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC;IAEjC,+DAA+D;IAC/D,IAAI,gBAAgB,IAAI,SAAS,CAEhC;IAED,yDAAyD;IACzD,IAAI,UAAU,IAAI,SAAS,CAE1B;IAED;;;OAGG;IACH,mBAAmB,CAAC,YAAY,EAAE,OAAO,GAAG,SAAS;IAIrD,0EAA0E;IAC1E,IAAI,kBAAkB,IAAI,qBAAqB,CAU9C;IAED,wEAAwE;IACxE,IAAI,gBAAgB,IAAI,mBAAmB,CAQ1C;CACJ;AAED,yBAAiB,WAAW,CAAC;IACzB,MAAa,KAAK;QACd;;;;WAIG;QACH,aAAa,SAA4B;QAEzC,6CAA6C;QAC7C,OAAO,SAAsB;QAE7B,yEAAyE;QACzE,qBAAqB,UAAS;QAE9B,uGAAuG;QACvG,uBAAuB,UAAQ;KAClC;CACJ"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2026 Matter.js Authors
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { Behavior } from "#behavior/Behavior.js";
|
|
7
|
-
import { DclCertificateService, DclConfig, DclOtaUpdateService } from "#protocol";
|
|
8
|
-
class DclBehavior extends Behavior {
|
|
9
|
-
static id = "dcl";
|
|
10
|
-
/** Get DclConfig for production DCL based on current state. */
|
|
11
|
-
get productionConfig() {
|
|
12
|
-
return { url: this.state.productionUrl };
|
|
13
|
-
}
|
|
14
|
-
/** Get DclConfig for test DCL based on current state. */
|
|
15
|
-
get testConfig() {
|
|
16
|
-
return { url: this.state.testUrl };
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Get DclConfig based on production flag.
|
|
20
|
-
* @param isProduction - true for production, false for test
|
|
21
|
-
*/
|
|
22
|
-
configForProduction(isProduction) {
|
|
23
|
-
return isProduction ? this.productionConfig : this.testConfig;
|
|
24
|
-
}
|
|
25
|
-
/** Get or create the DclCertificateService with current configuration. */
|
|
26
|
-
get certificateService() {
|
|
27
|
-
if (!this.env.has(DclCertificateService)) {
|
|
28
|
-
new DclCertificateService(this.env, {
|
|
29
|
-
fetchTestCertificates: this.state.fetchTestCertificates,
|
|
30
|
-
fetchGithubCertificates: this.state.fetchGithubCertificates,
|
|
31
|
-
dclConfig: this.productionConfig,
|
|
32
|
-
testDclConfig: this.state.fetchTestCertificates ? this.testConfig : void 0
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
return this.env.get(DclCertificateService);
|
|
36
|
-
}
|
|
37
|
-
/** Get or create the DclOtaUpdateService with current configuration. */
|
|
38
|
-
get otaUpdateService() {
|
|
39
|
-
if (!this.env.has(DclOtaUpdateService)) {
|
|
40
|
-
new DclOtaUpdateService(this.env, {
|
|
41
|
-
productionDclConfig: this.productionConfig,
|
|
42
|
-
testDclConfig: this.testConfig
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
return this.env.get(DclOtaUpdateService);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
((DclBehavior2) => {
|
|
49
|
-
class State {
|
|
50
|
-
/**
|
|
51
|
-
* Production DCL API endpoint URL.
|
|
52
|
-
*
|
|
53
|
-
* Swagger docs: https://zigbee-alliance.github.io/distributed-compliance-ledger/#/
|
|
54
|
-
*/
|
|
55
|
-
productionUrl = DclConfig.production.url;
|
|
56
|
-
/** Test/Development DCL API endpoint URL. */
|
|
57
|
-
testUrl = DclConfig.test.url;
|
|
58
|
-
/** Whether to fetch test certificates in addition to production ones. */
|
|
59
|
-
fetchTestCertificates = false;
|
|
60
|
-
/** Whether to fetch development certificates from GitHub (only when fetchTestCertificates is true). */
|
|
61
|
-
fetchGithubCertificates = true;
|
|
62
|
-
}
|
|
63
|
-
DclBehavior2.State = State;
|
|
64
|
-
})(DclBehavior || (DclBehavior = {}));
|
|
65
|
-
export {
|
|
66
|
-
DclBehavior
|
|
67
|
-
};
|
|
68
|
-
//# sourceMappingURL=DclBehavior.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/behavior/system/dcl/DclBehavior.ts"],
|
|
4
|
-
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,SAAS,gBAAgB;AACzB,SAAS,uBAAuB,WAAW,2BAA2B;AA6B/D,MAAM,oBAAoB,SAAS;AAAA,EACtC,OAAyB,KAAK;AAAA;AAAA,EAK9B,IAAI,mBAA8B;AAC9B,WAAO,EAAE,KAAK,KAAK,MAAM,cAAc;AAAA,EAC3C;AAAA;AAAA,EAGA,IAAI,aAAwB;AACxB,WAAO,EAAE,KAAK,KAAK,MAAM,QAAQ;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,oBAAoB,cAAkC;AAClD,WAAO,eAAe,KAAK,mBAAmB,KAAK;AAAA,EACvD;AAAA;AAAA,EAGA,IAAI,qBAA4C;AAC5C,QAAI,CAAC,KAAK,IAAI,IAAI,qBAAqB,GAAG;AACtC,UAAI,sBAAsB,KAAK,KAAK;AAAA,QAChC,uBAAuB,KAAK,MAAM;AAAA,QAClC,yBAAyB,KAAK,MAAM;AAAA,QACpC,WAAW,KAAK;AAAA,QAChB,eAAe,KAAK,MAAM,wBAAwB,KAAK,aAAa;AAAA,MACxE,CAAC;AAAA,IACL;AACA,WAAO,KAAK,IAAI,IAAI,qBAAqB;AAAA,EAC7C;AAAA;AAAA,EAGA,IAAI,mBAAwC;AACxC,QAAI,CAAC,KAAK,IAAI,IAAI,mBAAmB,GAAG;AACpC,UAAI,oBAAoB,KAAK,KAAK;AAAA,QAC9B,qBAAqB,KAAK;AAAA,QAC1B,eAAe,KAAK;AAAA,MACxB,CAAC;AAAA,IACL;AACA,WAAO,KAAK,IAAI,IAAI,mBAAmB;AAAA,EAC3C;AACJ;AAAA,CAEO,CAAUA,iBAAV;AAAA,EACI,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMf,gBAAgB,UAAU,WAAW;AAAA;AAAA,IAGrC,UAAU,UAAU,KAAK;AAAA;AAAA,IAGzB,wBAAwB;AAAA;AAAA,IAGxB,0BAA0B;AAAA,EAC9B;AAhBO,EAAAA,aAAM;AAAA,GADA;",
|
|
5
|
-
"names": ["DclBehavior"]
|
|
6
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/behavior/system/dcl/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,kBAAkB,CAAC"}
|