benchmarks.l8w8jwt

Undocumented in source.

Members

Enums

chillbuff_growth_method
enum chillbuff_growth_method

How should the chillbuff's underlying array grow in size once its maximum capacity is reached during a push_back?

l8w8jwt_validation_result
enum l8w8jwt_validation_result
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Functions

chillbuff_free
void chillbuff_free(chillbuff* buff)

Frees a chillbuff instance. @param buff The chillbuff to deallocate. If this is <code>NULL</code>, nothing happens at all.

chillbuff_init
int chillbuff_init(chillbuff* buff, size_t initial_capacity, size_t element_size, chillbuff_growth_method growth_method)

Initializes a chillbuff instance and makes it ready to accept data. @param buff The chillbuff instance to init (or rather, a pointer to it). @param initial_capacity The initial capacity of the underlying array. If you pass <code>0</code> here, <code>16</code> is used by default. @param element_size How big should every array element be? E.g. if you're storing <code>int</code> you should pass <code>sizeof(int)</code>. @param growth_method How should the buffer grow once its maximum capacity is reached? @see chillbuff_growth_method @return Chillbuff exit code as defined at the top of the chillbuff.h header file. <code>0</code> means success.

decode
int decode(size_t cycles, int alg, string token, string secret)
Undocumented in source. Be warned that the author may not have intended to support it.
encode
int encode(size_t cycles, int alg, string payload, string secret)
Undocumented in source. Be warned that the author may not have intended to support it.
l8w8jwt_decode
int l8w8jwt_decode(l8w8jwt_decoding_params* params, l8w8jwt_validation_result* out_validation_result, l8w8jwt_claim** out_claims, size_t* out_claims_length)

