Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Successful in 9s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Successful in 12s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Successful in 11s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make-Without-sqlite3 (push) Successful in 9s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake-Without-sqlite3 (push) Successful in 14s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson-Without-sqlite3 (push) Successful in 12s
25 lines
871 B
C
25 lines
871 B
C
#ifndef JWT_H
|
|
#define JWT_H
|
|
|
|
#include <cJSON.h>
|
|
|
|
#define JWT_DEFAULT_SECRET "secret"
|
|
|
|
// Base64URL кодирование/декодирование
|
|
char *jwt_base64url_encode(const unsigned char *input, int length);
|
|
unsigned char *jwt_base64url_decode(const char *input, int input_len,
|
|
int *output_len);
|
|
|
|
// Создание и верификация JWT
|
|
char *jwt_createJWT(const char *header_json, const char *payload_json,
|
|
const char *secret);
|
|
unsigned char *jwt_hmac_sha256(const char *key, int key_len, const char *data,
|
|
int data_len, unsigned int *digest_len);
|
|
bool jwt_verifyJWT(const char *token, const char *secret);
|
|
|
|
// Получение данных из токена
|
|
cJSON *jwt_get_payload(const char *token);
|
|
cJSON *jwt_get_header(const char *token);
|
|
|
|
#endif // JWT_H
|