From 4a292cb5ba9ecf582338023abb8b990d14805a3d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 5 Sep 2026 17:42:12 +0200 Subject: [PATCH] Document the runtime key methods instead of stubbing them --- esphome/components/api/api_server.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/esphome/components/api/api_server.h b/esphome/components/api/api_server.h index c8dd10d15d..128ba04428 100644 --- a/esphome/components/api/api_server.h +++ b/esphome/components/api/api_server.h @@ -77,19 +77,10 @@ class APIServer final : public Component, #ifdef USE_API_NOISE #ifndef USE_API_NOISE_PSK_FROM_YAML + // Runtime key changes exist for the provisioning path only (not lambdas); + // with a yaml key they compile out bool save_noise_psk(noise::psk_t psk, bool make_active = true); bool clear_noise_psk(bool make_active = true); -#else - // Stubs so a lambda calling these with a yaml key gets a clear error; only - // fire if instantiated - template bool save_noise_psk(noise::psk_t, bool = true) { - static_assert(B, "save_noise_psk() needs a runtime provisioned key; remove the 'key' from 'api: encryption:'"); - return false; - } - template bool clear_noise_psk(bool = true) { - static_assert(B, "clear_noise_psk() needs a runtime provisioned key; remove the 'key' from 'api: encryption:'"); - return false; - } #endif /// psk points at 32 bytes that live in flash for the life of the program void set_noise_psk(const uint8_t *psk) { this->noise_ctx_.set_psk(psk); }