summaryrefslogtreecommitdiff
path: root/src/restclient/anastasis_api_truth_store.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/restclient/anastasis_api_truth_store.c')
-rw-r--r--src/restclient/anastasis_api_truth_store.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/src/restclient/anastasis_api_truth_store.c b/src/restclient/anastasis_api_truth_store.c
index ef6a642..3311bc4 100644
--- a/src/restclient/anastasis_api_truth_store.c
+++ b/src/restclient/anastasis_api_truth_store.c
@@ -295,25 +295,20 @@ ANASTASIS_truth_store (
{
json_t *truth_data;
- truth_data = json_pack ("{s:o," /* encrypted KeyShare */
- " s:s," /* type */
- " s:o," /* nonce */
- " s:s," /* truth_mime */
- " s:I}", /* payment years */
- "keyshare_data",
- GNUNET_JSON_from_data_auto (encrypted_keyshare),
- "type",
- type,
- "encrypted_truth",
- GNUNET_JSON_from_data (encrypted_truth,
- encrypted_truth_size),
- "truth_mime",
- (NULL != truth_mime)
- ? truth_mime
- : "",
- "storage_duration_years",
- (json_int_t) payment_years_requested);
- GNUNET_assert (NULL != truth_data);
+ truth_data = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_data_auto ("keyshare_data",
+ encrypted_keyshare),
+ GNUNET_JSON_pack_string ("type",
+ type),
+ GNUNET_JSON_pack_data_varsize ("encrypted_truth",
+ encrypted_truth,
+ encrypted_truth_size),
+ GNUNET_JSON_pack_string ("truth_mime",
+ (NULL != truth_mime)
+ ? truth_mime
+ : ""),
+ GNUNET_JSON_pack_uint64 ("storage_duration_years",
+ payment_years_requested));
json_str = json_dumps (truth_data,
JSON_COMPACT);
GNUNET_assert (NULL != json_str);