Decode (and validate) a JWT using specific parameters. <p> The resulting {@link #l8w8jwt_validation_result} written into the passed "out_validation_result" pointer contains validation failure flags (see the {@link #l8w8jwt_validation_result} enum docs for more details). <p> This only happens if decoding also succeeded: if the token is malformed, nothing will be written into "out_validation_result". <p> If validation succeeds, the {@link #l8w8jwt_validation_result} receives the value 0 (enum value <code>L8W8JWT_VALID</code>). <p> The same applies to the "out_claims" argument: it is only allocated and written to if it (obviously) isn't <code>NULL</code> and if the decoding was also successful!

l8w8jwt_decoding_params_init
void l8w8jwt_decoding_params_init(l8w8jwt_decoding_params* params)

Initializes a {@link #l8w8jwt_decoding_params} instance by setting its fields to default values. @param params The l8w8jwt_decoding_params to initialize (set to default values).

l8w8jwt_encode
int l8w8jwt_encode(l8w8jwt_encoding_params* params)

Creates, signs and encodes a Json-Web-Token. <p> An example output could be: <code>eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InNvbWUta2V5LWlkLWhlcmUtMDEyMzQ1NiJ9.eyJpYXQiOjE1Nzk2NDUzNTUsImV4cCI6MTU3OTY0NTk1NSwic3ViIjoiR29yZG9uIEZyZWVtYW4iLCJpc3MiOiJCbGFjayBNZXNhIiwiYXVkIjoiQWRtaW5pc3RyYXRvciJ9.uk4EEoq0ql_SguLto5EWzklakpzO-6GE2U26crB8vUY</code> <p> @param params The token encoding parameters (e.g. "alg", "iss", "exp", etc...). @return Return code as defined in retcodes.h @see l8w8jwt_encoding_params

l8w8jwt_encoding_params_init
void l8w8jwt_encoding_params_init(l8w8jwt_encoding_params* params)

Initializes a {@link #l8w8jwt_encoding_params} instance by setting its fields to default values. @param params The l8w8jwt_encoding_params to initialize (set to default values).

l8w8jwt_free
void l8w8jwt_free(void* mem)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
l8w8jwt_free_claims
void l8w8jwt_free_claims(l8w8jwt_claim* claims, size_t claims_count)

Frees a heap-allocated <code>l8w8jwt_claim</code> array. @param claims The claims to free. @param claims_count The size of the passed claims array.

l8w8jwt_get_claim
l8w8jwt_claim* l8w8jwt_get_claim(l8w8jwt_claim* claims, size_t claims_count, const(char)* key, size_t key_length)

Gets a claim by key from a l8w8jwt_claim array. @param claims The array to look in. @param claims_count The claims array size. @param key The claim key (e.g. "sub") to look for. @param key_length The claim key's string length. @return The found claim; <code>NULL</code> if no such claim was found in the array.

l8w8jwt_validate_decoding_params
int l8w8jwt_validate_decoding_params(l8w8jwt_decoding_params* params)

Validates a set of l8w8jwt_decoding_params. @param params The l8w8jwt_decoding_params to validate. @return Return code as defined in retcodes.h

l8w8jwt_validate_encoding_params
int l8w8jwt_validate_encoding_params(l8w8jwt_encoding_params* params)

Validates a set of l8w8jwt_encoding_params. @param params The l8w8jwt_encoding_params to validate. @return Return code as defined in retcodes.h

l8w8jwt_write_claims
int l8w8jwt_write_claims(chillbuff* stringbuilder, l8w8jwt_claim* claims, size_t claims_count)

Writes a bunch of JWT claims into a chillbuff stringbuilder. <p> Curly braces and trailing commas won't be written; only the "key":"value" pairs! @param stringbuilder The buffer into which to write the claims. @param claims The l8w8jwt_claim array of claims to write. @param claims_count The claims array size. @return Return code as specified inside retcodes.h

main
int main(string[] args)
Undocumented in source. Be warned that the author may not have intended to support it.
validate
int validate(size_t cycles, int alg, string token, string secret)
Undocumented in source. Be warned that the author may not have intended to support it.

Manifest constants

L8W8JWT_ALG_ED25519
enum L8W8JWT_ALG_ED25519;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
L8W8JWT_ALG_ES256
enum L8W8JWT_ALG_ES256;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
L8W8JWT_ALG_ES256K
enum L8W8JWT_ALG_ES256K;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
L8W8JWT_ALG_ES384
enum L8W8JWT_ALG_ES384;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
L8W8JWT_ALG_ES512
enum L8W8JWT_ALG_ES512;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
L8W8JWT_ALG_HS256
enum L8W8JWT_ALG_HS256;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
L8W8JWT_ALG_HS384
enum L8W8JWT_ALG_HS384;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
L8W8JWT_ALG_HS512
enum L8W8JWT_ALG_HS512;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
L8W8JWT_ALG_PS256
enum L8W8JWT_ALG_PS256;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
L8W8JWT_ALG_PS384
enum L8W8JWT_ALG_PS384;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
L8W8JWT_ALG_PS512
enum L8W8JWT_ALG_PS512;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
L8W8JWT_ALG_RS256
enum L8W8JWT_ALG_RS256;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
L8W8JWT_ALG_RS384
enum L8W8JWT_ALG_RS384;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
L8W8JWT_ALG_RS512
enum L8W8JWT_ALG_RS512;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
L8W8JWT_CLAIM_TYPE_ARRAY
enum L8W8JWT_CLAIM_TYPE_ARRAY;

JWT claim value type JSON array (e.g. <code>"ids": [2, 4, 8, 16]</code>).

L8W8JWT_CLAIM_TYPE_BOOLEAN
enum L8W8JWT_CLAIM_TYPE_BOOLEAN;

JWT claim value is a boolean (e.g. <code>"done": true</code>).

L8W8JWT_CLAIM_TYPE_INTEGER
enum L8W8JWT_CLAIM_TYPE_INTEGER;

JWT claim value is an integer (e.g. <code>"exp": 1579610629</code>)

L8W8JWT_CLAIM_TYPE_NULL
enum L8W8JWT_CLAIM_TYPE_NULL;

JWT claim value is null (e.g. <code>"ref": null</code>).

L8W8JWT_CLAIM_TYPE_NUMBER
enum L8W8JWT_CLAIM_TYPE_NUMBER;

JWT claim value type number (e.g. <code>"size": 1.85</code>).

L8W8JWT_CLAIM_TYPE_OBJECT
enum L8W8JWT_CLAIM_TYPE_OBJECT;

JWT claim value type is a JSON object (e.g. <code>"objs": { "name": "GMan", "id": 420 }</code>).

L8W8JWT_CLAIM_TYPE_OTHER
enum L8W8JWT_CLAIM_TYPE_OTHER;

JWT claim value is some other type.

L8W8JWT_CLAIM_TYPE_STRING
enum L8W8JWT_CLAIM_TYPE_STRING;

JWT claim value is a string (e.g. <code>"iss": "glitchedpolygons.com"</code>).

L8W8JWT_MAX_KEY_SIZE
enum L8W8JWT_MAX_KEY_SIZE;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Structs

chillbuff
struct chillbuff

Self-reallocating dynamic size array of no strictly defined type. Easy 'n' "chill" (hope you like segmentation fault errors).

l8w8jwt_claim
struct l8w8jwt_claim

Struct containing a jwt claim key-value pair.<p> If allocated on the heap by the decode function, remember to call <code>l8w8jwt_claims_free()</code> on it once you're done using it.

l8w8jwt_decoding_params
struct l8w8jwt_decoding_params

Struct containing the parameters to use for decoding and validating a JWT.

l8w8jwt_encoding_params
struct l8w8jwt_encoding_params

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

Meta