diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-05-24 02:28:03 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-05-24 02:28:15 +0200 |
commit | 8c3ffbf2a356b7c684bb65b8678e819183e52d76 (patch) | |
tree | 0cb5ef556310a03b8b7784223fb5d44791d10284 | |
parent | fc09e6a8feb14625f469f155bd78467ff03ef9b3 (diff) |
allow access to raw /keys response
-rw-r--r-- | src/exchange-lib/exchange_api_handle.c | 37 | ||||
-rw-r--r-- | src/include/taler_exchange_service.h | 11 |
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. * |