28 lines
1.4 KiB
C
28 lines
1.4 KiB
C
#pragma once
|
|||
|
|
#include "esp_err.h"
|
||
|
|
#include "esp_http_client.h"
|
||
|
|
#include <stdbool.h>
|
||
|
|
#include <stdint.h>
|
||
|
|
|
||
|
|
// Factory credentials occupy a separate partition; existing Wi-Fi/voice NVS stays intact.
|
||
|
|
esp_err_t ble_cloud_init(void);
|
||
|
|
const char *ble_factory_id(void);
|
||
|
|
const char *ble_factory_model(void);
|
||
|
|
const char *ble_cloud_origin(void);
|
||
|
|
const char *ble_cloud_boot_id(void);
|
||
|
|
const char *ble_cloud_challenge_id(void);
|
||
|
|
esp_err_t ble_cloud_sync_time(void);
|
||
|
|
// Authenticates original base64url bytes before decoding, without exporting the key.
|
||
|
|
char *ble_cloud_decode(const char *domain, const char *encoded, const char *signature);
|
||
|
|
esp_err_t ble_factory_security(uint8_t salt[16], uint8_t verifier[384]);
|
||
|
|
// Fresh BLE-link bootstrap. Password is returned only to the local SRP worker.
|
||
|
|
esp_err_t ble_cloud_bootstrap(const char *client_nonce, char **response, char password[65]);
|
||
|
|
void ble_random_uuid(char out[37]);
|
||
|
|
bool ble_cloud_configured(void);
|
||
|
|
esp_err_t ble_cloud_headers(esp_http_client_handle_t client, const char *method,
|
||
|
|
const char *path, const char *body, const char *request_id);
|
||
|
|
// ESP_OK = committed, ESP_ERR_INVALID_RESPONSE = definite refusal; other errors are uncertain.
|
||
|
|
esp_err_t ble_cloud_bind(const char *token, const char *request_id);
|
||
|
|
// Wi-Fi-only provisioning verifies an existing binding without changing it.
|
||
|
|
esp_err_t ble_cloud_check_bound(const char *request_id);
|