jwt_object_grp(3)

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

πŸ’– jwt_object_grp(3) β€” the JWT functions page, bestie edition πŸ’–

okay so this is a page from the Library Functions Manual (that's the 3 in jwt_object_grp(3), iykyk) and it's literally all about the LibJWT object group: the structs, the typedefs, and the six little functions that let you poke at a JWT's header and claims. pull up a chair, we're doing this together 🫢


✨ NAME ✨

jwt_object_grp β€” JWT Functions

like. the JWT functions. the whole squad. periodt.


🌸 SYNOPSIS 🌸

πŸŽ€ Data Structures

  • struct jwt_config_t β€” Structure used to pass state with a user callback.

πŸ¦‹ Typedefs

  • typedef struct jwt jwt_t β€” Opaque JWT object.
  • typedef int(* jwt_callback_t) (jwt_t *, jwt_config_t *) β€” General callback for generation and verification of JWT.

πŸ’… Functions

jwt_value_error_t jwt_header_set (jwt_t *jwt, jwt_value_t *value)
    Set a value in the header of a JWT.
jwt_value_error_t jwt_header_get (jwt_t *jwt, jwt_value_t *value)
    Get a value from the header of a JWT.
jwt_value_error_t jwt_header_del (jwt_t *jwt, const char *header)
    Delete a value from the header of a JWT.
jwt_value_error_t jwt_claim_set (jwt_t *jwt, jwt_value_t *value)
    Set a value in the claims of a JWT.
jwt_value_error_t jwt_claim_get (jwt_t *jwt, jwt_value_t *value)
    Get a value from the claims of a JWT.
jwt_value_error_t jwt_claim_del (jwt_t *jwt, const char *claim)
    Delete a value from the claims of a JWT.

πŸ‘‘ Detailed Description πŸ‘‘

okay so here's the tea β˜• β€” for most usage, setting values in the builder object is enough to provide all the information you would like set in a JWT token. easy. iconic. no notes.

but β€” and this is the plot twist 🫒 β€” if some information is dynamic, meaning it is only known at the time the token is created, then you can provide this during the builder callback on the jwt_t object. that's the whole point of the callback, bestie. live wiring. real-time vibes. ✨

⚠️ important, no cap: when verifying a token, the checker callback should not modify the jwt_t object at all. like, do not touch. hands off. πŸ™…β€β™€οΈ

the reason access to the jwt_t is provided at all is only to allow additional validation beyond LibJWT's internal checks. that's it. that's the assignment. πŸ’œ


🧚 Typedef Documentation 🧚

typedef int(* jwt_callback_t) (jwt_t *, jwt_config_t *)

General callback for generation and verification of JWT.

typedef struct jwt jwt_t

Opaque JWT object. Used in callbacks when generating or verifying a JWT.


πŸ”₯ Function Documentation πŸ”₯

jwt_value_error_t jwt_claim_del (jwt_t * jwt, const char * claim)

Delete a value from the claims of a JWT. bye girl, we don't need you πŸ‘‹

Parameters

  • jwt β€” Pointer to a jwt_t token, previously created with jwt_create()
  • claim β€” The name of the claim to delete, or NULL to clear all claims

Returns

  • A jwt_value_error_t value, JWT_VALUE_ERR_NONE being success.

jwt_value_error_t jwt_claim_get (jwt_t * jwt, jwt_value_t * value)

Get a value from the claims of a JWT. reading the receipts 🧾✨

Parameters

  • jwt β€” Pointer to a jwt_t token, previously created with jwt_create()
  • value β€” A jwt_value_t structure with relevant actions filled in

Returns

  • A jwt_value_error_t value, JWT_VALUE_ERR_NONE being success. The value.error field will match this return value. (yes bestie, they're matching. twin behavior. πŸ‘―)

jwt_value_error_t jwt_claim_set (jwt_t * jwt, jwt_value_t * value)

Set a value in the claims of a JWT. putting a lil something in there πŸ’…

Parameters

  • jwt β€” Pointer to a jwt_t token, previously created with jwt_create()
  • value β€” A jwt_value_t structure with relevant actions filled in

Returns

  • A jwt_value_error_t value, JWT_VALUE_ERR_NONE being success. The value.error field will match this return value.

jwt_value_error_t jwt_header_del (jwt_t * jwt, const char * header)

Delete a value from the header of a JWT. decluttering era 🌈

Parameters

  • jwt β€” Pointer to a jwt_t token, previously created with jwt_create()
  • header β€” The name of the header to delete, or NULL to clear the entire header
🫒 passing NULL here wipes the entire header, not just one field. know that before you do it, fr fr.

Returns

  • A jwt_value_error_t value, JWT_VALUE_ERR_NONE being success.

jwt_value_error_t jwt_header_get (jwt_t * jwt, jwt_value_t * value)

Get a value from the header of a JWT. peeking at the top of the token, respectfully πŸ™ˆ

Parameters

  • jwt β€” Pointer to a jwt_t token, previously created with jwt_create()
  • value β€” A jwt_value_t structure with relevant actions filled in

Returns

  • A jwt_value_error_t value, JWT_VALUE_ERR_NONE being success. The value.error field will match this return value.

jwt_value_error_t jwt_header_set (jwt_t * jwt, jwt_value_t * value)

Set a value in the header of a JWT. main character energy, in the header this time πŸ‘‘

Parameters

  • jwt β€” Pointer to a jwt_t token, previously created with jwt_create()
  • value β€” A jwt_value_t structure with relevant actions filled in

Returns

  • A jwt_value_error_t value, JWT_VALUE_ERR_NONE being success. The value.error field will match this return value.

πŸ’œ Author πŸ’œ

Generated automatically by Doxygen for LibJWT from the source code.

(so like, no human wrote this, a robot did. and honestly? slay, doxygen. πŸ€–βœ¨)


and that's the whole page, bestie πŸŽ€ mwah. this was LibJWT, Version 3.3.3 β€” shoutout to the source code for making it all happen, and to jwt_object_grp(3) for being the section we all came here for. go forth and set those claims, but remember: don't modify the jwt_t during verification, or it's giving chaos πŸ˜­πŸ’–

πŸ“¦ where this page comes from