From 1db139a7f3b74b2dc4135ab8b42d625415705d63 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 31 Jul 2021 22:50:16 +0200 Subject: -eliminating some legacy json_pack calls from Anastasis --- src/restclient/anastasis_api_truth_store.c | 33 +++++++++++++----------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'src/restclient/anastasis_api_truth_store.c') 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); -- cgit v1.2.3