跳到主要内容

Phase 4 — Custom RainMaker fabric init

Layer: Native MTR

After Apple commissioning succeeds, the host app commissions the device onto the RainMaker fabric.

Call chain​

initializeMatterControllerWithFabric​

  1. Loads user NOC from Keychain (loadUserNOCFromKeychain).
  2. Starts MTRDeviceControllerFactory with ESPMatterStorage (UserDefaults-backed).
  3. Creates MTRCSRKeys(groupId:) for operational keypair + IPK.
  4. Builds MTRDeviceControllerStartupParams (IPK, user NOC, root CA, vendor ID from Info.plist).
  5. Sets operationalCertificateIssuer = self (for device node NOC in Phase 6).
  6. Creates controller via createController(onExistingFabric:) or createController(onNewFabric:).
  7. Sets MTRDeviceControllerDelegate + attestation delegate.

What could go wrong​

User NOC not in Keychain → throws before session starts. Certificate PEM→DER conversion fails → controller init error. Factory already running from prior session → handled by shutdownMatterController() first.

On this page