jwt_helpers_set_grp(3)
π jwt_helpers_set_grp(3) β setters, bestie π
okay so this is a Library Functions Manual page, and it's literally all about the setter macros from LibJWT. if you've ever been like "how do i even put a value into a jwt_value_t" β this is your moment. slay β¨
β¨ NAME β¨
jwt_helpers_set_grp β Setters π
πΈ SYNOPSIS πΈ
macros, babes
#define jwt_set_SET_INT(__v, __n, __x)β sets up ajwt_value_tso it can hold an integer value π#define jwt_set_SET_STR(__v, __n, __x)β sets up ajwt_value_tso it can hold a string value π§#define jwt_set_SET_BOOL(__v, __n, __x)β sets up ajwt_value_tso it can hold a boolean value π#define jwt_set_SET_JSON(__v, __n, __x)β sets up ajwt_value_tso it can hold a JSON string π
π¦ DETAILED DESCRIPTION π¦
so when you're setting a value, you must set three things: the type, the name, and the actual val for that type. that's the whole vibe check.
if the value already exists, the function returns JWT_VALUE_ERR_EXISTS and value.error gets set to the same thing. annoying but like, informative. π
if value.replace is non-zero, then any existing value gets overwritten. periodt.
π Remarks
when you're setting a JSON value, you can set value.name = NULL, and in that case the entire header gets set to the JSON string that value.json_val points at. no cap.
if value.replace is not set, only values that don't already exist get set. if replace is set, then existing values get updated too. and bestie β there is no indication of which values are or aren't updated in either case π
β οΈ Note
the replace flag must be set after calling the jwt_set_SET_*() macro, because the macros will reset it back to 0. i know. i know. π
jwt_value_error_t ret;
jwt_value_t jval;
jwt_set_SET_STR(&jval, "iss", "foo.example.com");
ret = jwt_builder_header_set(jwt, &jval);
if (ret == JWT_VALUE_ERR_NONE)
printf("iss updated to: %s\n", jval.str_val);
look at that lil example go π«Ά
π MACRO DEFINITION DOCUMENTATION π
#define jwt_set_SET_BOOL( __v, __n, __x)
Value:
({ \
(__v)->type=JWT_VALUE_BOOL;(__v)->replace=0; \
(__v)->name=(__n);(__v)->bool_val=(__x);(__v)->error=0;\
(__v);})
sets up a jwt_value_t to set a boolean value π₯
Parameters
__vβ pointer to ajwt_value_tobject__nβ name of the value__xβ value to set
Returns
no return value π
#define jwt_set_SET_INT( __v, __n, __x)
Value:
({ \
(__v)->type=JWT_VALUE_INT;(__v)->replace=0; \
(__v)->name=(__n);(__v)->int_val=(__x);(__v)->error=0;\
(__v);})
sets up a jwt_value_t to set an integer value β
Parameters
__vβ pointer to ajwt_value_tobject__nβ name of the value__xβ value to set
Returns
no return value π
#define jwt_set_SET_JSON( __v, __n, __x)
Value:
({ \
(__v)->type=JWT_VALUE_JSON;(__v)->replace=0; \
(__v)->name=(__n);(__v)->json_val=(__x);(__v)->error=0; \
(__v);})
sets up a jwt_value_t to set a JSON string π
Parameters
__vβ pointer to ajwt_value_tobject__nβ name of the value__xβ value to set
Returns
no return value β¨
#define jwt_set_SET_STR( __v, __n, __x)
Value:
({ \
(__v)->type=JWT_VALUE_STR;(__v)->replace=0; \
(__v)->name=(__n);(__v)->str_val=(__x);(__v)->error=0;\
(__v);})
sets up a jwt_value_t to set a string value π§
Parameters
__vβ pointer to ajwt_value_tobject__nβ name of the value__xβ value to set
Returns
no return value πΈ
π AUTHOR π
generated automatically by Doxygen for LibJWT from the source code. it's giving "the docs wrote themselves." iconic, honestly.
and that's the whole page bestie!! mwah π this was LibJWT, Version 3.3.3, and the page is jwt_helpers_set_grp(3) β go set some values, you absolute main character π«Άππ
π¦ where this page comes from
- ubuntu stonking: libjwt14-doc 3.3.3-1build1 Β· MPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms