Expand description
Matter commissioning: setup payloads, device attestation, NOC issuance, network commissioning, and the state machine that sequences them.
The commissioning flow here has been driven against real Matter hardware — over IP and over BLE, onto Wi-Fi and onto Thread.
If you want a complete controller — commissioning plus reading, writing,
invoking, and subscribing — use matter-controller, which is built on
this crate. Reach for matter-commissioning directly when you want the
commissioning pieces on their own, or want to drive the state machine from
your own IO layer.
§What’s here
setup— QR and manual pairing codes, decode and encode.attestation— typedDac/Pai/Paawrappers, chain validation against aPaaTrustStoreviaverify_chain(rustls-webpkipath validation plus a Matter VID/PID overlay),verify_attestation_responsefor the device’s signed attestation, and CSA Certification Declaration (CMS) verification againstCdSigningRoots.noc— Node Operational Certificate issuance:FabricRecord, CSR verification, RCAC/NOC minting, and theOperationalCredentialscommand codecs.state_machine— a sans-IO cursor over the whole flow, fromStage::SecurePairingthroughAction::Done(CommissionedFabric): attestation, CSR and NOC installation, the network-commissioning subgraph, and the PASE→CASE handoff. It emitsActions and consumes responses; it performs no IO of its own.clustersandthread_dataset— theGeneralCommissioningandNetworkCommissioningcommand codecs, and Thread Operational Dataset parsing.im— Interaction Model framing, re-exported frommatter_interaction.driver(behind the off-by-defaultdriverfeature) — the async Tokio IO layer that runs the state machine for real: PASE, mDNS discovery, CASE, and the Invoke/Read round-trips in between.
Network commissioning covers Wi-Fi and Thread; a device already on its
operational network (Ethernet, or Wi-Fi it has already joined) skips the
network sub-cursor entirely. A device whose NetworkCommissioning feature
map does not match the credentials you supplied fails fast with a typed
NetworkFeatureUnsupported error, and RemediationHint categorises
NetworkRejected failures into actionable causes.
§Quick-start: parse a setup payload
use matter_commissioning::setup::{parse_qr, parse_manual_code};
let from_qr = parse_qr("MT:Y.K90AFN00KA0648G00")?;
let from_manual = parse_manual_code("11693312331")?;
assert_eq!(from_qr.vendor_id, Some(0xFFF1));
assert_eq!(from_manual.passcode.as_u32(), 20_202_021);Those are the spec’s example codes; substitute the ones printed on your own device.
§Optional tracing feature
Enable the tracing crate feature to get per-method spans on
Commissioner::poll, Commissioner::on_response, and
Commissioner::on_case_established. Span fields (stage,
expectation) align best-effort with matter.js’s log-event format
so operators can grep across both implementations. Compatibility
is not guaranteed across matter.js minor versions.
Re-exports§
pub use setup::encode_manual_code;pub use setup::encode_qr;pub use setup::parse_manual_code;pub use setup::parse_qr;pub use setup::CommissioningFlow;pub use setup::DiscoveryCapabilities;pub use setup::Discriminator;pub use setup::Error as SetupError;pub use setup::Passcode;pub use setup::SetupPayload;pub use attestation::extract_attestation_elements_fields;pub use attestation::verify_attestation_response;pub use attestation::verify_certification_declaration;pub use attestation::verify_certification_declaration_with_paa;pub use attestation::verify_chain;pub use attestation::verify_dac_signed_elements;pub use attestation::AttestationElementsFields;pub use attestation::AttestationError;pub use attestation::AttestationResponse;pub use attestation::CdSigningRoots;pub use attestation::ChainVerification;pub use attestation::Dac;pub use attestation::Paa;pub use attestation::PaaTrustStore;pub use attestation::Pai;pub use attestation::ProductId;pub use attestation::VendorId;pub use noc::decode_attestation_response;pub use noc::decode_certificate_chain_response;pub use noc::decode_csr_response;pub use noc::decode_noc_response;pub use noc::encode_add_noc;pub use noc::encode_add_trusted_root;pub use noc::encode_attestation_request;pub use noc::encode_certificate_chain_request;pub use noc::encode_csr_request;pub use noc::encode_update_noc;pub use noc::issue_icac;pub use noc::issue_noc;pub use noc::parse_and_verify_csr;pub use noc::parse_nocsr;pub use noc::verify_csr_response;pub use noc::CertChainType;pub use noc::CertificateChainResponse;pub use noc::CsrResponse;pub use noc::FabricRecord;pub use noc::NocError;pub use noc::NocResponse;pub use noc::NocRng;pub use noc::NocsrElements;pub use noc::ParsedCsr;pub use noc::SystemNocRng;pub use noc::VerifiedCsr;pub use clusters::network_commissioning::decode_connect_network_response;pub use clusters::network_commissioning::decode_feature_map;pub use clusters::network_commissioning::decode_network_config_response;pub use clusters::network_commissioning::encode_add_or_update_wifi_network;pub use clusters::network_commissioning::encode_connect_network;pub use clusters::network_commissioning::remediation_for;pub use clusters::network_commissioning::ConnectNetworkResponse;pub use clusters::network_commissioning::NetworkCommissioningFeature;pub use clusters::network_commissioning::NetworkConfigResponse;pub use state_machine::Action;pub use state_machine::CommissionedFabric;pub use state_machine::Commissioner;pub use state_machine::CommissionerConfig;pub use state_machine::CommissioningError;pub use state_machine::Expectation;pub use state_machine::NetworkCredentials;pub use state_machine::NetworkKind;pub use state_machine::RemediationHint;pub use state_machine::SessionContext;pub use state_machine::Stage;pub use state_machine::WiFiCredentials;pub use thread_dataset::ThreadDataset;pub use thread_dataset::ThreadDatasetError;pub use matter_interaction as im;
Modules§
- attestation
- Matter device attestation verification.
- clusters
- Per-cluster command + attribute codecs for clusters used during commissioning.
- error
- Error type for
matter-commissioning. Implemented in Milestone 6. - noc
- Node Operational Certificate (NOC) issuance.
- setup
- Setup payload parsing and encoding for Matter QR codes and manual pairing codes (Matter Core Spec §5.1).
- state_
machine - Commissioning state machine.
- thread_
dataset - Thread operational dataset validation and Extended PAN ID extraction.
Structs§
- Attribute
Path - A concrete attribute path:
(endpoint, cluster, attribute). - Command
Path - A concrete command path:
(endpoint, cluster, command). - Report
Data - Parsed
ReportDataMessage(Matter §10.6.4).
Enums§
- ImError
- Errors produced while building or parsing Interaction Model messages.
- ImStatus
- An Interaction Model status, as carried by a
StatusIB. - Invoke
Response - Outcome of parsing a single-command
InvokeResponseMessage.
Constants§
- IM_
REVISION - Interaction Model protocol revision emitted at context tag
0xFFin every top-level IM message. Confirmed against the matter.js byte-parity fixture (seetests/im_byte_parity.rs); bump only when a captured fixture proves matter.js changed it.
Functions§
- build_
invoke_ request - Build an
InvokeRequestMessagecarrying a single command. - build_
read_ request - Build a
ReadRequestMessagefor one or more concrete attribute paths. - parse_
invoke_ response - Parse a single-command
InvokeResponseMessage. - parse_
report_ data - Parse a
ReportDataMessageinto concrete(path, value)pairs.