class Matter::FabricTable

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:

Specification: Matter 1.4 ยง 4.13.3 (Fabric Table)

Defined in:

matter/fabric_table.cr

Constant 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

Constructor Detail

def self.new(storage : Storage::Base, max_fabrics : UInt8 = DEFAULT_MAX_FABRICS) #

[View source]

Instance Method Detail

def add_fabric(fabric : Fabric) : Bool #

Add a new fabric to the table


[View source]
def 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


[View source]
def all_fabrics : Array(Fabric) #

Get all fabrics


[View source]
def available_slots : Int32 #

Get number of available slots


[View source]
def clear_all #

Clear all fabrics (used for factory reset)


[View source]
def empty? : Bool #

Check if table is empty


[View source]
def export : String #

Export all fabrics for backup


[View source]
def fabric_descriptors : Array(FabricDescriptor) #

Get all fabric descriptors (for Fabrics attribute)


[View source]
def find_by_fabric_id(fabric_id : UInt64) : Fabric | Nil #

Find a fabric by fabric_id


[View source]
def full? : Bool #

Check if table is full


[View source]
def get_fabric(fabric_index : UInt8) : Fabric | Nil #

Get a fabric by fabric_index


[View source]
def import(json : String) : Bool #

Import fabrics from backup (replaces existing)


[View source]
def load_from_storage #

Load fabrics from storage


[View source]
def mark_fabric_used(fabric_index : UInt8) : Bool #

Mark a fabric as recently used (updates last_used_at)


[View source]
def max_fabrics : UInt8 #

Maximum number of fabrics this device supports


[View source]
def max_fabrics=(max_fabrics : UInt8) #

Maximum number of fabrics this device supports


[View source]
def next_available_index : UInt8 | Nil #

Find next available fabric index (1-254)


[View source]
def persist_to_storage #

Persist fabrics to storage


[View source]
def remove_fabric(fabric_index : UInt8) : Bool #

Remove a fabric by fabric_index


[View source]
def remove_fabric_by_id(fabric_id : UInt64) : Bool #

Remove a fabric by fabric_id


[View source]
def size : Int32 #

Get fabric count


[View source]
def statistics : Hash(String, Int32 | Float64) #

Get statistics about fabric usage


[View source]
def update_fabric(fabric : Fabric) : Bool #

Update an existing fabric


[View source]
def used_indices : Array(UInt8) #

Get all fabric indices currently in use


[View source]
def validate : Array(String) #

Validate fabric table consistency


[View source]