nRF Connect SDK API 3.3.99
Loading...
Searching...
No Matches
app_jwt.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef _APP_JWT_H
8#define _APP_JWT_H
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
23#include <stdint.h>
24#include <stdbool.h>
25#include <strings.h>
26
30#define APP_JWT_STR_MAX_LEN 900
31
33#define APP_JWT_VALID_TIME_S_MAX (7 * 24 * 60 * 60)
34
36#define APP_JWT_VALID_TIME_S_DEF (10 * 60)
37
39#define APP_JWT_CLAIM_MAX_SIZE 64
40
46
51
55 unsigned int sec_tag;
60
66
71 const char *json_token_id;
73 const char *subject;
75 const char *audience;
77 const char *issuer;
78
84
90 uint32_t validity_s;
91
98 char *jwt_buf;
100 size_t jwt_sz;
101};
102
123int app_jwt_generate(struct app_jwt_data *const jwt);
124
125#if CONFIG_APP_JWT_PROVIDE_UUID
127#define APP_JWT_UUID_BYTE_SZ 16
128
130#define APP_JWT_UUID_V4_STR_LEN (((APP_JWT_UUID_BYTE_SZ * 2) + 4) + 1)
131
148int app_jwt_get_uuid(char *uuid_buffer, const size_t uuid_buffer_size);
149#endif /* CONFIG_APP_JWT_PROVIDE_UUID */
150
153#ifdef __cplusplus
154}
155#endif
156
157#endif /* _APP_JWT_H */
int app_jwt_generate(struct app_jwt_data *const jwt)
Generate a JWT using the supplied parameters. If successful, the JWT string will be stored in the sup...
app_jwt_alg_type
JWT signing algorithm.
Definition app_jwt.h:48
@ JWT_ALG_TYPE_ES256
Definition app_jwt.h:49
app_jwt_key_type
The type of key to be used for signing the JWT.
Definition app_jwt.h:42
@ JWT_KEY_TYPE_ENDORSEMENT
Definition app_jwt.h:44
@ JWT_KEY_TYPE_CLIENT_PRIV
Definition app_jwt.h:43
char * jwt_buf
Definition app_jwt.h:98
bool add_keyid_to_header
Definition app_jwt.h:65
const char * issuer
Definition app_jwt.h:77
uint32_t validity_s
Definition app_jwt.h:90
enum app_jwt_key_type key_type
Definition app_jwt.h:57
const char * subject
Definition app_jwt.h:73
const char * audience
Definition app_jwt.h:75
enum app_jwt_alg_type alg
Definition app_jwt.h:59
const char * json_token_id
Definition app_jwt.h:71
unsigned int sec_tag
Definition app_jwt.h:55
bool add_timestamp
Definition app_jwt.h:83
size_t jwt_sz
Definition app_jwt.h:100
JWT parameters required for JWT generation and pointer to generated JWT.
Definition app_jwt.h:53