Files
esp-rainmaker/components/esp_rainmaker/include/esp_rmaker_chal_resp.h
Piyush Shah 8ae0a34001 feat(rmaker): Add on-network challenge-response service for user-node mapping
This feature is intended for mapping already-provisioned nodes to user
accounts without re-provisioning.

Common features (both implementations):
- mDNS service: _esp_rmaker_chal_resp._tcp
- TXT records: node_id, port, sec_version, pop_required
- Optional instance name support (NULL uses node_id as default)
- Supports Security 0, 1 (with/without PoP), and 2 (SRP6a)
- Both use the same mDNS service type, simplifying CLI discovery

1. Standalone HTTP protocomm based challenge-response service.

   - Config: CONFIG_ESP_RMAKER_ON_NETWORK_CHAL_RESP_ENABLE
   - Endpoint: ch_resp (on protocomm HTTP server, default port 80)
   - Instance name via config.mdns_instance_name

   APIs:
   - esp_rmaker_on_network_chal_resp_start()
   - esp_rmaker_on_network_chal_resp_stop()
   - esp_rmaker_on_network_chal_resp_is_running()

   Note: Mutually exclusive with Local Control

2. Challenge-response support on local control.

   - Config: CONFIG_ESP_RMAKER_LOCAL_CTRL_CHAL_RESP_ENABLE
   - Endpoint: ch_resp (via esp_local_ctrl_set_handler)
   - Instance name via parameter to enable function

   APIs:
   - esp_rmaker_local_ctrl_enable_chal_resp(instance_name)
   - esp_rmaker_local_ctrl_disable_chal_resp()

3. CLI and console improvements.

   - CLI simplified to discover only _esp_rmaker_chal_resp._tcp service
   - Console command supports optional instance name: chal-resp-enable [instance_name]
   - Device discovery output shows instance name column

Clients can choose to disable the challenge-response endpoint after
usage to avoid potential misuse by other entities on the network.

commit
2026-01-08 19:05:35 +05:30

36 lines
619 B
C

/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <esp_err.h>
#ifdef __cplusplus
extern "C"
{
#endif
/** Initialize Challenge Response
*
* This initializes the challenge response module.
*
* @return ESP_OK on success
* @return error on failure
*/
esp_err_t esp_rmaker_chal_resp_init(void);
/** Deinitialize Challenge Response
*
* This deinitializes the challenge response module.
*
* @return ESP_OK on success
* @return error on failure
*/
esp_err_t esp_rmaker_chal_resp_deinit(void);
#ifdef __cplusplus
}
#endif