12 #ifndef _ASTARTE_CREDENTIALS_H_
13 #define _ASTARTE_CREDENTIALS_H_
20 #define ASTARTE_CREDENTIALS_DEFAULT_NVS_PARTITION NULL
22 enum credential_type_t
24 ASTARTE_CREDENTIALS_CSR = 1,
25 ASTARTE_CREDENTIALS_KEY,
26 ASTARTE_CREDENTIALS_CERTIFICATE
30 void *opaque,
enum credential_type_t cred_type,
const void *credential,
size_t length);
32 void *opaque,
enum credential_type_t cred_type,
char *out,
size_t length);
33 typedef bool (*astarte_credentials_exists_t)(
void *opaque,
enum credential_type_t cred_type);
35 void *opaque,
enum credential_type_t cred_type);
39 astarte_credentials_store_t astarte_credentials_store;
40 astarte_credentials_fetch_t astarte_credentials_fetch;
41 astarte_credentials_exists_t astarte_credentials_exists;
42 astarte_credentials_remove_t astarte_credentials_remove;
168 const char *cert_pem,
char *out,
size_t length);
245 void *opaque,
enum credential_type_t cred_type,
const void *credential,
size_t length);
253 void *opaque,
enum credential_type_t cred_type,
char *out,
size_t length);
260 bool astarte_credentials_exists(
void *opaque,
enum credential_type_t cred_type);
267 astarte_err_t astarte_credentials_remove(
void *opaque,
enum credential_type_t cred_type);
275 void *opaque,
enum credential_type_t cred_type,
const void *credential,
size_t length);
283 void *opaque,
enum credential_type_t cred_type,
char *out,
size_t length);
290 bool astarte_credentials_nvs_exists(
void *opaque,
enum credential_type_t cred_type);
297 astarte_err_t astarte_credentials_nvs_remove(
void *opaque,
enum credential_type_t cred_type);
Astarte types and defines.
astarte_err_t
Astarte return codes.
Definition: astarte.h:28
astarte_err_t astarte_credentials_get_csr(char *out, size_t length)
get the saved CSR
bool astarte_credentials_has_certificate()
check if the certificate exists
astarte_err_t astarte_credentials_create_key()
create Astarte private key.
astarte_err_t astarte_credentials_get_key(char *out, size_t length)
get the private key to connect with the Astarte MQTT v1 protocol
astarte_err_t astarte_credentials_create_csr()
create Astarte CSR to be sent to Pairing API.
bool astarte_credentials_has_key()
check if the private key exists
astarte_err_t astarte_credentials_set_storage_context(astarte_credentials_context_t *creds_context)
replace credentials context.
astarte_err_t astarte_credentials_get_stored_credentials_secret(char *out, size_t length)
get the stored credentials_secret
bool astarte_credentials_has_csr()
check if the CSR exists
astarte_err_t astarte_credentials_set_stored_credentials_secret(const char *credentials_secret)
save the credentials_secret in the NVS
astarte_err_t astarte_credentials_delete_certificate()
delets the saved certificate used to connect with the Astarte MQTT v1 protocol
astarte_err_t astarte_credentials_save_certificate(const char *cert_pem)
save the certificate to connect with the Astarte MQTT v1 protocol
astarte_err_t astarte_credentials_init()
initialize Astarte credentials.
astarte_err_t astarte_credentials_get_certificate(char *out, size_t length)
get the certificate to connect with the Astarte MQTT v1 protocol
astarte_err_t astarte_credentials_erase_stored_credentials_secret()
delete the credentials_secret from the NVS
astarte_err_t astarte_credentials_use_nvs_storage(const char *partition_label)
use a NVS partition as credentials context.
astarte_err_t astarte_credentials_get_certificate_common_name(const char *cert_pem, char *out, size_t length)
get the certificate Common Name
bool astarte_credentials_is_initialized()
check if Astarte credentials are initialized.
Definition: astarte_credentials.h:46
Definition: astarte_credentials.h:38