GNUnet  0.11.x
Functions | Variables
plugin_reclaim_credential_jwt.c File Reference

reclaim-credential-plugin-jwt attribute plugin to provide the API for JWT credentials. More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_reclaim_plugin.h"
#include <inttypes.h>
#include <jansson.h>
Include dependency graph for plugin_reclaim_credential_jwt.c:

Go to the source code of this file.

Functions

static char * jwt_value_to_string (void *cls, uint32_t type, const void *data, size_t data_size)
 Convert the 'value' of an credential to a string. More...
 
static int jwt_string_to_value (void *cls, uint32_t type, const char *s, void **data, size_t *data_size)
 Convert human-readable version of a 'value' of an credential to the binary representation. More...
 
static uint32_t jwt_typename_to_number (void *cls, const char *jwt_typename)
 Convert a type name to the corresponding number. More...
 
static const char * jwt_number_to_typename (void *cls, uint32_t type)
 Convert a type number (i.e. More...
 
struct GNUNET_RECLAIM_AttributeListjwt_parse_attributes (void *cls, const char *data)
 Parse a JWT and return the respective claim value as Attribute. More...
 
struct GNUNET_RECLAIM_AttributeListjwt_parse_attributes_c (void *cls, const struct GNUNET_RECLAIM_Credential *cred)
 Parse a JWT and return the respective claim value as Attribute. More...
 
struct GNUNET_RECLAIM_AttributeListjwt_parse_attributes_p (void *cls, const struct GNUNET_RECLAIM_Presentation *cred)
 Parse a JWT and return the respective claim value as Attribute. More...
 
char * jwt_get_issuer (void *cls, const char *data)
 Parse a JWT and return the issuer. More...
 
char * jwt_get_issuer_c (void *cls, const struct GNUNET_RECLAIM_Credential *cred)
 Parse a JWT and return the issuer. More...
 
char * jwt_get_issuer_p (void *cls, const struct GNUNET_RECLAIM_Presentation *cred)
 Parse a JWT and return the issuer. More...
 
int jwt_get_expiration (void *cls, const char *data, struct GNUNET_TIME_Absolute *exp)
 Parse a JWT and return the expiration. More...
 
int jwt_get_expiration_c (void *cls, const struct GNUNET_RECLAIM_Credential *cred, struct GNUNET_TIME_Absolute *exp)
 Parse a JWT and return the expiration. More...
 
int jwt_get_expiration_p (void *cls, const struct GNUNET_RECLAIM_Presentation *cred, struct GNUNET_TIME_Absolute *exp)
 Parse a JWT and return the expiration. More...
 
int jwt_create_presentation (void *cls, const struct GNUNET_RECLAIM_Credential *cred, const struct GNUNET_RECLAIM_AttributeList *attrs, struct GNUNET_RECLAIM_Presentation **pres)
 
void * libgnunet_plugin_reclaim_credential_jwt_init (void *cls)
 Entry point for the plugin. More...
 
void * libgnunet_plugin_reclaim_credential_jwt_done (void *cls)
 Exit point from the plugin. More...
 

Variables

struct {
   const char *   name
 
   uint32_t   number
 
jwt_cred_name_map []
 Mapping of credential type numbers to human-readable credential type names. More...
 

Detailed Description

reclaim-credential-plugin-jwt attribute plugin to provide the API for JWT credentials.

Author
Martin Schanzenbach

Definition in file plugin_reclaim_credential_jwt.c.

Function Documentation

◆ jwt_value_to_string()

static char* jwt_value_to_string ( void *  cls,
uint32_t  type,
const void *  data,
size_t  data_size 
)
static

Convert the 'value' of an credential to a string.

Parameters
clsclosure, unused
typetype of the credential
datavalue in binary encoding
data_sizenumber of bytes in data
Returns
NULL on error, otherwise human-readable representation of the value

Definition at line 44 of file plugin_reclaim_credential_jwt.c.

References GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT, and GNUNET_strndup.

Referenced by libgnunet_plugin_reclaim_credential_jwt_init().

48 {
49  switch (type)
50  {
52  return GNUNET_strndup (data, data_size);
53 
54  default:
55  return NULL;
56  }
57 }
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
#define GNUNET_strndup(a, length)
Wrapper around GNUNET_xstrndup_.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
uint32_t data
The data value.
A JSON Web Token credential.
Here is the caller graph for this function:

◆ jwt_string_to_value()

static int jwt_string_to_value ( void *  cls,
uint32_t  type,
const char *  s,
void **  data,
size_t *  data_size 
)
static

Convert human-readable version of a 'value' of an credential to the binary representation.

Parameters
clsclosure, unused
typetype of the credential
shuman-readable string
dataset to value in binary encoding (will be allocated)
data_sizeset to number of bytes in data
Returns
GNUNET_OK on success

Definition at line 72 of file plugin_reclaim_credential_jwt.c.

References GNUNET_OK, GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT, GNUNET_strdup, and GNUNET_SYSERR.

Referenced by libgnunet_plugin_reclaim_credential_jwt_init().

77 {
78  if (NULL == s)
79  return GNUNET_SYSERR;
80  switch (type)
81  {
83  *data = GNUNET_strdup (s);
84  *data_size = strlen (s);
85  return GNUNET_OK;
86 
87  default:
88  return GNUNET_SYSERR;
89  }
90 }
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
uint32_t data
The data value.
A JSON Web Token credential.
Here is the caller graph for this function:

◆ jwt_typename_to_number()

static uint32_t jwt_typename_to_number ( void *  cls,
const char *  jwt_typename 
)
static

Convert a type name to the corresponding number.

Parameters
clsclosure, unused
jwt_typenamename to convert
Returns
corresponding number, UINT32_MAX on error

Definition at line 112 of file plugin_reclaim_credential_jwt.c.

References jwt_cred_name_map, and name.

Referenced by libgnunet_plugin_reclaim_credential_jwt_init().

113 {
114  unsigned int i;
115 
116  i = 0;
117  while ((NULL != jwt_cred_name_map[i].name) &&
118  (0 != strcasecmp (jwt_typename, jwt_cred_name_map[i].name)))
119  i++;
120  return jwt_cred_name_map[i].number;
121 }
static struct @78 jwt_cred_name_map[]
Mapping of credential type numbers to human-readable credential type names.
const char * name
Here is the caller graph for this function:

◆ jwt_number_to_typename()

static const char* jwt_number_to_typename ( void *  cls,
uint32_t  type 
)
static

Convert a type number (i.e.

1) to the corresponding type string

Parameters
clsclosure, unused
typenumber of a type to convert
Returns
corresponding typestring, NULL on error

Definition at line 132 of file plugin_reclaim_credential_jwt.c.

References jwt_cred_name_map, name, and number.

Referenced by libgnunet_plugin_reclaim_credential_jwt_init().

133 {
134  unsigned int i;
135 
136  i = 0;
137  while ((NULL != jwt_cred_name_map[i].name) && (type !=
139  number))
140  i++;
141  return jwt_cred_name_map[i].name;
142 }
static struct @78 jwt_cred_name_map[]
Mapping of credential type numbers to human-readable credential type names.
const char * name
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
Here is the caller graph for this function:

◆ jwt_parse_attributes()

struct GNUNET_RECLAIM_AttributeList* jwt_parse_attributes ( void *  cls,
const char *  data 
)

Parse a JWT and return the respective claim value as Attribute.

Parameters
clsthe plugin
credthe jwt credential
Returns
a GNUNET_RECLAIM_Attribute, containing the new value

Definition at line 153 of file plugin_reclaim_credential_jwt.c.

References GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_new, GNUNET_RECLAIM_attribute_list_add(), GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING, GNUNET_strdup, GNUNET_STRINGS_base64url_decode(), key, and value.

Referenced by jwt_parse_attributes_c(), and jwt_parse_attributes_p().

155 {
156  char *jwt_string;
157  struct GNUNET_RECLAIM_AttributeList *attrs;
158  char delim[] = ".";
159  char *val_str = NULL;
160  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsing JWT attributes.\n");
161  char *decoded_jwt;
162  json_t *json_val;
163  json_error_t *json_err = NULL;
164 
165  attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
166 
167  jwt_string = GNUNET_strdup (data);
168  const char *jwt_body = strtok (jwt_string, delim);
169  jwt_body = strtok (NULL, delim);
170  GNUNET_STRINGS_base64url_decode (jwt_body, strlen (jwt_body),
171  (void **) &decoded_jwt);
172  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Decoded JWT: %s\n", decoded_jwt);
173  GNUNET_assert (NULL != decoded_jwt);
174  json_val = json_loads (decoded_jwt, JSON_DECODE_ANY, json_err);
175  const char *key;
176  json_t *value;
177  json_object_foreach (json_val, key, value) {
178  if (0 == strcmp ("iss", key))
179  continue;
180  if (0 == strcmp ("jti", key))
181  continue;
182  if (0 == strcmp ("exp", key))
183  continue;
184  if (0 == strcmp ("iat", key))
185  continue;
186  if (0 == strcmp ("nbf", key))
187  continue;
188  if (0 == strcmp ("aud", key))
189  continue;
190  val_str = json_dumps (value, JSON_ENCODE_ANY);
192  key,
193  NULL,
195  val_str,
196  strlen (val_str));
197  GNUNET_free (val_str);
198  }
199  GNUNET_free (jwt_string);
200  return attrs;
201 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
A list of GNUNET_RECLAIM_Attribute structures.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
static char * value
Value of the record to add/remove.
struct GNUNET_HashCode key
The key used in the DHT.
#define GNUNET_log(kind,...)
void GNUNET_RECLAIM_attribute_list_add(struct GNUNET_RECLAIM_AttributeList *attrs, const char *attr_name, const struct GNUNET_RECLAIM_Identifier *credential, uint32_t type, const void *data, size_t data_size)
Add a new attribute to a claim list.
uint32_t data
The data value.
size_t GNUNET_STRINGS_base64url_decode(const char *data, size_t len, void **out)
Decode from Base64url.
Definition: strings.c:2050
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ jwt_parse_attributes_c()

struct GNUNET_RECLAIM_AttributeList* jwt_parse_attributes_c ( void *  cls,
const struct GNUNET_RECLAIM_Credential cred 
)

Parse a JWT and return the respective claim value as Attribute.

Parameters
clsthe plugin
credthe jwt credential
Returns
a GNUNET_RECLAIM_Attribute, containing the new value

Definition at line 212 of file plugin_reclaim_credential_jwt.c.

References GNUNET_RECLAIM_Credential::data, and jwt_parse_attributes().

Referenced by libgnunet_plugin_reclaim_credential_jwt_init().

214 {
215  return jwt_parse_attributes (cls, cred->data);
216 }
const void * data
Binary value stored as credential value.
struct GNUNET_RECLAIM_AttributeList * jwt_parse_attributes(void *cls, const char *data)
Parse a JWT and return the respective claim value as Attribute.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ jwt_parse_attributes_p()

struct GNUNET_RECLAIM_AttributeList* jwt_parse_attributes_p ( void *  cls,
const struct GNUNET_RECLAIM_Presentation cred 
)

Parse a JWT and return the respective claim value as Attribute.

Parameters
clsthe plugin
credthe jwt credential
Returns
a GNUNET_RECLAIM_Attribute, containing the new value

Definition at line 227 of file plugin_reclaim_credential_jwt.c.

References GNUNET_RECLAIM_Presentation::data, and jwt_parse_attributes().

Referenced by libgnunet_plugin_reclaim_credential_jwt_init().

229 {
230  return jwt_parse_attributes (cls, cred->data);
231 }
const void * data
Binary value stored as presentation value.
struct GNUNET_RECLAIM_AttributeList * jwt_parse_attributes(void *cls, const char *data)
Parse a JWT and return the respective claim value as Attribute.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ jwt_get_issuer()

char* jwt_get_issuer ( void *  cls,
const char *  data 
)

Parse a JWT and return the issuer.

Parameters
clsthe plugin
credthe jwt credential
Returns
a string, containing the isser

Definition at line 242 of file plugin_reclaim_credential_jwt.c.

References GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_strdup, and GNUNET_STRINGS_base64url_decode().

Referenced by jwt_get_issuer_c(), and jwt_get_issuer_p().

244 {
245  const char *jwt_body;
246  char *jwt_string;
247  char delim[] = ".";
248  char *issuer = NULL;
249  char *decoded_jwt;
250  json_t *issuer_json;
251  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsing JWT attributes.\n");
252  json_t *json_val;
253  json_error_t *json_err = NULL;
254 
255  jwt_string = GNUNET_strdup (data);
256  jwt_body = strtok (jwt_string, delim);
257  jwt_body = strtok (NULL, delim);
258  GNUNET_STRINGS_base64url_decode (jwt_body, strlen (jwt_body),
259  (void **) &decoded_jwt);
260  json_val = json_loads (decoded_jwt, JSON_DECODE_ANY, json_err);
261  issuer_json = json_object_get (json_val, "iss");
262  if ((NULL == issuer_json) || (! json_is_string (issuer_json)))
263  return NULL;
264  issuer = GNUNET_strdup (json_string_value (issuer_json));
265  GNUNET_free (jwt_string);
266  return issuer;
267 }
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_log(kind,...)
uint32_t data
The data value.
size_t GNUNET_STRINGS_base64url_decode(const char *data, size_t len, void **out)
Decode from Base64url.
Definition: strings.c:2050
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ jwt_get_issuer_c()

char* jwt_get_issuer_c ( void *  cls,
const struct GNUNET_RECLAIM_Credential cred 
)

Parse a JWT and return the issuer.

Parameters
clsthe plugin
credthe jwt credential
Returns
a string, containing the isser

Definition at line 278 of file plugin_reclaim_credential_jwt.c.

References GNUNET_RECLAIM_Credential::data, GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT, jwt_get_issuer(), and GNUNET_RECLAIM_Credential::type.

Referenced by libgnunet_plugin_reclaim_credential_jwt_init().

280 {
282  return NULL;
283  return jwt_get_issuer (cls, cred->data);
284 }
uint32_t type
Type/Format of Claim.
const void * data
Binary value stored as credential value.
char * jwt_get_issuer(void *cls, const char *data)
Parse a JWT and return the issuer.
A JSON Web Token credential.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ jwt_get_issuer_p()

char* jwt_get_issuer_p ( void *  cls,
const struct GNUNET_RECLAIM_Presentation cred 
)

Parse a JWT and return the issuer.

Parameters
clsthe plugin
credthe jwt credential
Returns
a string, containing the isser

Definition at line 295 of file plugin_reclaim_credential_jwt.c.

References GNUNET_RECLAIM_Presentation::data, GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT, jwt_get_issuer(), and GNUNET_RECLAIM_Presentation::type.

Referenced by libgnunet_plugin_reclaim_credential_jwt_init().

297 {
299  return NULL;
300  return jwt_get_issuer (cls, cred->data);
301 }
uint32_t type
Type/Format of Claim.
char * jwt_get_issuer(void *cls, const char *data)
Parse a JWT and return the issuer.
const void * data
Binary value stored as presentation value.
A JSON Web Token credential.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ jwt_get_expiration()

int jwt_get_expiration ( void *  cls,
const char *  data,
struct GNUNET_TIME_Absolute exp 
)

Parse a JWT and return the expiration.

Parameters
clsthe plugin
credthe jwt credential
Returns
a string, containing the isser

Definition at line 312 of file plugin_reclaim_credential_jwt.c.

References GNUNET_TIME_Absolute::abs_value_us, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_OK, GNUNET_strdup, GNUNET_STRINGS_base64url_decode(), and GNUNET_SYSERR.

Referenced by jwt_get_expiration_c(), and jwt_get_expiration_p().

315 {
316  const char *jwt_body;
317  char *jwt_string;
318  char delim[] = ".";
319  char *decoded_jwt;
320  json_t *exp_json;
321  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsing JWT attributes.\n");
322  json_t *json_val;
323  json_error_t *json_err = NULL;
324 
325  jwt_string = GNUNET_strdup (data);
326  jwt_body = strtok (jwt_string, delim);
327  jwt_body = strtok (NULL, delim);
328  GNUNET_STRINGS_base64url_decode (jwt_body, strlen (jwt_body),
329  (void **) &decoded_jwt);
330  json_val = json_loads (decoded_jwt, JSON_DECODE_ANY, json_err);
331  exp_json = json_object_get (json_val, "exp");
332  if ((NULL == exp_json) || (! json_is_integer (exp_json)))
333  return GNUNET_SYSERR;
334  exp->abs_value_us = json_integer_value (exp_json) * 1000 * 1000;
335  GNUNET_free (jwt_string);
336  return GNUNET_OK;
337 }
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
uint64_t abs_value_us
The actual value.
#define GNUNET_log(kind,...)
uint32_t data
The data value.
size_t GNUNET_STRINGS_base64url_decode(const char *data, size_t len, void **out)
Decode from Base64url.
Definition: strings.c:2050
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ jwt_get_expiration_c()

int jwt_get_expiration_c ( void *  cls,
const struct GNUNET_RECLAIM_Credential cred,
struct GNUNET_TIME_Absolute exp 
)

Parse a JWT and return the expiration.

Parameters
clsthe plugin
credthe jwt credential
Returns
a string, containing the isser

Definition at line 348 of file plugin_reclaim_credential_jwt.c.

References GNUNET_RECLAIM_Credential::data, and jwt_get_expiration().

Referenced by libgnunet_plugin_reclaim_credential_jwt_init().

351 {
352  return jwt_get_expiration (cls, cred->data, exp);
353 }
const void * data
Binary value stored as credential value.
int jwt_get_expiration(void *cls, const char *data, struct GNUNET_TIME_Absolute *exp)
Parse a JWT and return the expiration.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ jwt_get_expiration_p()

int jwt_get_expiration_p ( void *  cls,
const struct GNUNET_RECLAIM_Presentation cred,
struct GNUNET_TIME_Absolute exp 
)

Parse a JWT and return the expiration.

Parameters
clsthe plugin
credthe jwt credential
Returns
a string, containing the isser

Definition at line 364 of file plugin_reclaim_credential_jwt.c.

References GNUNET_RECLAIM_Presentation::data, and jwt_get_expiration().

Referenced by libgnunet_plugin_reclaim_credential_jwt_init().

367 {
368  return jwt_get_expiration (cls, cred->data, exp);
369 }
int jwt_get_expiration(void *cls, const char *data, struct GNUNET_TIME_Absolute *exp)
Parse a JWT and return the expiration.
const void * data
Binary value stored as presentation value.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ jwt_create_presentation()

int jwt_create_presentation ( void *  cls,
const struct GNUNET_RECLAIM_Credential cred,
const struct GNUNET_RECLAIM_AttributeList attrs,
struct GNUNET_RECLAIM_Presentation **  pres 
)

Definition at line 373 of file plugin_reclaim_credential_jwt.c.

References GNUNET_RECLAIM_Credential::data, GNUNET_RECLAIM_Credential::data_size, GNUNET_NO, GNUNET_OK, GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT, GNUNET_RECLAIM_presentation_new(), and GNUNET_RECLAIM_Credential::type.

Referenced by libgnunet_plugin_reclaim_credential_jwt_init().

377 {
378  // FIXME sanity checks??
380  return GNUNET_NO;
382  cred->data,
383  cred->data_size);
384  return GNUNET_OK;
385 }
uint32_t type
Type/Format of Claim.
size_t data_size
Number of bytes in data.
const void * data
Binary value stored as credential value.
struct GNUNET_RECLAIM_Presentation * GNUNET_RECLAIM_presentation_new(uint32_t type, const void *data, size_t data_size)
A JSON Web Token credential.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libgnunet_plugin_reclaim_credential_jwt_init()

void* libgnunet_plugin_reclaim_credential_jwt_init ( void *  cls)

Entry point for the plugin.

Parameters
clsNULL
Returns
the exported block API

Definition at line 395 of file plugin_reclaim_credential_jwt.c.

References GNUNET_RECLAIM_CredentialPluginFunctions::create_presentation, GNUNET_RECLAIM_CredentialPluginFunctions::get_attributes, GNUNET_RECLAIM_CredentialPluginFunctions::get_attributes_p, GNUNET_RECLAIM_CredentialPluginFunctions::get_expiration, GNUNET_RECLAIM_CredentialPluginFunctions::get_expiration_p, GNUNET_RECLAIM_CredentialPluginFunctions::get_issuer, GNUNET_RECLAIM_CredentialPluginFunctions::get_issuer_p, GNUNET_new, jwt_create_presentation(), jwt_get_expiration_c(), jwt_get_expiration_p(), jwt_get_issuer_c(), jwt_get_issuer_p(), jwt_number_to_typename(), jwt_parse_attributes_c(), jwt_parse_attributes_p(), jwt_string_to_value(), jwt_typename_to_number(), jwt_value_to_string(), GNUNET_RECLAIM_CredentialPluginFunctions::number_to_typename, GNUNET_RECLAIM_CredentialPluginFunctions::number_to_typename_p, GNUNET_RECLAIM_CredentialPluginFunctions::string_to_value, GNUNET_RECLAIM_CredentialPluginFunctions::string_to_value_p, GNUNET_RECLAIM_CredentialPluginFunctions::typename_to_number, GNUNET_RECLAIM_CredentialPluginFunctions::typename_to_number_p, GNUNET_RECLAIM_CredentialPluginFunctions::value_to_string, and GNUNET_RECLAIM_CredentialPluginFunctions::value_to_string_p.

396 {
398 
415  return api;
416 }
GNUNET_RECLAIM_PresentationTypenameToNumberFunction typename_to_number_p
Typename to number.
static const char * jwt_number_to_typename(void *cls, uint32_t type)
Convert a type number (i.e.
int jwt_get_expiration_p(void *cls, const struct GNUNET_RECLAIM_Presentation *cred, struct GNUNET_TIME_Absolute *exp)
Parse a JWT and return the expiration.
GNUNET_RECLAIM_PresentationNumberToTypenameFunction number_to_typename_p
Number to typename.
GNUNET_RECLAIM_PresentationGetIssuerFunction get_issuer_p
Attesation issuer.
GNUNET_RECLAIM_CredentialValueToStringFunction value_to_string
Conversion to string.
GNUNET_RECLAIM_CredentialGetExpirationFunction get_expiration
Expiration.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
GNUNET_RECLAIM_PresentationValueToStringFunction value_to_string_p
Conversion to string.
static uint32_t jwt_typename_to_number(void *cls, const char *jwt_typename)
Convert a type name to the corresponding number.
struct GNUNET_RECLAIM_AttributeList * jwt_parse_attributes_p(void *cls, const struct GNUNET_RECLAIM_Presentation *cred)
Parse a JWT and return the respective claim value as Attribute.
GNUNET_RECLAIM_CredentialGetIssuerFunction get_issuer
Attesation issuer.
int jwt_create_presentation(void *cls, const struct GNUNET_RECLAIM_Credential *cred, const struct GNUNET_RECLAIM_AttributeList *attrs, struct GNUNET_RECLAIM_Presentation **pres)
GNUNET_RECLAIM_CredentialToPresentation create_presentation
Get presentation.
int jwt_get_expiration_c(void *cls, const struct GNUNET_RECLAIM_Credential *cred, struct GNUNET_TIME_Absolute *exp)
Parse a JWT and return the expiration.
GNUNET_RECLAIM_PresentationGetAttributesFunction get_attributes_p
Attesation attributes.
GNUNET_RECLAIM_PresentationGetExpirationFunction get_expiration_p
Expiration.
static int jwt_string_to_value(void *cls, uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of a &#39;value&#39; of an credential to the binary representation.
Each plugin is required to return a pointer to a struct of this type as the return value from its ent...
static char * jwt_value_to_string(void *cls, uint32_t type, const void *data, size_t data_size)
Convert the &#39;value&#39; of an credential to a string.
GNUNET_RECLAIM_CredentialTypenameToNumberFunction typename_to_number
Typename to number.
struct GNUNET_RECLAIM_AttributeList * jwt_parse_attributes_c(void *cls, const struct GNUNET_RECLAIM_Credential *cred)
Parse a JWT and return the respective claim value as Attribute.
GNUNET_RECLAIM_CredentialNumberToTypenameFunction number_to_typename
Number to typename.
GNUNET_RECLAIM_CredentialStringToValueFunction string_to_value
Conversion to binary.
GNUNET_RECLAIM_PresentationStringToValueFunction string_to_value_p
Conversion to binary.
char * jwt_get_issuer_p(void *cls, const struct GNUNET_RECLAIM_Presentation *cred)
Parse a JWT and return the issuer.
char * jwt_get_issuer_c(void *cls, const struct GNUNET_RECLAIM_Credential *cred)
Parse a JWT and return the issuer.
GNUNET_RECLAIM_CredentialGetAttributesFunction get_attributes
Attesation attributes.
Here is the call graph for this function:

◆ libgnunet_plugin_reclaim_credential_jwt_done()

void* libgnunet_plugin_reclaim_credential_jwt_done ( void *  cls)

Exit point from the plugin.

Parameters
clsthe return value from libgnunet_plugin_block_test_init()
Returns
NULL

Definition at line 426 of file plugin_reclaim_credential_jwt.c.

References GNUNET_RECLAIM_CredentialPluginFunctions::cls, and GNUNET_free.

427 {
429 
430  GNUNET_free (api);
431  return NULL;
432 }
void * cls
Closure for all of the callbacks.
Each plugin is required to return a pointer to a struct of this type as the return value from its ent...
#define GNUNET_free(ptr)
Wrapper around free.

Variable Documentation

◆ name

const char* name

◆ number

uint32_t number

Definition at line 100 of file plugin_reclaim_credential_jwt.c.

Referenced by jwt_number_to_typename().

◆ jwt_cred_name_map

struct { ... } jwt_cred_name_map[]
Initial value:
{ NULL, UINT32_MAX } }
A JSON Web Token credential.

Mapping of credential type numbers to human-readable credential type names.

Referenced by jwt_number_to_typename(), and jwt_typename_to_number().