summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-05-24 02:28:03 +0200
committerFlorian Dold <florian.dold@gmail.com>2016-05-24 02:28:15 +0200
commit8c3ffbf2a356b7c684bb65b8678e819183e52d76 (patch)
tree0cb5ef556310a03b8b7784223fb5d44791d10284 /src
parentfc09e6a8feb14625f469f155bd78467ff03ef9b3 (diff)
downloadexchange-8c3ffbf2a356b7c684bb65b8678e819183e52d76.tar.gz
exchange-8c3ffbf2a356b7c684bb65b8678e819183e52d76.tar.bz2
exchange-8c3ffbf2a356b7c684bb65b8678e819183e52d76.zip
allow access to raw /keys response
Diffstat (limited to 'src')
-rw-r--r--src/exchange-lib/exchange_api_handle.c37
-rw-r--r--src/include/taler_exchange_service.h11
2 files changed, 44 insertions, 4 deletions
diff --git a/src/exchange-lib/exchange_api_handle.c b/src/exchange-lib/exchange_api_handle.c
index 356a2fd27..6de5ee59b 100644
--- a/src/exchange-lib/exchange_api_handle.c
+++ b/src/exchange-lib/exchange_api_handle.c
@@ -109,6 +109,12 @@ struct TALER_EXCHANGE_Handle
struct TALER_EXCHANGE_Keys key_data;
/**
+ * Raw key data of the exchange, only valid if
+ * @e handshake_complete is past stage #MHS_CERT.
+ */
+ json_t *key_data_raw;
+
+ /**
* Stage of the exchange's initialization routines.
*/
enum ExchangeHandleState state;
@@ -623,11 +629,18 @@ keys_completed_cb (void *cls,
case 0:
break;
case MHD_HTTP_OK:
- if ( (NULL == resp_obj) ||
- (GNUNET_OK !=
- decode_keys_json (resp_obj,
- &kr->exchange->key_data)) )
+ if (NULL == resp_obj)
+ {
response_code = 0;
+ break;
+ }
+ if (GNUNET_OK !=
+ decode_keys_json (resp_obj, &kr->exchange->key_data))
+ {
+ response_code = 0;
+ break;
+ }
+ exchange->key_data_raw = json_deep_copy (resp_obj);
break;
default:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -806,6 +819,7 @@ TALER_EXCHANGE_disconnect (struct TALER_EXCHANGE_Handle *exchange)
GNUNET_array_grow (exchange->key_data.auditors,
exchange->key_data.num_auditors,
0);
+ json_decref (exchange->key_data_raw);
GNUNET_free (exchange->url);
GNUNET_free (exchange);
}
@@ -896,4 +910,19 @@ TALER_EXCHANGE_get_keys (const struct TALER_EXCHANGE_Handle *exchange)
}
+/**
+ * Obtain the keys from the exchange in the
+ * raw JSON format
+ *
+ * @param exchange the exchange handle
+ * @return the exchange's keys in raw JSON
+ */
+json_t *
+TALER_EXCHANGE_get_keys_raw (const struct TALER_EXCHANGE_Handle *exchange)
+{
+ return json_deep_copy (exchange->key_data_raw);
+}
+
+
+
/* end of exchange_api_handle.c */
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index 57ab51253..1655e1a67 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -277,6 +277,17 @@ TALER_EXCHANGE_get_keys (const struct TALER_EXCHANGE_Handle *exchange);
/**
+ * Obtain the keys from the exchange in the
+ * raw JSON format
+ *
+ * @param exchange the exchange handle
+ * @return the exchange's keys in raw JSON
+ */
+json_t *
+TALER_EXCHANGE_get_keys_raw (const struct TALER_EXCHANGE_Handle *exchange);
+
+
+/**
* Test if the given @a pub is a the current signing key from the exchange
* according to @a keys.
*