diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2022-06-27 17:38:11 +0200 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2022-06-27 17:38:11 +0200 |
commit | cddfaf007f4ac22e224f3df5f0151a0d620fb131 (patch) | |
tree | 691801af8cce13e8c4fd1adb3c53606a5e7c57fb /src/json/json_pack.c | |
parent | 87025cfd178780f2e928019163ce81c1b7675c57 (diff) | |
download | exchange-cddfaf007f4ac22e224f3df5f0151a0d620fb131.tar.xz |
age commitment: json parser helper and support for purses added
Diffstat (limited to 'src/json/json_pack.c')
-rw-r--r-- | src/json/json_pack.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/json/json_pack.c b/src/json/json_pack.c index bb52eeb05..ec036f691 100644 --- a/src/json/json_pack.c +++ b/src/json/json_pack.c @@ -72,6 +72,40 @@ TALER_JSON_pack_econtract ( struct GNUNET_JSON_PackSpec +TALER_JSON_pack_age_commitment ( + const char *name, + const struct TALER_AgeCommitment *age_commitment) +{ + struct GNUNET_JSON_PackSpec ps = { + .field_name = name, + }; + json_t *keys; + + if (NULL == age_commitment || + 0 == age_commitment->num) + return ps; + + GNUNET_assert (NULL != + (keys = json_array ())); + + for (size_t i = 0; + i < age_commitment->num; + i++) + { + json_t *val; + val = GNUNET_JSON_from_data (&age_commitment->keys[i], + sizeof(age_commitment->keys[i])); + GNUNET_assert (NULL != val); + GNUNET_assert (0 == + json_array_append_new (keys, val)); + } + + ps.object = keys; + return ps; +} + + +struct GNUNET_JSON_PackSpec TALER_JSON_pack_denom_pub ( const char *name, const struct TALER_DenominationPublicKey *pk) |