class
Matter::FabricTable
- Matter::FabricTable
- Reference
- Object
Overview
FabricTable manages the collection of fabrics on a device
Matter devices can be members of multiple fabrics simultaneously (multi-admin). Each fabric represents a separate administrative domain with its own trust root, operational certificates, and access control.
The FabricTable:
- Stores up to a device-specific maximum number of fabrics (typically 16)
- Assigns unique local fabric indices (1-254)
- Persists fabrics to storage
- Provides lookup by fabric_index or fabric_id
- Handles fabric lifecycle (add, update, remove)
Specification: Matter 1.4 ยง 4.13.3 (Fabric Table)
Defined in:
matter/fabric_table.crConstant Summary
-
DEFAULT_MAX_FABRICS =
16_u8 -
Maximum number of fabrics a device can support Matter spec requires minimum 5, but devices may support more
-
STORAGE_CONTEXT =
["fabrics"] -
Storage context for fabric persistence
Constructors
Instance Method Summary
-
#add_fabric(fabric : Fabric) : Bool
Add a new fabric to the table
-
#add_fabric_auto_index(fabric_id : UInt64, node_id : UInt64, root_public_key : Bytes, operational_cert : Bytes, operational_key : Crypto::Key, ipk : Bytes, vendor_id : UInt16 = 65521_u16, label : String = "", intermediate_cert : Bytes | Nil = nil) : Fabric | Nil
Add a fabric with automatic index assignment
-
#all_fabrics : Array(Fabric)
Get all fabrics
-
#available_slots : Int32
Get number of available slots
-
#clear_all
Clear all fabrics (used for factory reset)
-
#empty? : Bool
Check if table is empty
-
#export : String
Export all fabrics for backup
-
#fabric_descriptors : Array(FabricDescriptor)
Get all fabric descriptors (for Fabrics attribute)
-
#find_by_fabric_id(fabric_id : UInt64) : Fabric | Nil
Find a fabric by fabric_id
-
#full? : Bool
Check if table is full
-
#get_fabric(fabric_index : UInt8) : Fabric | Nil
Get a fabric by fabric_index
-
#import(json : String) : Bool
Import fabrics from backup (replaces existing)
-
#load_from_storage
Load fabrics from storage
-
#mark_fabric_used(fabric_index : UInt8) : Bool
Mark a fabric as recently used (updates last_used_at)
-
#max_fabrics : UInt8
Maximum number of fabrics this device supports
-
#max_fabrics=(max_fabrics : UInt8)
Maximum number of fabrics this device supports
-
#next_available_index : UInt8 | Nil
Find next available fabric index (1-254)
-
#persist_to_storage
Persist fabrics to storage
-
#remove_fabric(fabric_index : UInt8) : Bool
Remove a fabric by fabric_index
-
#remove_fabric_by_id(fabric_id : UInt64) : Bool
Remove a fabric by fabric_id
-
#size : Int32
Get fabric count
-
#statistics : Hash(String, Int32 | Float64)
Get statistics about fabric usage
-
#update_fabric(fabric : Fabric) : Bool
Update an existing fabric
-
#used_indices : Array(UInt8)
Get all fabric indices currently in use
-
#validate : Array(String)
Validate fabric table consistency
Constructor Detail
Instance Method Detail
Add a fabric with automatic index assignment
Get all fabric descriptors (for Fabrics attribute)
Mark a fabric as recently used (updates last_used_at)