summaryrefslogtreecommitdiff
path: root/src/json/json_helper.c
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2021-12-27 23:24:48 +0100
committerÖzgür Kesim <oec-taler@kesim.org>2021-12-27 23:24:48 +0100
commitef4238874f6628a9ee4464ad3b70a7fde96d518b (patch)
tree27ba7f32c4d32bce4c821ba6c6a2ed8791d2c30b /src/json/json_helper.c
parent070f442a1182c7c2a09c42e94ce202509ade1b77 (diff)
downloadexchange-ef4238874f6628a9ee4464ad3b70a7fde96d518b.tar.gz
exchange-ef4238874f6628a9ee4464ad3b70a7fde96d518b.tar.bz2
exchange-ef4238874f6628a9ee4464ad3b70a7fde96d518b.zip
[age restriction] progress 9/n
More worke towards support for extensions and age restriction: - taler-exchange-httpd_management_extensions.c almost completed - handling of request implemented - stub "set_extensions" for database transaction added - utility functions added - TALER_exchange_offline_extension_agemask_{sign,verify} - TALER_agemask_parse_json
Diffstat (limited to 'src/json/json_helper.c')
-rw-r--r--src/json/json_helper.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/json/json_helper.c b/src/json/json_helper.c
index 949354e24..3b4da5595 100644
--- a/src/json/json_helper.c
+++ b/src/json/json_helper.c
@@ -659,4 +659,36 @@ TALER_JSON_spec_i18n_str (const char *name,
}
+enum GNUNET_GenericReturnValue
+TALER_agemask_parse_json (const json_t *root,
+ struct TALER_AgeMask *mask)
+{
+ const char *name;
+ struct GNUNET_JSON_Specification spec[] = {
+ GNUNET_JSON_spec_string ("extension",
+ &name),
+ GNUNET_JSON_spec_uint32 ("mask",
+ &mask->mask),
+ GNUNET_JSON_spec_end ()
+ };
+
+ if (GNUNET_OK != GNUNET_JSON_parse (root,
+ spec,
+ NULL,
+ NULL))
+ {
+ return GNUNET_SYSERR;
+ }
+
+ if (! strncmp (name,
+ "age_restriction",
+ sizeof("age_restriction")))
+ {
+ return GNUNET_SYSERR;
+ }
+
+ return GNUNET_OK;
+}
+
+
/* end of json/json_helper.c */