jwt_claims_builder_grp(3)
β¨ 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 objectclaimβ 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 objectvalueβ Pointer to ajwt_value_tobject 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 objectvalueβ Pointer to ajwt_value_tobject 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 objectheaderβ 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 objectvalueβ Pointer to ajwt_value_tobject 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 objectvalueβ Pointer to ajwt_value_tobject 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 objectclaimβ One ofJWT_CLAIM_NBForJWT_CLAIM_EXPsecsβ Seconds of offset to add tonowwhen 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
- 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