mirror of
https://github.com/espressif/openthread.git
synced 2026-10-29 18:54:06 +00:00
This commit introduces the Thread Direct (TD) key management module (`ThreadDirect::KeyManager`, `Key`, and `KeyId`) along with its public C APIs in `<openthread/thread_direct.h>`. - Add `KeyManager` and `otThreadDirect*Key*` APIs to register, find, iterate over, and unregister Thread Direct keys, supporting both literal keys and `otCryptoKeyRef` key references. - Track the MAC security frame counter per `Key` and persist an ahead frame counter in `Settings`. When a key's frame counter is incremented and reaches the saved counter, `KeyManager` posts a tasklet to re-save the key with a newly advanced counter (adding the updated entry before removing stale entries from `Settings` to ensure crash safety across resets). - Restore saved keys on instance initialization and clear them on factory reset or persistent info erase. - Add Thread Direct compile-time configs in `config/thread_direct.h` for configuring pool vs. heap key allocation, max registered keys, and persistent frame counter ahead value. - Add `test_thread_direct_key_manager` Nexus test covering key registration, lookup, iteration, capacity limits, frame counter advancement and persistence across resets, and unregistration.