@matter/nodejs-shell 0.16.0-alpha.0-20251115-d89e62680 → 0.16.0-alpha.0-20251129-96ad07c6e
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/README.md +210 -5
- package/dist/cjs/MatterNode.js +32 -0
- package/dist/cjs/MatterNode.js.map +1 -1
- package/dist/cjs/shell/Shell.js +8 -0
- package/dist/cjs/shell/Shell.js.map +2 -2
- package/dist/cjs/shell/cmd_cert.js +154 -0
- package/dist/cjs/shell/cmd_cert.js.map +6 -0
- package/dist/cjs/shell/cmd_config.js +62 -1
- package/dist/cjs/shell/cmd_config.js.map +1 -1
- package/dist/cjs/shell/cmd_dcl.js +198 -0
- package/dist/cjs/shell/cmd_dcl.js.map +6 -0
- package/dist/cjs/shell/cmd_nodes.js +160 -0
- package/dist/cjs/shell/cmd_nodes.js.map +1 -1
- package/dist/cjs/shell/cmd_ota.js +449 -0
- package/dist/cjs/shell/cmd_ota.js.map +6 -0
- package/dist/cjs/shell/cmd_vendor.js +118 -0
- package/dist/cjs/shell/cmd_vendor.js.map +6 -0
- package/package.json +10 -10
- package/src/MatterNode.ts +41 -2
- package/src/shell/Shell.ts +8 -0
- package/src/shell/cmd_cert.ts +156 -0
- package/src/shell/cmd_config.ts +80 -1
- package/src/shell/cmd_dcl.ts +221 -0
- package/src/shell/cmd_nodes.ts +192 -1
- package/src/shell/cmd_ota.ts +550 -0
- package/src/shell/cmd_vendor.ts +108 -0
package/README.md
CHANGED
|
@@ -63,6 +63,8 @@ matter-node> help
|
|
|
63
63
|
config Manage global configuration
|
|
64
64
|
session Manage session
|
|
65
65
|
nodes Manage nodes
|
|
66
|
+
ota OTA update operations
|
|
67
|
+
cert Certificate management operations
|
|
66
68
|
subscribe [node-id] Subscribe to all events and attributes of a node
|
|
67
69
|
identify [time] [node-id] [endpoint-id] Trigger Identify command with given time (default 10s). Execute on one node or endpoint, else all onoff clusters will be controlled
|
|
68
70
|
discover Handle device discovery
|
|
@@ -81,11 +83,12 @@ For instance `config --help` will display all node configuration for the persist
|
|
|
81
83
|
|
|
82
84
|
```
|
|
83
85
|
> config
|
|
84
|
-
config loglevel
|
|
85
|
-
config logfile
|
|
86
|
-
config ble-hci
|
|
87
|
-
config wifi-credentials
|
|
88
|
-
config thread-credentials
|
|
86
|
+
config loglevel Manage Console and File LogLevels
|
|
87
|
+
config logfile Manage Logfile path
|
|
88
|
+
config ble-hci Manage BLE HCI ID (Linux)
|
|
89
|
+
config wifi-credentials Manage Wi-Fi credentials used in commissioning process
|
|
90
|
+
config thread-credentials Manage Thread credentials used in commissioning process
|
|
91
|
+
config dcl-test-certificates Manage DCL test certificate fetching
|
|
89
92
|
|
|
90
93
|
Done
|
|
91
94
|
```
|
|
@@ -96,6 +99,24 @@ By default the Shell logs messages to the console. The log level can be changed
|
|
|
96
99
|
|
|
97
100
|
Additionally the Shell can log to a file. The log file path can be set using the `config logfile` command or as commandline parameter (which will then be persisted in the configuration). The log file always contain the logs in "debug" level.
|
|
98
101
|
|
|
102
|
+
### DCL Test Certificates
|
|
103
|
+
|
|
104
|
+
By default, the shell only fetches production certificates from the Distributed Compliance Ledger (DCL). To also fetch test certificates from DCL and development certificates from GitHub, use the `config dcl-test-certificates` command:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
config dcl-test-certificates set true
|
|
108
|
+
config dcl-test-certificates set false
|
|
109
|
+
config dcl-test-certificates get
|
|
110
|
+
config dcl-test-certificates delete
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
When enabled, the certificate service will fetch:
|
|
114
|
+
- Production certificates from DCL
|
|
115
|
+
- Test certificates from DCL
|
|
116
|
+
- Development certificates from the Matter GitHub repository
|
|
117
|
+
|
|
118
|
+
When disabled (default), only production certificates from DCL are fetched. Changes require restarting the shell to take effect.
|
|
119
|
+
|
|
99
120
|
### Commission a device
|
|
100
121
|
|
|
101
122
|
The shell supports discovery and also commissioning of devices. The commissioning process is based on the Matter SDK and uses the same commissioning process as the chip-tool. The commissioning process is started by the `commission pair` command.
|
|
@@ -129,6 +150,190 @@ Additional parameters to the connect command are the subscription delays (min/ma
|
|
|
129
150
|
|
|
130
151
|
To see the full node structure of a node you can use the `nodes log` command and provide the node-id as parameter (`nodes log 5000`).
|
|
131
152
|
|
|
153
|
+
### OTA Update Management
|
|
154
|
+
|
|
155
|
+
The shell provides comprehensive OTA (Over-The-Air) update management through DCL (Distributed Compliance Ledger) integration and local file operations.
|
|
156
|
+
|
|
157
|
+
#### Check for OTA updates for a commissioned node
|
|
158
|
+
|
|
159
|
+
Use `nodes ota check <node-id>` to query the DCL for available OTA updates for a specific commissioned node. The command uses the node's basic information (vendor ID, product ID, current software version) to check for newer firmware versions.
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
nodes ota check 5000
|
|
163
|
+
nodes ota check 5000 --mode test
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Options:
|
|
167
|
+
- `--mode <prod|test>`: Specify DCL mode - production (default) or test
|
|
168
|
+
|
|
169
|
+
The command will display information about available updates including version, file size, and download URL.
|
|
170
|
+
|
|
171
|
+
#### Download OTA updates for a commissioned node
|
|
172
|
+
|
|
173
|
+
Use `nodes ota download <node-id>` to check for and download OTA updates from DCL. The downloaded update is validated and stored locally for later use.
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
nodes ota download 5000
|
|
177
|
+
nodes ota download 5000 --mode test --force
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Options:
|
|
181
|
+
- `--mode <prod|test>`: Specify DCL mode - production (default) or test
|
|
182
|
+
- `--force`: Force re-download even if the update is already cached locally
|
|
183
|
+
|
|
184
|
+
#### Display OTA image information
|
|
185
|
+
|
|
186
|
+
Use `ota info <file>` to display detailed information about an OTA image file including vendor ID, product ID, software version, and applicable version ranges.
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
ota info file:///path/to/firmware.bin
|
|
190
|
+
ota info fff1-8000-prod
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
The command accepts:
|
|
194
|
+
- `file://` prefix: Absolute file path on the filesystem
|
|
195
|
+
- No prefix: Storage key for a previously downloaded/imported OTA file
|
|
196
|
+
|
|
197
|
+
#### List stored OTA images
|
|
198
|
+
|
|
199
|
+
Use `ota list` to list all OTA images currently stored locally with optional filtering.
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
ota list
|
|
203
|
+
ota list --vendor 0xfff1
|
|
204
|
+
ota list --vendor 0xfff1 --product 0x8000
|
|
205
|
+
ota list --mode test
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Options:
|
|
209
|
+
- `--vendor <vid>`: Filter by vendor ID (hex format like 0xFFF1 or decimal)
|
|
210
|
+
- `--product <pid>`: Filter by product ID (hex format like 0x8000 or decimal) - requires --vendor
|
|
211
|
+
- `--mode <prod|test>`: Filter by DCL mode (production or test)
|
|
212
|
+
|
|
213
|
+
#### Add OTA image to storage
|
|
214
|
+
|
|
215
|
+
Use `ota add <file>` to import a local OTA image file into storage after validation.
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
ota add /path/to/firmware.bin
|
|
219
|
+
ota add /path/to/test-firmware.bin --mode test
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Options:
|
|
223
|
+
- `--mode <prod|test>`: Mark the OTA image as production (default) or test mode
|
|
224
|
+
|
|
225
|
+
The command validates the OTA file format and extracts metadata before storing it.
|
|
226
|
+
|
|
227
|
+
#### Delete OTA images from storage
|
|
228
|
+
|
|
229
|
+
Use `ota delete` to remove OTA images from local storage.
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
ota delete fff1-8000-prod
|
|
233
|
+
ota delete --vendor 0xfff1
|
|
234
|
+
ota delete --vendor 0xfff1 --product 0x8000 --mode test
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Options:
|
|
238
|
+
- `<keyname>`: Delete specific OTA file by storage key
|
|
239
|
+
- `--vendor <vid>`: Delete all OTA files for a vendor
|
|
240
|
+
- `--product <pid>`: Delete specific product (requires --vendor)
|
|
241
|
+
- `--mode <prod|test>`: Specify DCL mode - production (default) or test
|
|
242
|
+
|
|
243
|
+
#### Copy OTA image to filesystem
|
|
244
|
+
|
|
245
|
+
Use `ota copy` to export a stored OTA image to the filesystem.
|
|
246
|
+
|
|
247
|
+
```
|
|
248
|
+
ota copy fff1-8000-prod /path/to/output.bin
|
|
249
|
+
ota copy 0xfff1 0x8000 prod /path/to/output.bin
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Both forms are supported:
|
|
253
|
+
- `ota copy <keyname> <target>`: Copy by storage key
|
|
254
|
+
- `ota copy <vendor-id> <product-id> <mode> <target>`: Copy by vendor/product/mode
|
|
255
|
+
|
|
256
|
+
If target is a directory, the source keyname is used as the filename.
|
|
257
|
+
|
|
258
|
+
#### Verify OTA image
|
|
259
|
+
|
|
260
|
+
Use `ota verify <file>` to validate an OTA image file without extracting the payload. This performs full validation including header parsing and checksum verification.
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
ota verify file:///path/to/firmware.bin
|
|
264
|
+
ota verify fff1-8000-prod
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
#### Extract OTA payload
|
|
268
|
+
|
|
269
|
+
Use `ota extract <file>` to extract and validate the payload from an OTA image file. The payload is written to a new file with "-payload" added to the filename.
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
ota extract /path/to/firmware.bin
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
The extracted payload file will be created at `/path/to/firmware-payload.bin`.
|
|
276
|
+
|
|
277
|
+
### Certificate Management
|
|
278
|
+
|
|
279
|
+
The shell provides certificate management operations for PAA (Product Attestation Authority) certificates stored locally. Certificates are automatically fetched from DCL (Distributed Compliance Ledger) and can be managed through the cert commands.
|
|
280
|
+
|
|
281
|
+
#### List certificates
|
|
282
|
+
|
|
283
|
+
Use `cert list` to display all stored certificates with their subject key IDs and subject information. Optionally filter by vendor ID.
|
|
284
|
+
|
|
285
|
+
```
|
|
286
|
+
cert list
|
|
287
|
+
cert list 0xFFF1
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
The command displays:
|
|
291
|
+
- Subject Key ID (unique identifier)
|
|
292
|
+
- Subject (certificate subject as text)
|
|
293
|
+
|
|
294
|
+
For detailed information about a specific certificate, use the `cert details` command.
|
|
295
|
+
|
|
296
|
+
#### View certificate details
|
|
297
|
+
|
|
298
|
+
Use `cert details <subject-key-id>` to view detailed metadata about a specific certificate.
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
cert details 6AFD22771F511FECBF1641976710DCDC31A1717E
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
This displays all certificate metadata in JSON format, including subject information, serial number, VID, and more.
|
|
305
|
+
|
|
306
|
+
#### Get certificate as PEM
|
|
307
|
+
|
|
308
|
+
Use `cert as-pem <subject-key-id>` to retrieve a certificate in PEM format, which can be saved to a file or used for verification.
|
|
309
|
+
|
|
310
|
+
```
|
|
311
|
+
cert as-pem 6AFD22771F511FECBF1641976710DCDC31A1717E
|
|
312
|
+
cert as-pem 6AFD22771F511FECBF1641976710DCDC31A1717E > certificate.pem
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
The PEM format output can be redirected to a file for use with standard certificate tools.
|
|
316
|
+
|
|
317
|
+
#### Delete certificate
|
|
318
|
+
|
|
319
|
+
Use `cert delete <subject-key-id>` to remove a certificate from local storage.
|
|
320
|
+
|
|
321
|
+
```
|
|
322
|
+
cert delete 6AFD22771F511FECBF1641976710DCDC31A1717E
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Note: This only removes the certificate from local storage. Production certificates from DCL will be re-downloaded during the next automatic update cycle.
|
|
326
|
+
|
|
327
|
+
#### Update certificates from DCL
|
|
328
|
+
|
|
329
|
+
Use `cert update` to manually trigger an update of certificates from the Distributed Compliance Ledger.
|
|
330
|
+
|
|
331
|
+
```
|
|
332
|
+
cert update
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
This fetches the latest production certificates from DCL and, if configured, also fetches test certificates from DCL and GitHub. The shell automatically performs periodic updates, but this command allows manual updates when needed.
|
|
336
|
+
|
|
132
337
|
### Commissioning related node operations
|
|
133
338
|
|
|
134
339
|
To open a commissioning window on a node to allow an additional pairing use `commission open-enhanced-window <node-id>`. When the command was successful the shell outputs the pairing code and a QR code to scan with the relevant pairing App.
|
package/dist/cjs/MatterNode.js
CHANGED
|
@@ -22,6 +22,7 @@ __export(MatterNode_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(MatterNode_exports);
|
|
24
24
|
var import_general = require("#general");
|
|
25
|
+
var import_protocol = require("#protocol");
|
|
25
26
|
var import_types = require("#types");
|
|
26
27
|
var import_matter = require("@project-chip/matter.js");
|
|
27
28
|
var import_node_path = require("node:path");
|
|
@@ -39,6 +40,8 @@ class MatterNode {
|
|
|
39
40
|
#started = false;
|
|
40
41
|
#nodeNum;
|
|
41
42
|
#netInterface;
|
|
43
|
+
#dclFetchTestCertificates = false;
|
|
44
|
+
#services;
|
|
42
45
|
constructor(nodeNum, netInterface) {
|
|
43
46
|
this.#environment = import_general.Environment.default;
|
|
44
47
|
this.#environment.runtime.add(this);
|
|
@@ -48,6 +51,33 @@ class MatterNode {
|
|
|
48
51
|
get storageLocation() {
|
|
49
52
|
return this.#storageLocation;
|
|
50
53
|
}
|
|
54
|
+
get environment() {
|
|
55
|
+
return this.#environment;
|
|
56
|
+
}
|
|
57
|
+
get services() {
|
|
58
|
+
if (!this.#services) {
|
|
59
|
+
this.#services = this.#environment.asDependent();
|
|
60
|
+
}
|
|
61
|
+
return this.#services;
|
|
62
|
+
}
|
|
63
|
+
get otaService() {
|
|
64
|
+
if (!this.environment.has(import_protocol.DclOtaUpdateService)) {
|
|
65
|
+
new import_protocol.DclOtaUpdateService(this.environment);
|
|
66
|
+
}
|
|
67
|
+
return this.services.get(import_protocol.DclOtaUpdateService);
|
|
68
|
+
}
|
|
69
|
+
get certificateService() {
|
|
70
|
+
if (!this.environment.has(import_protocol.DclCertificateService)) {
|
|
71
|
+
new import_protocol.DclCertificateService(this.environment, { fetchTestCertificates: this.#dclFetchTestCertificates });
|
|
72
|
+
}
|
|
73
|
+
return this.services.get(import_protocol.DclCertificateService);
|
|
74
|
+
}
|
|
75
|
+
get vendorInfoService() {
|
|
76
|
+
if (!this.environment.has(import_protocol.DclVendorInfoService)) {
|
|
77
|
+
new import_protocol.DclVendorInfoService(this.environment);
|
|
78
|
+
}
|
|
79
|
+
return this.services.get(import_protocol.DclVendorInfoService);
|
|
80
|
+
}
|
|
51
81
|
async initialize(resetStorage) {
|
|
52
82
|
if (this.#environment) {
|
|
53
83
|
if (this.#netInterface !== void 0) {
|
|
@@ -68,6 +98,7 @@ class MatterNode {
|
|
|
68
98
|
await controllerStore.erase();
|
|
69
99
|
}
|
|
70
100
|
this.#storageContext = controllerStore.storage.createContext("Node");
|
|
101
|
+
this.#dclFetchTestCertificates = await this.#storageContext.get("DclFetchTestCertificates", false);
|
|
71
102
|
const storageService = this.commissioningController.env.get(import_general.StorageService);
|
|
72
103
|
const baseLocation = storageService.location;
|
|
73
104
|
if (baseLocation !== void 0) {
|
|
@@ -88,6 +119,7 @@ class MatterNode {
|
|
|
88
119
|
}
|
|
89
120
|
async close() {
|
|
90
121
|
await this.commissioningController?.close();
|
|
122
|
+
await this.#services?.close();
|
|
91
123
|
}
|
|
92
124
|
async start() {
|
|
93
125
|
if (this.#started) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/MatterNode.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAA+F;AAC/F,sBAAiF;AACjF,mBAAuB;AACvB,oBAAyD;AAEzD,uBAAqB;AAZr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 var import_node_util = require("node:util");
|
|
|
38
38
|
var import_yargs = __toESM(require("yargs/yargs"));
|
|
39
39
|
var import_app = require("../app");
|
|
40
40
|
var import_CommandlineParser = require("../util/CommandlineParser.js");
|
|
41
|
+
var import_cmd_cert = __toESM(require("./cmd_cert.js"));
|
|
41
42
|
var import_cmd_cluster_attributes = __toESM(require("./cmd_cluster-attributes"));
|
|
42
43
|
var import_cmd_cluster_commands = __toESM(require("./cmd_cluster-commands"));
|
|
43
44
|
var import_cmd_cluster_events = __toESM(require("./cmd_cluster-events"));
|
|
44
45
|
var import_cmd_commission = __toESM(require("./cmd_commission.js"));
|
|
45
46
|
var import_cmd_config = __toESM(require("./cmd_config.js"));
|
|
47
|
+
var import_cmd_dcl = __toESM(require("./cmd_dcl.js"));
|
|
46
48
|
var import_cmd_discover = __toESM(require("./cmd_discover.js"));
|
|
47
49
|
var import_cmd_identify = __toESM(require("./cmd_identify.js"));
|
|
48
50
|
var import_cmd_nodes = __toESM(require("./cmd_nodes.js"));
|
|
51
|
+
var import_cmd_ota = __toESM(require("./cmd_ota.js"));
|
|
49
52
|
var import_cmd_session = __toESM(require("./cmd_session.js"));
|
|
50
53
|
var import_cmd_subscribe = __toESM(require("./cmd_subscribe.js"));
|
|
51
54
|
var import_cmd_tlv = __toESM(require("./cmd_tlv"));
|
|
55
|
+
var import_cmd_vendor = __toESM(require("./cmd_vendor.js"));
|
|
52
56
|
/**
|
|
53
57
|
* @license
|
|
54
58
|
* Copyright 2022-2025 Matter.js Authors
|
|
@@ -165,7 +169,11 @@ class Shell {
|
|
|
165
169
|
(0, import_cmd_cluster_attributes.default)(this.theNode),
|
|
166
170
|
(0, import_cmd_cluster_events.default)(this.theNode),
|
|
167
171
|
(0, import_cmd_cluster_commands.default)(this.theNode),
|
|
172
|
+
(0, import_cmd_ota.default)(this.theNode),
|
|
173
|
+
(0, import_cmd_cert.default)(this.theNode),
|
|
174
|
+
(0, import_cmd_vendor.default)(this.theNode),
|
|
168
175
|
(0, import_cmd_tlv.default)(),
|
|
176
|
+
(0, import_cmd_dcl.default)(),
|
|
169
177
|
exitCommand()
|
|
170
178
|
]).command({
|
|
171
179
|
command: "*",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/shell/Shell.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,qBAA4B;AAC5B,qBAAgD;AAChD,2BAAqB;AAErB,uBAAwB;AACxB,mBAAkB;AAElB,iBAAqB;AACrB,+BAAkC;AAClC,oCAA0B;AAC1B,kCAAwB;AACxB,gCAAsB;AACtB,4BAA0B;AAC1B,wBAAsB;AACtB,0BAAwB;AACxB,0BAAwB;AACxB,uBAAqB;AACrB,yBAAuB;AACvB,2BAAyB;AACzB,qBAAmB;
|
|
5
|
-
"names": ["readline", "yargs", "cmdCommission", "cmdConfig", "cmdSession", "cmdNodes", "cmdSubscribe", "cmdIdentify", "cmdDiscover", "cmdAttributes", "cmdEvents", "cmdCommands", "cmdTlv"]
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,qBAA4B;AAC5B,qBAAgD;AAChD,2BAAqB;AAErB,uBAAwB;AACxB,mBAAkB;AAElB,iBAAqB;AACrB,+BAAkC;AAClC,sBAAoB;AACpB,oCAA0B;AAC1B,kCAAwB;AACxB,gCAAsB;AACtB,4BAA0B;AAC1B,wBAAsB;AACtB,qBAAmB;AACnB,0BAAwB;AACxB,0BAAwB;AACxB,uBAAqB;AACrB,qBAAmB;AACnB,yBAAuB;AACvB,2BAAyB;AACzB,qBAAmB;AACnB,wBAAsB;AA7BtB;AAAA;AAAA;AAAA;AAAA;AA+BA,MAAM,mBAAmB;AAEzB,SAAS,cAAc;AACnB,SAAO;AAAA,IACH,SAAS;AAAA,IACT,UAAU;AAAA,IACV,S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QACb;AAAA,MACJ;AAAA,IACJ;AACA,SAAK,UAAU,OAAO;AACtB,WAAO;AAAA,EACX;AACJ;",
|
|
5
|
+
"names": ["readline", "yargs", "cmdCommission", "cmdConfig", "cmdSession", "cmdNodes", "cmdSubscribe", "cmdIdentify", "cmdDiscover", "cmdAttributes", "cmdEvents", "cmdCommands", "cmdOta", "cmdCert", "cmdVendor", "cmdTlv", "cmdDcl"]
|
|
6
6
|
}
|
|
@@ -0,0 +1,154 @@
|
|
|
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 cmd_cert_exports = {};
|
|
20
|
+
__export(cmd_cert_exports, {
|
|
21
|
+
default: () => commands
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(cmd_cert_exports);
|
|
24
|
+
var import_general = require("#general");
|
|
25
|
+
/**
|
|
26
|
+
* @license
|
|
27
|
+
* Copyright 2022-2025 Matter.js Authors
|
|
28
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
29
|
+
*/
|
|
30
|
+
function commands(theNode) {
|
|
31
|
+
return {
|
|
32
|
+
command: "cert",
|
|
33
|
+
describe: "Certificate management operations",
|
|
34
|
+
builder: (yargs) => yargs.command(
|
|
35
|
+
["*", "list [vendor-id]"],
|
|
36
|
+
"List all stored certificates",
|
|
37
|
+
(yargs2) => {
|
|
38
|
+
return yargs2.positional("vendor-id", {
|
|
39
|
+
describe: "Filter by vendor ID (hex format like 0xFFF1 or decimal)",
|
|
40
|
+
type: "string"
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
async (argv) => {
|
|
44
|
+
const { vendorId: vendorIdStr } = argv;
|
|
45
|
+
await theNode.start();
|
|
46
|
+
let certificates = theNode.certificateService.certificates;
|
|
47
|
+
if (vendorIdStr) {
|
|
48
|
+
let vendorId;
|
|
49
|
+
if (vendorIdStr.startsWith("0x")) {
|
|
50
|
+
const hexStr = vendorIdStr.replace(/^0x/i, "");
|
|
51
|
+
vendorId = parseInt(hexStr, 16);
|
|
52
|
+
} else {
|
|
53
|
+
vendorId = parseInt(vendorIdStr, 10);
|
|
54
|
+
}
|
|
55
|
+
if (!isFinite(vendorId)) {
|
|
56
|
+
console.error(`Error: Invalid vendor ID "${vendorIdStr}"`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
certificates = certificates.filter((cert) => cert.vid === vendorId);
|
|
60
|
+
}
|
|
61
|
+
if (certificates.length === 0) {
|
|
62
|
+
console.log(
|
|
63
|
+
vendorIdStr ? `No certificates found for vendor ID ${vendorIdStr}.` : "No certificates found in storage."
|
|
64
|
+
);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
console.log(`
|
|
68
|
+
Found ${certificates.length} certificate(s):
|
|
69
|
+
`);
|
|
70
|
+
certificates.forEach((cert) => {
|
|
71
|
+
console.log(`Subject Key ID: ${cert.subjectKeyId}`);
|
|
72
|
+
console.log(` Subject: ${cert.subjectAsText || cert.subject || "N/A"}`);
|
|
73
|
+
console.log("");
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
).command(
|
|
77
|
+
"details <subject-key-id>",
|
|
78
|
+
"Display detailed information about a certificate",
|
|
79
|
+
(yargs2) => {
|
|
80
|
+
return yargs2.positional("subject-key-id", {
|
|
81
|
+
describe: "Subject Key ID of the certificate",
|
|
82
|
+
type: "string",
|
|
83
|
+
demandOption: true
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
async (argv) => {
|
|
87
|
+
const { subjectKeyId } = argv;
|
|
88
|
+
await theNode.start();
|
|
89
|
+
const cert = theNode.certificateService.getCertificate(subjectKeyId);
|
|
90
|
+
if (!cert) {
|
|
91
|
+
console.error(`Certificate with subject key ID ${subjectKeyId} not found`);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
console.log("\nCertificate Details:");
|
|
95
|
+
console.log(import_general.Diagnostic.json(cert));
|
|
96
|
+
}
|
|
97
|
+
).command(
|
|
98
|
+
"as-pem <subject-key-id>",
|
|
99
|
+
"Get certificate in PEM format",
|
|
100
|
+
(yargs2) => {
|
|
101
|
+
return yargs2.positional("subject-key-id", {
|
|
102
|
+
describe: "Subject Key ID of the certificate",
|
|
103
|
+
type: "string",
|
|
104
|
+
demandOption: true
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
async (argv) => {
|
|
108
|
+
const { subjectKeyId } = argv;
|
|
109
|
+
const normalizedId = subjectKeyId.replace(/:/g, "").toUpperCase();
|
|
110
|
+
await theNode.start();
|
|
111
|
+
const pemCert = await theNode.certificateService.getCertificateAsPem(normalizedId);
|
|
112
|
+
console.log(pemCert);
|
|
113
|
+
}
|
|
114
|
+
).command(
|
|
115
|
+
"delete <subject-key-id>",
|
|
116
|
+
"Deletes a certificate from the storage",
|
|
117
|
+
(yargs2) => {
|
|
118
|
+
return yargs2.positional("subject-key-id", {
|
|
119
|
+
describe: "Subject Key ID of the certificate to delete",
|
|
120
|
+
type: "string",
|
|
121
|
+
demandOption: true
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
async (argv) => {
|
|
125
|
+
const { subjectKeyId } = argv;
|
|
126
|
+
const normalizedId = subjectKeyId.replace(/:/g, "").toUpperCase();
|
|
127
|
+
await theNode.start();
|
|
128
|
+
await theNode.certificateService.deleteCertificate(normalizedId);
|
|
129
|
+
console.log(`Certificate ${subjectKeyId} deleted successfully`);
|
|
130
|
+
}
|
|
131
|
+
).command(
|
|
132
|
+
"update",
|
|
133
|
+
"Update certificates from DCL",
|
|
134
|
+
(yargs2) => yargs2.option("force", {
|
|
135
|
+
describe: "Force re-download and overwrite existing certificates",
|
|
136
|
+
type: "boolean",
|
|
137
|
+
default: false
|
|
138
|
+
}),
|
|
139
|
+
async (argv) => {
|
|
140
|
+
const { force } = argv;
|
|
141
|
+
await theNode.start();
|
|
142
|
+
console.log(`Updating certificates from DCL${force ? " (force mode)" : ""}...`);
|
|
143
|
+
await theNode.certificateService.update(force);
|
|
144
|
+
console.log("Certificate update completed successfully");
|
|
145
|
+
const count = theNode.certificateService.certificates.length;
|
|
146
|
+
console.log(`Total certificates in storage: ${count}`);
|
|
147
|
+
}
|
|
148
|
+
),
|
|
149
|
+
handler: async (argv) => {
|
|
150
|
+
argv.unhandled = true;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=cmd_cert.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/shell/cmd_cert.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,qBAA2B;AAN3B;AAAA;AAAA;AAAA;AAAA;AAUe,SAAR,SAA0B,SAAqB;AAClD,SAAO;AAAA,IACH,SAAS;AAAA,IACT,UAAU;AAAA,IACV,SAAS,CAAC,UACN,MACK;AAAA,MACG,CAAC,KAAK,kBAAkB;AAAA,MACxB;AAAA,MACA,CAAAA,WAAS;AACL,eAAOA,OAAM,WAAW,aAAa;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B,EAAE,KAAK;AAC9E,cAAM,QAAQ,mBAAmB,OAAO,KAAK;AAC7C,gBAAQ,IAAI,2CAA2C;AAEvD,cAAM,QAAQ,QAAQ,mBAAmB,aAAa;AACtD,gBAAQ,IAAI,kCAAkC,KAAK,EAAE;AAAA,MACzD;AAAA,IACJ;AAAA,IACR,SAAS,OAAO,SAAc;AAC1B,WAAK,YAAY;AAAA,IACrB;AAAA,EACJ;AACJ;",
|
|
5
|
+
"names": ["yargs"]
|
|
6
|
+
}
|
|
@@ -22,6 +22,7 @@ __export(cmd_config_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(cmd_config_exports);
|
|
24
24
|
var import_general = require("#general");
|
|
25
|
+
var import_protocol = require("@matter/protocol");
|
|
25
26
|
var import_app = require("../app");
|
|
26
27
|
/**
|
|
27
28
|
* @license
|
|
@@ -201,7 +202,37 @@ function commands(theNode) {
|
|
|
201
202
|
},
|
|
202
203
|
(argv) => doThreadCredentials(theNode, { action: "set", ...argv })
|
|
203
204
|
);
|
|
204
|
-
})
|
|
205
|
+
}).command(
|
|
206
|
+
"dcl-test-certificates",
|
|
207
|
+
"Manage DCL test certificate fetching (production only vs. include test)",
|
|
208
|
+
(yargs2) => {
|
|
209
|
+
return yargs2.command(
|
|
210
|
+
"* [action]",
|
|
211
|
+
"get/delete DCL test certificate setting",
|
|
212
|
+
(yargs3) => {
|
|
213
|
+
return yargs3.positional("action", {
|
|
214
|
+
describe: "get/delete",
|
|
215
|
+
choices: ["get", "delete"],
|
|
216
|
+
default: "get",
|
|
217
|
+
type: "string"
|
|
218
|
+
});
|
|
219
|
+
},
|
|
220
|
+
async (argv) => doDclTestCertificates(theNode, argv)
|
|
221
|
+
).command(
|
|
222
|
+
"set <value>",
|
|
223
|
+
"Enable or disable test certificate fetching from DCL",
|
|
224
|
+
(yargs3) => {
|
|
225
|
+
return yargs3.positional("value", {
|
|
226
|
+
describe: "Enable test certificates (true/false)",
|
|
227
|
+
type: "string",
|
|
228
|
+
choices: ["true", "false"],
|
|
229
|
+
demandOption: true
|
|
230
|
+
});
|
|
231
|
+
},
|
|
232
|
+
async (argv) => doDclTestCertificates(theNode, { action: "set", ...argv })
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
),
|
|
205
236
|
handler: async (argv) => {
|
|
206
237
|
argv.unhandled = true;
|
|
207
238
|
}
|
|
@@ -360,4 +391,34 @@ async function doThreadCredentials(theNode, args) {
|
|
|
360
391
|
break;
|
|
361
392
|
}
|
|
362
393
|
}
|
|
394
|
+
async function doDclTestCertificates(theNode, args) {
|
|
395
|
+
const { action, value } = args;
|
|
396
|
+
switch (action) {
|
|
397
|
+
case "get":
|
|
398
|
+
const enabled = await theNode.Store.get("DclFetchTestCertificates", false);
|
|
399
|
+
console.log(
|
|
400
|
+
`DCL test certificates: ${enabled ? "enabled (production + test + GitHub)" : "disabled (production only)"}`
|
|
401
|
+
);
|
|
402
|
+
break;
|
|
403
|
+
case "set":
|
|
404
|
+
if (value === void 0) {
|
|
405
|
+
console.log(`Cannot change DCL test certificates setting: New value not provided`);
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
const newValue = value === "true";
|
|
409
|
+
await theNode.Store.set("DclFetchTestCertificates", newValue);
|
|
410
|
+
await theNode.environment.close(import_protocol.DclCertificateService);
|
|
411
|
+
console.log(
|
|
412
|
+
`DCL test certificates: ${newValue ? "enabled (production + test + GitHub)" : "disabled (production only)"}. Please restart the shell for the changes to take effect.`
|
|
413
|
+
);
|
|
414
|
+
break;
|
|
415
|
+
case "delete":
|
|
416
|
+
await theNode.Store.delete("DclFetchTestCertificates");
|
|
417
|
+
await theNode.environment.close(import_protocol.DclCertificateService);
|
|
418
|
+
console.log(
|
|
419
|
+
`DCL test certificates setting reset to default (disabled). Please restart the shell for the changes to take effect.`
|
|
420
|
+
);
|
|
421
|
+
break;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
363
424
|
//# sourceMappingURL=cmd_config.js.map
|