exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 5ea7c067a0751ae3af6ecd770d1c932a5b98b8fd
parent cb2c4c9c0e31ce01ce65082e38db1c2a2101b4d5
Author: Christian Blättler <blatc2@bfh.ch>
Date:   Fri, 26 Apr 2024 11:48:24 +0200

add pack helper for token issue signature

Diffstat:
Msrc/include/taler_json_lib.h | 14++++++++++++++
Msrc/json/json_pack.c | 41++++++++++++++++-------------------------
2 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h @@ -154,6 +154,20 @@ TALER_JSON_pack_blinded_planchet ( /** + * Generate packer instruction for a JSON field of type + * blinded token issue signature. + * + * @param name name of the field to add to the object + * @param sig token issue signature + * @return json pack specification + */ +struct GNUNET_JSON_PackSpec +TALER_JSON_pack_token_issue_sig ( + const char *name, + const struct TALER_TokenIssueSignatureP *sig); + + +/** * Generate packer instruction for a JSON field of type * exchange withdraw values (/csr). * diff --git a/src/json/json_pack.c b/src/json/json_pack.c @@ -145,37 +145,28 @@ TALER_JSON_pack_denom_sig ( const char *name, const struct TALER_DenominationSignature *sig) { - const struct GNUNET_CRYPTO_UnblindedSignature *bs; struct GNUNET_JSON_PackSpec ps = { .field_name = name, }; - if (NULL == sig) return ps; - bs = sig->unblinded_sig; - switch (bs->cipher) - { - case GNUNET_CRYPTO_BSA_INVALID: - break; - case GNUNET_CRYPTO_BSA_RSA: - ps.object = GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("cipher", - "RSA"), - GNUNET_JSON_pack_rsa_signature ("rsa_signature", - bs->details.rsa_signature)); - return ps; - case GNUNET_CRYPTO_BSA_CS: - ps.object = GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("cipher", - "CS"), - GNUNET_JSON_pack_data_auto ("cs_signature_r", - &bs->details.cs_signature.r_point), - GNUNET_JSON_pack_data_auto ("cs_signature_s", - &bs->details.cs_signature.s_scalar)); + return GNUNET_JSON_pack_unblinded_signature (name, + sig->unblinded_sig); +} + + +struct GNUNET_JSON_PackSpec +TALER_JSON_pack_token_issue_sig ( + const char *name, + const struct TALER_TokenIssueSignatureP *sig) +{ + struct GNUNET_JSON_PackSpec ps = { + .field_name = name, + }; + if (NULL == sig) return ps; - } - GNUNET_assert (0); - return ps; + return GNUNET_JSON_pack_unblinded_signature (name, + sig->signature); }