Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify Matter.framework to allow per-controller storage. (#28533)
* Modify Matter.framework to allow per-controller storage. This also allows starting multiple controllers with different node IDs on a single fabric. Public API changes: * It's now possible to initialize MTRDeviceControllerFactoryParams without storage. When a factory is then started with those params, it will expect storage to be provided for every controller that is created. * Controllers to be created in the new setup use MTRDeviceControllerStartupParameters, not MTRDeviceControllerStartupParams. * When starting a controller, API clients provide a UUID for that controller (which is then exposed on the MTRDeviceController) and a storage delegate. * For now, the only supported controller startup mode is for the client to provide the full certificate chain, operational key and vendor ID, via MTRDeviceControllerExternalCertificateStartupParameters. For controllers that will commission devices, that means also providing an MTROperationalCertificateIssuer. * The new "create a controller" API is called createController. * The new MTRDeviceControllerStorageDelegate API provides some context for the key/value pairs in terms of whether they need to be stored in encrypted storage or not, and whether they can be shared across multiple devices and under what conditions. Implementation notes: * MTRDemuxingStorage handles directing storage requests to the right per-controller storage object. * MTRDeviceControllerDataStore wraps the raw storage delegate and provides a semantic API on top of its key/value storage for the storage operations we actually want to perform. * MTRSessionResumptionStorageBridge implements session resumption storage, acting as an adapter between the Matter session resumption storage API and MTRDeviceControllerDataStore. In particular, it happens locating the right controller(s) to talk to and so on. This avoids dealing with the default Matter implementation's use of non-fabric-index-scoped keys for storing session resumption information. Fixes #27394 * Require consumers to provide a dispatch queue for the storage delegate. * Address review comments. * Apply spelling/grammar suggestions from code review Co-authored-by: Nivi Sarkar <[email protected]> * Address review comments. * Address more review comments. * Address more review comments. * Address more review comments. * Add some validation when deserializing node IDs and CATs. * Stop trusting the secure coding stuff to actually enforce types correctly. For built-in types it seems to not do that. * Remove NSMutableArray and NSSet from controller storage classes, since we no longer encode those. --------- Co-authored-by: Nivi Sarkar <[email protected]>
- Loading branch information