class

Matter::FabricTable

Inherits Reference < Object

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)

Constants

DEFAULT_MAX_FABRICS = 16_u8

Maximum number of fabrics a device can support Matter spec requires minimum 5, but devices may support more

Log = ::Log.for("matter.fabric_table")
STORAGE_CONTEXT = ["fabrics"]

Storage context for fabric persistence

Constructors

new(storage : Storage::Base, max_fabrics : UInt8 = DEFAULT_MAX_FABRICS)
Source

Instance methods

add_fabric(fabric : Fabric) : Bool

Add a new fabric to the table

Source
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, root_cert : Bytes | Nil = nil) : Fabric | Nil

Add a fabric with automatic index assignment

Source
all_fabrics

Get all fabrics

Source
available_slots

Get number of available slots

Source
clear_all

Clear all fabrics (used for factory reset)

Source
empty?

Check if table is empty

Source
export

Export all fabrics for backup

Source
fabric_descriptors

Get all fabric descriptors (for Fabrics attribute)

Source
find_by_fabric_id(fabric_id : UInt64) : Fabric | Nil

Find a fabric by fabric_id

Source
find_by_fabric_identity(fabric_id : UInt64, root_public_key : Bytes) : Fabric | Nil

Find a fabric by its identity (root_public_key + fabric_id).

Source
full?

Check if table is full

Source
get_fabric(fabric_index : UInt8) : Fabric | Nil

Get a fabric by fabric_index

Source
import(json : String) : Bool

Import fabrics from backup (replaces existing)

Source
load_from_storage

Load fabrics from storage

Source
mark_fabric_used(fabric_index : UInt8) : Bool

Mark a fabric as recently used (updates last_used_at)

Source
max_fabrics

Maximum number of fabrics this device supports

Source
max_fabrics=(max_fabrics : UInt8)

Maximum number of fabrics this device supports

Source
next_available_index

Find next available fabric index (1-254)

Source
persist_to_storage

Persist fabrics to storage

Source
remove_fabric(fabric_index : UInt8) : Bool

Remove a fabric by fabric_index

Source
remove_fabric_by_id(fabric_id : UInt64) : Bool

Remove a fabric by fabric_id

Source
size

Get fabric count

Source
statistics

Get statistics about fabric usage

Source
update_fabric(fabric : Fabric) : Bool

Update an existing fabric

Source
used_indices

Get all fabric indices currently in use

Source
validate

Validate fabric table consistency

Source