l8w8jwt
Loading...
Searching...
No Matches
Public Attributes | List of all members
l8w8jwt_encoding_params Struct Reference

#include <encode.h>

Collaboration diagram for l8w8jwt_encoding_params:
Collaboration graph
[legend]

Public Attributes

int alg
 
char * iss
 
size_t iss_length
 
char * sub
 
size_t sub_length
 
char * aud
 
size_t aud_length
 
char * jti
 
size_t jti_length
 
l8w8jwt_time_t exp
 
l8w8jwt_time_t nbf
 
l8w8jwt_time_t iat
 
struct l8w8jwt_claimadditional_header_claims
 
size_t additional_header_claims_count
 
struct l8w8jwt_claimadditional_payload_claims
 
size_t additional_payload_claims_count
 
unsigned char * secret_key
 
size_t secret_key_length
 
unsigned char * secret_key_pw
 
size_t secret_key_pw_length
 
char ** out
 
size_t * out_length
 

Detailed Description

Struct containing the parameters to use for creating a JWT with l8w8jwt.

Member Data Documentation

◆ additional_header_claims

struct l8w8jwt_claim* l8w8jwt_encoding_params::additional_header_claims

[OPTIONAL] Array of additional claims to include in the JWT's header like for example "kid" or "cty"; pass NULL if you don't wish to add any!

Avoid header claims such as typ and alg, since those are written by the encoding function itself.

See also
https://tools.ietf.org/html/rfc7519#section-4.1.7

◆ additional_header_claims_count

size_t l8w8jwt_encoding_params::additional_header_claims_count

[OPTIONAL] The additional_header_claims array size; pass 0 if you don't wish to include any custom claims!

◆ additional_payload_claims

struct l8w8jwt_claim* l8w8jwt_encoding_params::additional_payload_claims

[OPTIONAL] Array of additional claims to include in the JWT's payload; pass NULL if you don't wish to add any!

Registered claim names such as "iss", "exp", etc... have their own dedicated field within this struct: do not include those in this array to prevent uncomfortable duplicates!

See also
https://tools.ietf.org/html/rfc7519#section-4

◆ additional_payload_claims_count

size_t l8w8jwt_encoding_params::additional_payload_claims_count

[OPTIONAL] The additional_payload_claims array size; pass 0 if you don't wish to include any custom claims!

◆ alg

int l8w8jwt_encoding_params::alg

The signature algorithm ID.

[0;2] = HS256/384/512 | [3;5] = RS256/384/512 | [6;8] = PS256/384/512 | [9;11] = ES256/384/512

◆ aud

char* l8w8jwt_encoding_params::aud

[OPTIONAL] The audience claim (who is the JWT intended for? Who is the intended JWT's recipient?). Set this to NULL if you don't wish to add this claim to the token.

See also
https://tools.ietf.org/html/rfc7519#section-4.1.3

◆ aud_length

size_t l8w8jwt_encoding_params::aud_length

aud claim string length.

◆ exp

l8w8jwt_time_t l8w8jwt_encoding_params::exp

Expiration time claim; specifies when this token should stop being valid (in seconds since Unix epoch).

If you want to omit this, set this to 0, but do NOT FORGET to set it to something, otherwise it will be set to whatever random value was in the memory where this variable resides.

See also
https://tools.ietf.org/html/rfc7519#section-4.1.4

◆ iat

l8w8jwt_time_t l8w8jwt_encoding_params::iat

"Issued at" timestamp claim; specifies when this token was emitted (in seconds since Unix epoch).

If you want to omit this, set this to 0, but do NOT FORGET to set it to something, otherwise it will be set to whatever random value was in the memory where this variable resides.

See also
https://tools.ietf.org/html/rfc7519#section-4.1.6

◆ iss

char* l8w8jwt_encoding_params::iss

[OPTIONAL] The issuer claim (who issued the JWT?). Can be omitted by setting this to NULL.

See also
https://tools.ietf.org/html/rfc7519#section-4.1.1

◆ iss_length

size_t l8w8jwt_encoding_params::iss_length

iss claim string length.

◆ jti

char* l8w8jwt_encoding_params::jti

[OPTIONAL] The JWT ID. Provides a unique identifier for the token. Can be omitted by setting this to NULL.

See also
https://tools.ietf.org/html/rfc7519#section-4.1.7

◆ jti_length

size_t l8w8jwt_encoding_params::jti_length

jti claim string length.

◆ nbf

l8w8jwt_time_t l8w8jwt_encoding_params::nbf

"Not before" time claim; specifies when this token should start being valid (in seconds since Unix epoch).

If you want to omit this, set this to 0, but do NOT FORGET to set it to something, otherwise it will be set to whatever random value was in the memory where this variable resides.

See also
https://tools.ietf.org/html/rfc7519#section-4.1.5

◆ out

char** l8w8jwt_encoding_params::out

Where the encoded token should be written into (will be malloc'ed, so make sure to l8w8jwt_free() this as soon as you're done using it!).

◆ out_length

size_t* l8w8jwt_encoding_params::out_length

Where the output token string length should be written into.

◆ secret_key

unsigned char* l8w8jwt_encoding_params::secret_key

The secret key to use for signing the token (e.g. if you chose HS256 as algorithm, this will be the HMAC secret; for RS512 this will be the private PEM-formatted RSA key string, and so on...).

◆ secret_key_length

size_t l8w8jwt_encoding_params::secret_key_length

Length of the secret_key

◆ secret_key_pw

unsigned char* l8w8jwt_encoding_params::secret_key_pw

If the secret key requires a password for usage, please assign it to this field.

You can only omit this when using JWT algorithms "HS256", "HS384" or "HS512" (it's ignored in that case actually).

Every other algorithm requires you to at least set this to NULL if the secret_key isn't password-protected.

◆ secret_key_pw_length

size_t l8w8jwt_encoding_params::secret_key_pw_length

The secret key's password length (if there is any). If there's none, set this to zero!

◆ sub

char* l8w8jwt_encoding_params::sub

[OPTIONAL] The subject claim (who is the JWT about?). Set to NULL if you don't want it in your token.

See also
https://tools.ietf.org/html/rfc7519#section-4.1.2

◆ sub_length

size_t l8w8jwt_encoding_params::sub_length

sub claim string length.


The documentation for this struct was generated from the following file: