In development. It changes without notice.
Topic
Bond Storage
The bonded hosts: their identity, the name the owner gave each, their order, and the removal of one.
- kleidos::
ble:: bond:: NameStore is the board's table of hosts: one slot for each admitted host, or for a forgotten one whose key is still to be deleted. Each record has a checksum. - kleidos::
ble:: bond:: NameStoreTask is the one task that reads and writes the table in NVS, apart from the Bluetooth controller's own use of it. - kleidos::
ble:: bond:: BondStore is the one place that changes the table and the stack's keys together: the admission of a host, its removal, and the check, before advertising, that the two agree.
The keys stay in the stack's own storage; here are only identities and names. The table is not opened while the radio is up.
Files | |
| file | src/ |
| Keeps the device's bond table and NimBLE's keystore in step. | |
| file | src/ |
| The order the owner lists the bonded hosts in. | |
| file | src/ |
| The device's bond table: one NVS-backed slot per admitted BLE host. | |
| file | src/ |
Core 0 task that serializes all NameStore NVS access. | |
Classes | |
| struct | kleidos:: |
| What the main-task drain does with a newly secured link, by its admission. More about kleidos:: | |
| class | kleidos:: |
| Static coordinator that keeps the bond table and NimBLE's keystore in step. More about kleidos:: | |
| class | kleidos:: |
| Static facade over the persisted bond table. More about kleidos:: | |
| class | kleidos:: |
| Static owner of the host-name persistence task. More about kleidos:: | |
Typedefs | |
| using | kleidos:: |
| Bonded-host record alias. | |
Functions | |
| constexpr AdmissionAction | kleidos:: |
| What the drain does with a link BondStore:: | |
| constexpr bool | kleidos:: |
| Whether a record lists a host (a tombstone and an empty slot do not). | |
| constexpr uint8_t | kleidos:: |
| The listed hosts' slots, in the owner's order. | |
| constexpr bool | kleidos:: |
Move slot one place in an ordered list of slots. | |
| constexpr uint8_t | kleidos:: |
| Where a host that joins the table goes: after every listed host. | |
| constexpr uint8_t | kleidos:: |
Where the host in slot sits in the owner's list. | |
Variables | |
| constexpr uint8_t | kleidos:: |
| Bond-table capacity. | |
| constexpr uint8_t | kleidos:: |
| Sentinel for "no matching bond slot". | |
| constexpr uint8_t | kleidos:: |
NimBLE keystore capacity — MUST mirror CONFIG_. | |
| constexpr uint8_t | kleidos:: |
| A slot no host holds, as returned by a lookup that found nothing. | |
Enumeration Type Documentation
Admission #
What a newly secured link adds to the bond table (BondStore::).
HostMove #
IrkRotation #
What BondStore:: did with the device's privacy key.
Listing #
Function Documentation
actionFor() #
What the drain does with a link BondStore::
A forgotten host that came back on its old key is dropped and never reads as a host: its link would otherwise stay authenticated whenever the delete of that key failed again, and a send could type to a laptop the owner removed (finding C9).
- Parameters
-
Name Direction Meaning admission in The verdict.
- Returns
- Whether the link stays and whether the replace-oldest prompt arms.
listsHost() #
Whether a record lists a host (a tombstone and an empty slot do not).
- Parameters
-
Name Direction Meaning record in A bond-table record.
- Returns
truefor an active host.
move() #
Move slot one place in an ordered list of slots.
- Parameters
-
Name Direction Meaning slots in, out The slots in order, as orderedSlots wrote them. count in How many of slotsare listed.slot in The host to move. dir in Which way.
- Return values
-
Value Meaning true The host moved. false It is already at that edge, or slotis not listed.
nextOrder() #
Where a host that joins the table goes: after every listed host.
- Parameters
-
Name Direction Meaning table in The bond table, every slot.
- Returns
- One past the largest position a listed host holds, or 0 on an empty table.
orderedSlots() #
The listed hosts' slots, in the owner's order.
Sorted by (order, slot): hosts that share a position (a table written before the order existed, or a gap a delete left) keep their slot order.
- Parameters
-
Name Direction Meaning table in The bond table, every slot. out out The slots in order; entries past the count are kNoSlot.
- Returns
- How many hosts are listed.
placeOf() #
Where the host in slot sits in the owner's list.
- Parameters
-
Name Direction Meaning slots in The slots in order. count in How many are listed. slot in The host.
- Returns
- Its 0-based place, or
kNoSlotwhen it is not listed.
Variable Documentation
kNimbleStoreCapacity #
NimBLE keystore capacity — MUST mirror CONFIG_.
One slot of HEADROOM over the app host limit (kMaxHosts). Without it a fresh (kMaxHosts+1)-th pairing overflows NimBLE's store, and its default round-robin store_ (ble_) silently evicts the oldest legitimate bond BEFORE the app's deny-by-default eviction prompt can run. With the headroom the candidate persists in the spare slot, the app's drain finds no free slot and arms the prompt, and the oldest bond is evicted only on explicit approval. The spare slot is transient headroom for a pending candidate, NOT a (kMaxHosts+1)-th usable host — the user-visible host limit stays kMaxHosts. A static assertion of the device build binds this to MYNEWT_, so the build configuration and this constant cannot differ.