SolarEnergy/esp32_device/main/main.c
2024-08-16 11:51:33 +02:00

41 lines
717 B
C
Executable File

#include <stdio.h>
#include "esp_system.h"
#include "dev_name.h"
#include "storage.h"
#include "system.h"
#include "crypto.h"
void app_main(void)
{
printf("\n");
if (storage_init() == false)
{
printf("Failed to init storage!\n");
reboot();
}
if (dev_generate_name())
{
printf("Generated a new device name\n");
}
char *name = dev_name();
printf("Dev name: %s\n", name);
free(name);
if (crypto_gen_priv_key())
{
printf("Generated device private key!\n");
}
printf("Device private key:\n");
crypto_print_priv_key();
char *csr = crypto_get_csr();
printf("Current CSR:\n%s\n", csr);
free(csr);
reboot();
}