summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Blättler <blatc2@bfh.ch>2024-04-28 13:55:58 +0200
committerChristian Blättler <blatc2@bfh.ch>2024-04-28 13:55:58 +0200
commita95dfe2f7882055f50ee804cf950b3350e162bcf (patch)
tree8da846acaf9e0b5276dd931ae863b037c3e0f907
parentd4f6ca72309f5400af20aa57905846fd3ac13949 (diff)
downloadexchange-a95dfe2f7882055f50ee804cf950b3350e162bcf.tar.gz
exchange-a95dfe2f7882055f50ee804cf950b3350e162bcf.tar.bz2
exchange-a95dfe2f7882055f50ee804cf950b3350e162bcf.zip
json pack token envelope
-rw-r--r--src/include/taler_json_lib.h13
-rw-r--r--src/json/json_pack.c49
2 files changed, 31 insertions, 31 deletions
diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h
index 17768c0e3..22e44fdf0 100644
--- a/src/include/taler_json_lib.h
+++ b/src/include/taler_json_lib.h
@@ -168,6 +168,19 @@ TALER_JSON_pack_token_issue_sig (
/**
+ * Generate packer instruction for a JSON field of type token envelope.
+ *
+ * @param name name of the field to add to the object
+ * @param envelope blinded token envelope
+ * @return json pack specification
+ */
+struct GNUNET_JSON_PackSpec
+TALER_JSON_pack_token_envelope (
+ const char *name,
+ const struct TALER_TokenEnvelopeP *envelope);
+
+
+/**
* 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
index 940123ea0..427ac3e85 100644
--- a/src/json/json_pack.c
+++ b/src/json/json_pack.c
@@ -171,6 +171,22 @@ TALER_JSON_pack_token_issue_sig (
struct GNUNET_JSON_PackSpec
+TALER_JSON_pack_token_envelope (
+ const char *name,
+ const struct TALER_TokenEnvelopeP *envelope)
+{
+ struct GNUNET_JSON_PackSpec ps = {
+ .field_name = name,
+ };
+
+ if (NULL == envelope)
+ return ps;
+ return GNUNET_JSON_pack_blinded_message (name,
+ envelope->blinded_pub);
+}
+
+
+struct GNUNET_JSON_PackSpec
TALER_JSON_pack_exchange_withdraw_values (
const char *name,
const struct TALER_ExchangeWithdrawValues *ewv)
@@ -263,37 +279,8 @@ TALER_JSON_pack_blinded_planchet (
if (NULL == blinded_planchet)
return ps;
- bm = blinded_planchet->blinded_message;
- switch (bm->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_data_varsize (
- "rsa_blinded_planchet",
- bm->details.rsa_blinded_message.blinded_msg,
- bm->details.rsa_blinded_message.blinded_msg_size));
- return ps;
- case GNUNET_CRYPTO_BSA_CS:
- ps.object = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("cipher",
- "CS"),
- GNUNET_JSON_pack_data_auto (
- "cs_nonce",
- &bm->details.cs_blinded_message.nonce),
- GNUNET_JSON_pack_data_auto (
- "cs_blinded_c0",
- &bm->details.cs_blinded_message.c[0]),
- GNUNET_JSON_pack_data_auto (
- "cs_blinded_c1",
- &bm->details.cs_blinded_message.c[1]));
- return ps;
- }
- GNUNET_assert (0);
- return ps;
+ return GNUNET_JSON_pack_blinded_message (name,
+ blinded_planchet->blinded_message);
}