Encode header to base64

This commit is contained in:
2024-09-21 20:43:02 +02:00
parent cf31de5b67
commit c55c55d56d
6 changed files with 62 additions and 2 deletions

View File

@ -4,6 +4,7 @@
#include "jwt.h"
#include "dev_name.h"
#include "crypto.h"
#include "esp_log.h"
@ -34,7 +35,19 @@ char *jwt_gen(cJSON *payload)
return NULL;
}
printf("header: %s\n", header);
char *header_b64 = crypto_encode_base64_safe_url(header, strlen(header));
free(header);
if (!header_b64)
{
ESP_LOGE(TAG, "Failed to encode header to base64!");
return NULL;
}
printf("header = %s\n", header_b64);
free(header_b64);
// TODO : continue
return strdup("TODO:)");
}