summaryrefslogtreecommitdiff
path: root/src/include/taler_json_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/taler_json_lib.h')
-rw-r--r--src/include/taler_json_lib.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h
index b4f999001..a8ad6f243 100644
--- a/src/include/taler_json_lib.h
+++ b/src/include/taler_json_lib.h
@@ -28,6 +28,37 @@
#include "taler_util.h"
#include "taler_error_codes.h"
+
+/**
+ * Details about an encrypted contract.
+ */
+struct TALER_EncryptedContract
+{
+
+ /**
+ * Signature of the client affiming this encrypted contract.
+ */
+ struct TALER_PurseContractSignatureP econtract_sig;
+
+ /**
+ * Contract decryption key for the purse.
+ */
+ struct TALER_ContractDiffiePublicP contract_pub;
+
+ /**
+ * Encrypted contract, can be NULL.
+ */
+ void *econtract;
+
+ /**
+ * Number of bytes in @e econtract.
+ */
+ size_t econtract_size;
+
+
+};
+
+
/**
* Print JSON parsing related error information
* @deprecated
@@ -172,6 +203,20 @@ TALER_JSON_pack_amount_nbo (const char *name,
/**
+ * Generate packer instruction for a JSON field of type
+ * encrypted contract.
+ *
+ * @param name name of the field to add to the object
+ * @param econtract the encrypted contract
+ * @return json pack specification
+ */
+struct GNUNET_JSON_PackSpec
+TALER_JSON_pack_econtract (
+ const char *name,
+ const struct TALER_EncryptedContract *econtract);
+
+
+/**
* Convert a TALER amount to a JSON object.
*
* @param amount the amount
@@ -238,6 +283,18 @@ TALER_JSON_spec_amount_any (const char *name,
/**
+ * Provide specification to parse given JSON object to an encrypted contract.
+ *
+ * @param name name of the amount field in the JSON
+ * @param[out] econtract where to store the encrypted contract
+ * @return spec for parsing an amount
+ */
+struct GNUNET_JSON_Specification
+TALER_JSON_spec_econtract (const char *name,
+ struct TALER_EncryptedContract *econtract);
+
+
+/**
* Provide specification to parse given JSON object to an amount
* in any currency in network byte order.
*