[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: implement json_to_truth
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: implement json_to_truth |
Date: |
Fri, 19 Feb 2021 00:58:44 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new 83a648a implement json_to_truth
83a648a is described below
commit 83a648ae64901d492445392b7459eda5821f3e6b
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Feb 19 00:58:42 2021 +0100
implement json_to_truth
---
src/lib/anastasis_backup.c | 41 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 39 insertions(+), 2 deletions(-)
diff --git a/src/lib/anastasis_backup.c b/src/lib/anastasis_backup.c
index ff4e6b9..3fc12d0 100644
--- a/src/lib/anastasis_backup.c
+++ b/src/lib/anastasis_backup.c
@@ -81,8 +81,45 @@ struct ANASTASIS_Truth
struct ANASTASIS_Truth *
ANASTASIS_truth_from_json (const json_t *json)
{
- GNUNET_break (0); // FIXME: implement!
- return NULL;
+ struct ANASTASIS_Truth *t = GNUNET_new (struct ANASTASIS_Truth);
+ const char *url;
+ const char *method;
+ const char *instructions;
+ const char *mime_type;
+ struct GNUNET_JSON_Specification spec[] = {
+ GNUNET_JSON_spec_string ("url",
+ &url),
+ GNUNET_JSON_spec_string ("method",
+ &method),
+ GNUNET_JSON_spec_string ("instructions",
+ &instructions),
+ GNUNET_JSON_spec_string ("mime_type",
+ &mime_type),
+ GNUNET_JSON_spec_fixed_auto ("uuid",
+ &t->uuid),
+ GNUNET_JSON_spec_fixed_auto ("key_share",
+ &t->key_share),
+ GNUNET_JSON_spec_fixed_auto ("truth_key",
+ &t->truth_key),
+ GNUNET_JSON_spec_fixed_auto ("salt",
+ &t->salt),
+ GNUNET_JSON_spec_end ()
+ };
+
+ if (GNUNET_OK !=
+ GNUNET_JSON_parse (json,
+ spec,
+ NULL, NULL))
+ {
+ GNUNET_break_op (0);
+ GNUNET_free (t);
+ return NULL;
+ }
+ t->url = GNUNET_strdup (url);
+ t->method = GNUNET_strdup (method);
+ t->instructions = GNUNET_strdup (instructions);
+ t->mime_type = GNUNET_strdup (mime_type);
+ return t;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: implement json_to_truth,
gnunet <=