jwt_helpers_set_grp(3)

πŸ“¦
version 3.3.3 Β· 2 versions
, in ubuntu stonking

πŸ’– 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 a jwt_value_t so it can hold an integer value πŸ‘‘
  • #define jwt_set_SET_STR(__v, __n, __x) β€” sets up a jwt_value_t so it can hold a string value 🧚
  • #define jwt_set_SET_BOOL(__v, __n, __x) β€” sets up a jwt_value_t so it can hold a boolean value πŸ’…
  • #define jwt_set_SET_JSON(__v, __n, __x) β€” sets up a jwt_value_t so 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 a jwt_value_t object
  • __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 a jwt_value_t object
  • __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 a jwt_value_t object
  • __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 a jwt_value_t object
  • __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