diff options
author | Tristan Schwieren <tristan.schwieren@tum.de> | 2022-01-02 14:15:30 +0100 |
---|---|---|
committer | Tristan Schwieren <tristan.schwieren@tum.de> | 2022-01-02 14:15:30 +0100 |
commit | e97ac989225d0b8b96cc393e90b20937928d579a (patch) | |
tree | 44e4d82869a27660cef528d14f2eed4ec4000177 | |
parent | 071a403a01239008807053282f134502b9c2d4c3 (diff) | |
download | gnunet-e97ac989225d0b8b96cc393e90b20937928d579a.tar.gz gnunet-e97ac989225d0b8b96cc393e90b20937928d579a.zip |
-w3cvc hello world
-rw-r--r-- | src/did/test_w3c_ed25519_2020.c | 4 | ||||
-rw-r--r-- | src/include/gnunet_reclaim_lib.h | 2 | ||||
-rw-r--r-- | src/reclaim/Makefile.am | 10 | ||||
-rw-r--r-- | src/reclaim/gnunet-reclaim.c | 16 | ||||
-rw-r--r-- | src/reclaim/plugin_reclaim_credential_vc.c (renamed from src/reclaim/plugin_reclaim_w3c_verifiable_credential.c) | 119 | ||||
-rw-r--r-- | vc.json | 23 |
6 files changed, 108 insertions, 66 deletions
diff --git a/src/did/test_w3c_ed25519_2020.c b/src/did/test_w3c_ed25519_2020.c index e2534e6ab..9e62062b1 100644 --- a/src/did/test_w3c_ed25519_2020.c +++ b/src/did/test_w3c_ed25519_2020.c | |||
@@ -1,5 +1,3 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2012-2021 GNUnet e.V. | 1 | Copyright (C) 2012-2021 GNUnet e.V. |
4 | 2 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 3 | GNUnet is free software: you can redistribute it and/or modify it |
@@ -21,7 +19,7 @@ | |||
21 | 19 | ||
22 | /** | 20 | /** |
23 | * @file src/did/test_w3c_ed25519_2020.c | 21 | * @file src/did/test_w3c_ed25519_2020.c |
24 | * @brief Testcases for the w3c Ed25519 formats for SSIs https://w3c-ccg.github.io/lds-ed25519-2020 | 22 | * @brief Testcases for the w3c Ed25519 formats for SSIs https://w3c-ccwg.github.io/lds-ed25519-2020 |
25 | * @author Martin Schanzenbach | 23 | * @author Martin Schanzenbach |
26 | */ | 24 | */ |
27 | 25 | ||
diff --git a/src/include/gnunet_reclaim_lib.h b/src/include/gnunet_reclaim_lib.h index 8e0e19f01..ae3e7cd14 100644 --- a/src/include/gnunet_reclaim_lib.h +++ b/src/include/gnunet_reclaim_lib.h | |||
@@ -70,7 +70,7 @@ enum GNUNET_RECLAIM_CredentialType { | |||
70 | /** | 70 | /** |
71 | * verifiable credential | 71 | * verifiable credential |
72 | */ | 72 | */ |
73 | GNUNET_RECLAIM_W3C_VERFIIABLE_CREDENTIAL_TYPE = 3 | 73 | GNUNET_RECLAIM_CREDENTIAL_TYPE_VC = 3 |
74 | }; | 74 | }; |
75 | 75 | ||
76 | /** | 76 | /** |
diff --git a/src/reclaim/Makefile.am b/src/reclaim/Makefile.am index 911a95134..8c6555abb 100644 --- a/src/reclaim/Makefile.am +++ b/src/reclaim/Makefile.am | |||
@@ -15,7 +15,7 @@ REST_PLUGIN = \ | |||
15 | 15 | ||
16 | CREDENTIAL_PLUGIN = \ | 16 | CREDENTIAL_PLUGIN = \ |
17 | libgnunet_plugin_reclaim_credential_jwt.la \ | 17 | libgnunet_plugin_reclaim_credential_jwt.la \ |
18 | libgnunet_plugin_reclaim_w3c_verifiable_credential.la | 18 | libgnunet_plugin_reclaim_credential_vc.la |
19 | 19 | ||
20 | if HAVE_PABC | 20 | if HAVE_PABC |
21 | CREDENTIAL_PLUGIN += libgnunet_plugin_reclaim_credential_pabc.la | 21 | CREDENTIAL_PLUGIN += libgnunet_plugin_reclaim_credential_pabc.la |
@@ -173,14 +173,14 @@ libgnunet_plugin_reclaim_credential_jwt_la_LDFLAGS = \ | |||
173 | $(GN_PLUGIN_LDFLAGS) | 173 | $(GN_PLUGIN_LDFLAGS) |
174 | 174 | ||
175 | 175 | ||
176 | libgnunet_plugin_reclaim_w3c_verifiable_credential_la_SOURCES = \ | 176 | libgnunet_plugin_reclaim_credential_vc_la_SOURCES = \ |
177 | plugin_reclaim_w3c_verifiable_credential.c | 177 | plugin_reclaim_credential_vc.c |
178 | libgnunet_plugin_reclaim_w3c_verifiable_credential_la_LIBADD = \ | 178 | libgnunet_plugin_reclaim_credential_vc_la_LIBADD = \ |
179 | $(top_builddir)/src/util/libgnunetutil.la \ | 179 | $(top_builddir)/src/util/libgnunetutil.la \ |
180 | libgnunetreclaim.la \ | 180 | libgnunetreclaim.la \ |
181 | -ljansson\ | 181 | -ljansson\ |
182 | $(LTLIBINTL) | 182 | $(LTLIBINTL) |
183 | libgnunet_plugin_reclaim_w3c_verifiable_credential_la_LDFLAGS = \ | 183 | libgnunet_plugin_reclaim_credential_vc_la_LDFLAGS = \ |
184 | $(GN_PLUGIN_LDFLAGS) | 184 | $(GN_PLUGIN_LDFLAGS) |
185 | 185 | ||
186 | 186 | ||
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c index da5f90409..5339e047b 100644 --- a/src/reclaim/gnunet-reclaim.c +++ b/src/reclaim/gnunet-reclaim.c | |||
@@ -621,6 +621,14 @@ cred_iter_finished (void *cls) | |||
621 | { | 621 | { |
622 | enum GNUNET_RECLAIM_CredentialType ctype = | 622 | enum GNUNET_RECLAIM_CredentialType ctype = |
623 | GNUNET_RECLAIM_credential_typename_to_number (credential_type); | 623 | GNUNET_RECLAIM_credential_typename_to_number (credential_type); |
624 | |||
625 | if (ctype == UINT32_MAX) | ||
626 | { | ||
627 | printf("Unknown Credential Type"); | ||
628 | cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); | ||
629 | return; | ||
630 | } | ||
631 | |||
624 | struct GNUNET_RECLAIM_Credential *credential = | 632 | struct GNUNET_RECLAIM_Credential *credential = |
625 | GNUNET_RECLAIM_credential_new (credential_name, | 633 | GNUNET_RECLAIM_credential_new (credential_name, |
626 | ctype, | 634 | ctype, |
@@ -672,6 +680,14 @@ cred_iter_cb (void *cls, | |||
672 | cred->data, | 680 | cred->data, |
673 | cred->data_size); | 681 | cred->data_size); |
674 | cred_type = GNUNET_RECLAIM_credential_number_to_typename (cred->type); | 682 | cred_type = GNUNET_RECLAIM_credential_number_to_typename (cred->type); |
683 | |||
684 | if (cred->type == UINT32_MAX) | ||
685 | { | ||
686 | printf("Unknown Credential Type"); | ||
687 | cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); | ||
688 | return; | ||
689 | } | ||
690 | |||
675 | id = GNUNET_STRINGS_data_to_string_alloc (&cred->id, sizeof(cred->id)); | 691 | id = GNUNET_STRINGS_data_to_string_alloc (&cred->id, sizeof(cred->id)); |
676 | fprintf (stdout, | 692 | fprintf (stdout, |
677 | "%s: ``%s'' (%s); ID: %s\n", | 693 | "%s: ``%s'' (%s); ID: %s\n", |
diff --git a/src/reclaim/plugin_reclaim_w3c_verifiable_credential.c b/src/reclaim/plugin_reclaim_credential_vc.c index 7902b2084..d05601263 100644 --- a/src/reclaim/plugin_reclaim_w3c_verifiable_credential.c +++ b/src/reclaim/plugin_reclaim_credential_vc.c | |||
@@ -41,14 +41,15 @@ | |||
41 | * @return NULL on error, otherwise human-readable representation of the value | 41 | * @return NULL on error, otherwise human-readable representation of the value |
42 | */ | 42 | */ |
43 | static char * | 43 | static char * |
44 | w3cvc_value_to_string (void *cls, | 44 | vc_value_to_string (void *cls, |
45 | uint32_t type, | 45 | uint32_t type, |
46 | const void *data, | 46 | const void *data, |
47 | size_t data_size) | 47 | size_t data_size) |
48 | { | 48 | { |
49 | switch (type) | 49 | switch (type) |
50 | { | 50 | { |
51 | case GNUNET_RECLAIM_W3C_VERFIIABLE_CREDENTIAL_TYPE: | 51 | case GNUNET_RECLAIM_CREDENTIAL_TYPE_VC: |
52 | printf("DEBUG: vc_value_to_string: %s\n", (char *) data); | ||
52 | return GNUNET_strndup (data, data_size); | 53 | return GNUNET_strndup (data, data_size); |
53 | //return "A super cool verifiable credential\n"; | 54 | //return "A super cool verifiable credential\n"; |
54 | default: | 55 | default: |
@@ -69,7 +70,7 @@ w3cvc_value_to_string (void *cls, | |||
69 | * @return #GNUNET_OK on success | 70 | * @return #GNUNET_OK on success |
70 | */ | 71 | */ |
71 | static int | 72 | static int |
72 | w3cvc_string_to_value (void *cls, | 73 | vc_string_to_value (void *cls, |
73 | uint32_t type, | 74 | uint32_t type, |
74 | const char *s, | 75 | const char *s, |
75 | void **data, | 76 | void **data, |
@@ -80,7 +81,8 @@ w3cvc_string_to_value (void *cls, | |||
80 | 81 | ||
81 | switch (type) | 82 | switch (type) |
82 | { | 83 | { |
83 | case GNUNET_RECLAIM_W3C_VERFIIABLE_CREDENTIAL_TYPE: | 84 | case GNUNET_RECLAIM_CREDENTIAL_TYPE_VC: |
85 | printf("DEBUG: vc_string_to_value: %s\n", s); | ||
84 | *data = GNUNET_strdup (s); | 86 | *data = GNUNET_strdup (s); |
85 | *data_size = strlen (s) + 1; | 87 | *data_size = strlen (s) + 1; |
86 | return GNUNET_OK; | 88 | return GNUNET_OK; |
@@ -99,26 +101,26 @@ static struct | |||
99 | { | 101 | { |
100 | const char *name; | 102 | const char *name; |
101 | uint32_t number; | 103 | uint32_t number; |
102 | } w3cvc_cred_name_map[] = { { "W3CVC", GNUNET_RECLAIM_W3C_VERFIIABLE_CREDENTIAL_TYPE}, | 104 | } vc_cred_name_map[] = { { "VC", GNUNET_RECLAIM_CREDENTIAL_TYPE_VC}, |
103 | { NULL, UINT32_MAX } }; | 105 | { NULL, UINT32_MAX } }; |
104 | 106 | ||
105 | /** | 107 | /** |
106 | * Convert a type name to the corresponding number. | 108 | * Convert a type name to the corresponding number. |
107 | * | 109 | * |
108 | * @param cls closure, unused | 110 | * @param cls closure, unused |
109 | * @param w3cvc_typename name to convert | 111 | * @param vc_typename name to convert |
110 | * @return corresponding number, UINT32_MAX on error | 112 | * @return corresponding number, UINT32_MAX on error |
111 | */ | 113 | */ |
112 | static uint32_t | 114 | static uint32_t |
113 | w3cvc_typename_to_number (void *cls, const char *w3cvc_typename) | 115 | vc_typename_to_number (void *cls, const char *vc_typename) |
114 | { | 116 | { |
115 | unsigned int i; | 117 | unsigned int i; |
116 | 118 | ||
117 | i = 0; | 119 | i = 0; |
118 | while ((NULL != w3cvc_cred_name_map[i].name) && | 120 | while ((NULL != vc_cred_name_map[i].name) && |
119 | (0 != strcasecmp (w3cvc_typename, w3cvc_cred_name_map[i].name))) | 121 | (0 != strcasecmp (vc_typename, vc_cred_name_map[i].name))) |
120 | i++; | 122 | i++; |
121 | return w3cvc_cred_name_map[i].number; | 123 | return vc_cred_name_map[i].number; |
122 | } | 124 | } |
123 | 125 | ||
124 | 126 | ||
@@ -130,16 +132,16 @@ w3cvc_typename_to_number (void *cls, const char *w3cvc_typename) | |||
130 | * @return corresponding typestring, NULL on error | 132 | * @return corresponding typestring, NULL on error |
131 | */ | 133 | */ |
132 | static const char * | 134 | static const char * |
133 | w3cvc_number_to_typename (void *cls, uint32_t type) | 135 | vc_number_to_typename (void *cls, uint32_t type) |
134 | { | 136 | { |
135 | unsigned int i; | 137 | unsigned int i; |
136 | 138 | ||
137 | i = 0; | 139 | i = 0; |
138 | while ((NULL != w3cvc_cred_name_map[i].name) && (type != | 140 | while ((NULL != vc_cred_name_map[i].name) && (type != |
139 | w3cvc_cred_name_map[i]. | 141 | vc_cred_name_map[i]. |
140 | number)) | 142 | number)) |
141 | i++; | 143 | i++; |
142 | return w3cvc_cred_name_map[i].name; | 144 | return vc_cred_name_map[i].name; |
143 | } | 145 | } |
144 | 146 | ||
145 | 147 | ||
@@ -151,18 +153,20 @@ w3cvc_number_to_typename (void *cls, uint32_t type) | |||
151 | * @return a GNUNET_RECLAIM_Attribute, containing the new value | 153 | * @return a GNUNET_RECLAIM_Attribute, containing the new value |
152 | */ | 154 | */ |
153 | struct GNUNET_RECLAIM_AttributeList * | 155 | struct GNUNET_RECLAIM_AttributeList * |
154 | w3cvc_parse_attributes (void *cls, | 156 | vc_parse_attributes (void *cls, |
155 | const char *data, | 157 | const char *data, |
156 | size_t data_size) | 158 | size_t data_size) |
157 | { | 159 | { |
158 | struct GNUNET_RECLAIM_AttributeList *attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); | 160 | struct GNUNET_RECLAIM_AttributeList *attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); |
159 | 161 | ||
162 | printf("DEBUG: vc_parse_attributes: %s\n", data); | ||
163 | |||
160 | GNUNET_RECLAIM_attribute_list_add (attrs, | 164 | GNUNET_RECLAIM_attribute_list_add (attrs, |
161 | "astring", | 165 | "astring", |
162 | NULL, | 166 | NULL, |
163 | GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING, | 167 | GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING, |
164 | data, | 168 | data, |
165 | strlen(data)); | 169 | (strlen(data) + 1)); |
166 | 170 | ||
167 | return attrs; | 171 | return attrs; |
168 | } | 172 | } |
@@ -176,12 +180,12 @@ w3cvc_parse_attributes (void *cls, | |||
176 | * @return a GNUNET_RECLAIM_Attribute, containing the new value | 180 | * @return a GNUNET_RECLAIM_Attribute, containing the new value |
177 | */ | 181 | */ |
178 | struct GNUNET_RECLAIM_AttributeList * | 182 | struct GNUNET_RECLAIM_AttributeList * |
179 | w3cvc_parse_attributes_c (void *cls, | 183 | vc_parse_attributes_c (void *cls, |
180 | const struct GNUNET_RECLAIM_Credential *cred) | 184 | const struct GNUNET_RECLAIM_Credential *cred) |
181 | { | 185 | { |
182 | if (cred->type != GNUNET_RECLAIM_W3C_VERFIIABLE_CREDENTIAL_TYPE) | 186 | if (cred->type != GNUNET_RECLAIM_CREDENTIAL_TYPE_VC) |
183 | return NULL; | 187 | return NULL; |
184 | return w3cvc_parse_attributes (cls, cred->data, cred->data_size); | 188 | return vc_parse_attributes (cls, cred->data, cred->data_size); |
185 | } | 189 | } |
186 | 190 | ||
187 | 191 | ||
@@ -193,12 +197,12 @@ w3cvc_parse_attributes_c (void *cls, | |||
193 | * @return a GNUNET_RECLAIM_Attribute, containing the new value | 197 | * @return a GNUNET_RECLAIM_Attribute, containing the new value |
194 | */ | 198 | */ |
195 | struct GNUNET_RECLAIM_AttributeList * | 199 | struct GNUNET_RECLAIM_AttributeList * |
196 | w3cvc_parse_attributes_p (void *cls, | 200 | vc_parse_attributes_p (void *cls, |
197 | const struct GNUNET_RECLAIM_Presentation *cred) | 201 | const struct GNUNET_RECLAIM_Presentation *cred) |
198 | { | 202 | { |
199 | if (cred->type != GNUNET_RECLAIM_W3C_VERFIIABLE_CREDENTIAL_TYPE) | 203 | if (cred->type != GNUNET_RECLAIM_CREDENTIAL_TYPE_VC) |
200 | return NULL; | 204 | return NULL; |
201 | return w3cvc_parse_attributes (cls, cred->data, cred->data_size); | 205 | return vc_parse_attributes (cls, cred->data, cred->data_size); |
202 | } | 206 | } |
203 | 207 | ||
204 | 208 | ||
@@ -210,11 +214,12 @@ w3cvc_parse_attributes_p (void *cls, | |||
210 | * @return a string, containing the isser | 214 | * @return a string, containing the isser |
211 | */ | 215 | */ |
212 | char * | 216 | char * |
213 | w3cvc_get_issuer (void *cls, | 217 | vc_get_issuer (void *cls, |
214 | const char *data, | 218 | const char *data, |
215 | size_t data_size) | 219 | size_t data_size) |
216 | { | 220 | { |
217 | return "some cool boi"; | 221 | char * string = "some cool boi"; |
222 | return GNUNET_strndup(string, strlen(string)); | ||
218 | } | 223 | } |
219 | 224 | ||
220 | 225 | ||
@@ -226,12 +231,12 @@ w3cvc_get_issuer (void *cls, | |||
226 | * @return a string, containing the isser | 231 | * @return a string, containing the isser |
227 | */ | 232 | */ |
228 | char * | 233 | char * |
229 | w3cvc_get_issuer_c (void *cls, | 234 | vc_get_issuer_c (void *cls, |
230 | const struct GNUNET_RECLAIM_Credential *cred) | 235 | const struct GNUNET_RECLAIM_Credential *cred) |
231 | { | 236 | { |
232 | if (GNUNET_RECLAIM_W3C_VERFIIABLE_CREDENTIAL_TYPE != cred->type) | 237 | if (GNUNET_RECLAIM_CREDENTIAL_TYPE_VC != cred->type) |
233 | return NULL; | 238 | return NULL; |
234 | return w3cvc_get_issuer (cls, cred->data, cred->data_size); | 239 | return vc_get_issuer (cls, cred->data, cred->data_size); |
235 | } | 240 | } |
236 | 241 | ||
237 | 242 | ||
@@ -243,12 +248,12 @@ w3cvc_get_issuer_c (void *cls, | |||
243 | * @return a string, containing the isser | 248 | * @return a string, containing the isser |
244 | */ | 249 | */ |
245 | char * | 250 | char * |
246 | w3cvc_get_issuer_p (void *cls, | 251 | vc_get_issuer_p (void *cls, |
247 | const struct GNUNET_RECLAIM_Presentation *cred) | 252 | const struct GNUNET_RECLAIM_Presentation *cred) |
248 | { | 253 | { |
249 | if (GNUNET_RECLAIM_W3C_VERFIIABLE_CREDENTIAL_TYPE != cred->type) | 254 | if (GNUNET_RECLAIM_CREDENTIAL_TYPE_VC != cred->type) |
250 | return NULL; | 255 | return NULL; |
251 | return w3cvc_get_issuer (cls, cred->data, cred->data_size); | 256 | return vc_get_issuer (cls, cred->data, cred->data_size); |
252 | } | 257 | } |
253 | 258 | ||
254 | 259 | ||
@@ -260,7 +265,7 @@ w3cvc_get_issuer_p (void *cls, | |||
260 | * @return a string, containing the expiration | 265 | * @return a string, containing the expiration |
261 | */ | 266 | */ |
262 | enum GNUNET_GenericReturnValue | 267 | enum GNUNET_GenericReturnValue |
263 | w3cvc_get_expiration (void *cls, | 268 | vc_get_expiration (void *cls, |
264 | const char *data, | 269 | const char *data, |
265 | size_t data_size, | 270 | size_t data_size, |
266 | struct GNUNET_TIME_Absolute *exp) | 271 | struct GNUNET_TIME_Absolute *exp) |
@@ -278,13 +283,13 @@ w3cvc_get_expiration (void *cls, | |||
278 | * @return the expirati | 283 | * @return the expirati |
279 | */ | 284 | */ |
280 | enum GNUNET_GenericReturnValue | 285 | enum GNUNET_GenericReturnValue |
281 | w3cvc_get_expiration_c (void *cls, | 286 | vc_get_expiration_c (void *cls, |
282 | const struct GNUNET_RECLAIM_Credential *cred, | 287 | const struct GNUNET_RECLAIM_Credential *cred, |
283 | struct GNUNET_TIME_Absolute *exp) | 288 | struct GNUNET_TIME_Absolute *exp) |
284 | { | 289 | { |
285 | if (GNUNET_RECLAIM_W3C_VERFIIABLE_CREDENTIAL_TYPE != cred->type) | 290 | if (GNUNET_RECLAIM_CREDENTIAL_TYPE_VC != cred->type) |
286 | return GNUNET_NO; | 291 | return GNUNET_NO; |
287 | return w3cvc_get_expiration (cls, cred->data, cred->data_size, exp); | 292 | return vc_get_expiration (cls, cred->data, cred->data_size, exp); |
288 | } | 293 | } |
289 | 294 | ||
290 | 295 | ||
@@ -296,26 +301,26 @@ w3cvc_get_expiration_c (void *cls, | |||
296 | * @return a string, containing the isser | 301 | * @return a string, containing the isser |
297 | */ | 302 | */ |
298 | enum GNUNET_GenericReturnValue | 303 | enum GNUNET_GenericReturnValue |
299 | w3cvc_get_expiration_p (void *cls, | 304 | vc_get_expiration_p (void *cls, |
300 | const struct GNUNET_RECLAIM_Presentation *cred, | 305 | const struct GNUNET_RECLAIM_Presentation *cred, |
301 | struct GNUNET_TIME_Absolute *exp) | 306 | struct GNUNET_TIME_Absolute *exp) |
302 | { | 307 | { |
303 | if (GNUNET_RECLAIM_W3C_VERFIIABLE_CREDENTIAL_TYPE != cred->type) | 308 | if (GNUNET_RECLAIM_CREDENTIAL_TYPE_VC != cred->type) |
304 | return GNUNET_NO; | 309 | return GNUNET_NO; |
305 | return w3cvc_get_expiration (cls, cred->data, cred->data_size, exp); | 310 | return vc_get_expiration (cls, cred->data, cred->data_size, exp); |
306 | } | 311 | } |
307 | 312 | ||
308 | 313 | ||
309 | enum GNUNET_GenericReturnValue | 314 | enum GNUNET_GenericReturnValue |
310 | w3cvc_create_presentation (void *cls, | 315 | vc_create_presentation (void *cls, |
311 | const struct GNUNET_RECLAIM_Credential *cred, | 316 | const struct GNUNET_RECLAIM_Credential *cred, |
312 | const struct GNUNET_RECLAIM_AttributeList *attrs, | 317 | const struct GNUNET_RECLAIM_AttributeList *attrs, |
313 | struct GNUNET_RECLAIM_Presentation **presentation) | 318 | struct GNUNET_RECLAIM_Presentation **presentation) |
314 | { | 319 | { |
315 | if (GNUNET_RECLAIM_W3C_VERFIIABLE_CREDENTIAL_TYPE != cred->type) | 320 | if (GNUNET_RECLAIM_CREDENTIAL_TYPE_VC != cred->type) |
316 | return GNUNET_NO; | 321 | return GNUNET_NO; |
317 | *presentation = GNUNET_RECLAIM_presentation_new ( | 322 | *presentation = GNUNET_RECLAIM_presentation_new ( |
318 | GNUNET_RECLAIM_W3C_VERFIIABLE_CREDENTIAL_TYPE, | 323 | GNUNET_RECLAIM_CREDENTIAL_TYPE_VC, |
319 | cred->data, | 324 | cred->data, |
320 | cred->data_size); | 325 | cred->data_size); |
321 | return GNUNET_OK; | 326 | return GNUNET_OK; |
@@ -329,26 +334,26 @@ w3cvc_create_presentation (void *cls, | |||
329 | * @return the exported block API | 334 | * @return the exported block API |
330 | */ | 335 | */ |
331 | void * | 336 | void * |
332 | libgnunet_plugin_reclaim_credential_w3cvc_init (void *cls) | 337 | libgnunet_plugin_reclaim_credential_vc_init (void *cls) |
333 | { | 338 | { |
334 | struct GNUNET_RECLAIM_CredentialPluginFunctions *api; | 339 | struct GNUNET_RECLAIM_CredentialPluginFunctions *api; |
335 | 340 | ||
336 | api = GNUNET_new (struct GNUNET_RECLAIM_CredentialPluginFunctions); | 341 | api = GNUNET_new (struct GNUNET_RECLAIM_CredentialPluginFunctions); |
337 | api->value_to_string = &w3cvc_value_to_string; | 342 | api->value_to_string = &vc_value_to_string; |
338 | api->string_to_value = &w3cvc_string_to_value; | 343 | api->string_to_value = &vc_string_to_value; |
339 | api->typename_to_number = &w3cvc_typename_to_number; | 344 | api->typename_to_number = &vc_typename_to_number; // done |
340 | api->number_to_typename = &w3cvc_number_to_typename; | 345 | api->number_to_typename = &vc_number_to_typename; // done |
341 | api->get_attributes = &w3cvc_parse_attributes_c; | 346 | api->get_attributes = &vc_parse_attributes_c; |
342 | api->get_issuer = &w3cvc_get_issuer_c; | 347 | api->get_issuer = &vc_get_issuer_c; |
343 | api->get_expiration = &w3cvc_get_expiration_c; | 348 | api->get_expiration = &vc_get_expiration_c; // not needed |
344 | api->value_to_string_p = &w3cvc_value_to_string; | 349 | api->value_to_string_p = &vc_value_to_string; |
345 | api->string_to_value_p = &w3cvc_string_to_value; | 350 | api->string_to_value_p = &vc_string_to_value; |
346 | api->typename_to_number_p = &w3cvc_typename_to_number; | 351 | api->typename_to_number_p = &vc_typename_to_number; // done |
347 | api->number_to_typename_p = &w3cvc_number_to_typename; | 352 | api->number_to_typename_p = &vc_number_to_typename; // done |
348 | api->get_attributes_p = &w3cvc_parse_attributes_p; | 353 | api->get_attributes_p = &vc_parse_attributes_p; |
349 | api->get_issuer_p = &w3cvc_get_issuer_p; | 354 | api->get_issuer_p = &vc_get_issuer_p; |
350 | api->get_expiration_p = &w3cvc_get_expiration_p; | 355 | api->get_expiration_p = &vc_get_expiration_p; |
351 | api->create_presentation = &w3cvc_create_presentation; | 356 | api->create_presentation = &vc_create_presentation; |
352 | return api; | 357 | return api; |
353 | } | 358 | } |
354 | 359 | ||
@@ -360,7 +365,7 @@ libgnunet_plugin_reclaim_credential_w3cvc_init (void *cls) | |||
360 | * @return NULL | 365 | * @return NULL |
361 | */ | 366 | */ |
362 | void * | 367 | void * |
363 | libgnunet_plugin_reclaim_credential_w3cvc_done (void *cls) | 368 | libgnunet_plugin_reclaim_credential_vc_done (void *cls) |
364 | { | 369 | { |
365 | struct GNUNET_RECLAIM_CredentialPluginFunctions *api = cls; | 370 | struct GNUNET_RECLAIM_CredentialPluginFunctions *api = cls; |
366 | 371 | ||
diff --git a/vc.json b/vc.json new file mode 100644 index 000000000..dbc4d5d6d --- /dev/null +++ b/vc.json | |||
@@ -0,0 +1,23 @@ | |||
1 | { | ||
2 | "@context": [ | ||
3 | "https://www.w3.org/2018/credentials/v1", | ||
4 | "https://www.w3.org/2018/credentials/examples/v1" | ||
5 | ], | ||
6 | "type": ["VerifiableCredential"], | ||
7 | "issuer": "did:reclaim:1234", | ||
8 | "issuanceDate": "2018-02-24T05:28:04Z", | ||
9 | "credentialSubject": { | ||
10 | "id": "did:example:abcdef1234567", | ||
11 | "name": "Jane Doe" | ||
12 | }, | ||
13 | "proof": { | ||
14 | "type": "RsaSignature2018", | ||
15 | "created": "2017-06-18T21:19:10Z", | ||
16 | "proofPurpose": "assertionMethod", | ||
17 | "verificationMethod": "did:reclaim:1234#key-1", | ||
18 | "jws": "eyJhbGciOiJSUzI1NiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..TCYt5X | ||
19 | sITJX1CxPCT8yAV-TVkIEq_PbChOMqsLfRoPsnsgw5WEuts01mq-pQy7UJiN5mgRxD-WUc | ||
20 | X16dUEMGlv50aqzpqh4Qktb3rk-BuQy72IFLOqV0G_zS245-kronKb78cPN25DGlcTwLtj | ||
21 | PAYuNzVBAh4vGHSrQyHUdBBPM" | ||
22 | } | ||
23 | } | ||