aboutsummaryrefslogtreecommitdiff
path: root/src/util/json.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/json.c')
-rw-r--r--src/util/json.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/util/json.c b/src/util/json.c
index 269e6cf26..d66c95c43 100644
--- a/src/util/json.c
+++ b/src/util/json.c
@@ -90,6 +90,34 @@ TALER_JSON_from_abs (struct GNUNET_TIME_Absolute stamp)
90} 90}
91 91
92 92
93/**
94 * Convert a signature (with purpose) to a JSON object representation.
95 *
96 * @param purpose purpose of the signature
97 * @param signature the signature
98 * @return the JSON reporesentation of the signature with purpose
99 */
100json_t *
101TALER_JSON_from_sig (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
102 const struct GNUNET_CRYPTO_EddsaSignature *signature)
103{
104 json_t *root;
105 json_t *el;
106
107 root = json_object ();
108
109 el = json_integer ((json_int_t) ntohl (purpose->size));
110 json_object_set_new (root, "size", el);
111
112 el = json_integer ((json_int_t) ntohl (purpose->purpose));
113 json_object_set_new (root, "purpose", el);
114
115 el = TALER_JSON_from_data (signature, sizeof (struct GNUNET_CRYPTO_EddsaSignature));
116 json_object_set_new (root, "sig", el);
117
118 return root;
119}
120
93 121
94/** 122/**
95 * Convert binary data to a JSON string 123 * Convert binary data to a JSON string