jwt_claims_builder_grp(3)

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

✨ NAME ✨

jwt_claims_builder_grp β€” Builder Functions

okay bestie, this is the builder girlie of the LibJWT family (that's the jwt_claims_builder_grp(3) manual, section 3, Library Functions Manual, in case the vibe check needed receipts). It's all about putting headers and claims into a builder so your tokens come out cute and correct. πŸŽ€


πŸ› οΈ SYNOPSIS πŸ› οΈ

Functions

jwt_value_error_t jwt_builder_header_set (jwt_builder_t *builder, jwt_value_t *value)

Set a header in a builder object.

jwt_value_error_t jwt_builder_header_get (jwt_builder_t *builder, jwt_value_t *value)

Get a header from a builder object.

jwt_value_error_t jwt_builder_header_del (jwt_builder_t *builder, const char *header)

Delete a header from a builder object.

jwt_value_error_t jwt_builder_claim_set (jwt_builder_t *builder, jwt_value_t *value)

Set a claim in a builder object.

jwt_value_error_t jwt_builder_claim_get (jwt_builder_t *builder, jwt_value_t *value)

Get a claim from a builder object.

jwt_value_error_t jwt_builder_claim_del (jwt_builder_t *builder, const char *claim)

Delete a header from a builder object.

int jwt_builder_time_offset (jwt_builder_t *builder, jwt_claims_t claim, time_t secs)

Disable, or enable and set the nbf or exp time offsets.


πŸ’– Detailed Description πŸ’–

So for the builder function, here's the tea: you can create a set of values in the header and payload that will be copied verbatim to any token generated from it. Like, whatever you put in there, that's what shows up in the token. No cap. ✨

The special claims, nbf and exp, are the extra ones β€” LibJWT can handle them way more dynamically, but only if they're enabled (peep jwt_builder_time_offset for that whole situation). πŸ‘€

And for any claims you wanna handle on a per-token basis (say you want a different sub depending on the user context, very main character of you), that gets done in a callback on the jwt_t object. Obsessed with the flexibility honestly. πŸ¦‹

Oh and pro tip from the docs themselves: these functions rely on the Setters macros to better handle the data being passed to them. iykyk. πŸ’…


πŸ“š Function Documentation πŸ“š

jwt_value_error_t jwt_builder_claim_del (jwt_builder_t * builder, const char * claim)

Delete a header from a builder object. (yes, the docs say "header" here even though it's a claim function β€” we are reporting it exactly as written, bestie, no editing the source of truth πŸ™ˆ)

Parameters

  • builder β€” Pointer to a builder object
  • claim β€” Name of the claim delete

Returns

JWT_VALUE_ERR_NONE on success, one of the jwt_value_error_t return on error.

jwt_value_error_t jwt_builder_claim_get (jwt_builder_t * builder, jwt_value_t * value)

Get a claim from a builder object. classic little retrieval moment. πŸ’œ

Parameters

  • builder β€” Pointer to a builder object
  • value β€” Pointer to a jwt_value_t object representing the value to get

Returns

JWT_VALUE_ERR_NONE on success, one of the jwt_value_error_t return on error. Also, the relevant value.*_val will be set on success. (yes bestie, the star, exactly like that β€” that's intentional ✨)

jwt_value_error_t jwt_builder_claim_set (jwt_builder_t * builder, jwt_value_t * value)

Set a claim in a builder object. put it in, make it iconic. πŸ‘‘

Parameters

  • builder β€” Pointer to a builder object
  • value β€” Pointer to a jwt_value_t object representing the value to set

Returns

JWT_VALUE_ERR_NONE on success, one of the jwt_value_error_t return on error.

jwt_value_error_t jwt_builder_header_del (jwt_builder_t * builder, const char * header)

Delete a header from a builder object. bye girl, you will not be missed. 🫢

Parameters

  • builder β€” Pointer to a builder object
  • header β€” Name of the header delete

Returns

JWT_VALUE_ERR_NONE on success, one of the jwt_value_error_t return on error.

jwt_value_error_t jwt_builder_header_get (jwt_builder_t * builder, jwt_value_t * value)

Get a header from a builder object. πŸ”

Parameters

  • builder β€” Pointer to a builder object
  • value β€” Pointer to a jwt_value_t object representing the value to get

Returns

JWT_VALUE_ERR_NONE on success, one of the jwt_value_error_t return on error. Also, the relevant value.*_val will be set on success. (same star situation as the claim getter, fr fr ✨)

jwt_value_error_t jwt_builder_header_set (jwt_builder_t * builder, jwt_value_t * value)

Set a header in a builder object. slay. πŸ’…

Parameters

  • builder β€” Pointer to a builder object
  • value β€” Pointer to a jwt_value_t object representing the value to set

Returns

JWT_VALUE_ERR_NONE on success, one of the jwt_value_error_t return on error.

int jwt_builder_time_offset (jwt_builder_t * builder, jwt_claims_t claim, time_t secs)

Disable, or enable and set the nbf or exp time offsets. The time offset is in seconds and will be added to now when a token is created. Negative values are not allowed. 🚫 And setting the secs to 0 or less will disable adding the specified claim to the token.

Parameters

  • builder β€” Pointer to a builder object
  • claim β€” One of JWT_CLAIM_NBF or JWT_CLAIM_EXP
  • secs β€” Seconds of offset to add to now when generating the specified claim

Returns

0 on success, any other value for an error


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for LibJWT from the source code. so like, a robot wrote the skeleton, and I'm just here giving it the glow-up it deserves πŸ’–πŸ€–


that's the whole thing, bestie β€” nothing skipped, every flag, param, return and caveat is still in here, just with better vibes. 🌈

this page lives in the LibJWT world, Version 3.3.3, and it goes by jwt_claims_builder_grp(3) β€” mwah, take care of her πŸ«ΆπŸ’…βœ¨

πŸ“¦ where this page comes from