diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2018-12-21 14:04:43 +0100 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2018-12-21 14:04:43 +0100 |
commit | df6eda3994236a29f961d473308c44d5fb85e187 (patch) | |
tree | 804b50f7426325fe14ec02280145dda8f3d1e8ba /src/exchange-lib/testing_api_trait_json.c | |
parent | 7d8d8b2e8a2a1c8737b805c63c83ae9892c7bab9 (diff) | |
download | exchange-df6eda3994236a29f961d473308c44d5fb85e187.tar.gz exchange-df6eda3994236a29f961d473308c44d5fb85e187.tar.bz2 exchange-df6eda3994236a29f961d473308c44d5fb85e187.zip |
Provide test API for keys serialization.
Diffstat (limited to 'src/exchange-lib/testing_api_trait_json.c')
-rw-r--r-- | src/exchange-lib/testing_api_trait_json.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/exchange-lib/testing_api_trait_json.c b/src/exchange-lib/testing_api_trait_json.c index d27307918..5f6647fbb 100644 --- a/src/exchange-lib/testing_api_trait_json.c +++ b/src/exchange-lib/testing_api_trait_json.c @@ -30,6 +30,49 @@ #include "taler_testing_lib.h" #define TALER_TESTING_TRAIT_WIRE_DETAILS "wire-details" +#define TALER_TESTING_TRAIT_EXCHANGE_KEYS "exchange-keys" + +/** + * Obtain serialized exchange keys from @a cmd. + * + * @param cmd command to extract the keys from. + * @param index index number associate with the keys on offer. + * @param keys[out] where to write the serialized keys. + * @return #GNUNET_OK on success. + */ +int +TALER_TESTING_get_trait_exchange_keys + (const struct TALER_TESTING_Command *cmd, + unsigned int index, + const json_t **keys) +{ + return cmd->traits (cmd->cls, + (const void **) keys, + TALER_TESTING_TRAIT_EXCHANGE_KEYS, + index); +} + + +/** + * Offer serialized keys in a trait. + * + * @param index index number associate with the serial keys + * on offer. + * @param keys serialized keys to offer. + * @return the trait. + */ +struct TALER_TESTING_Trait +TALER_TESTING_make_trait_exchange_keys + (unsigned int index, + const json_t *keys) +{ + struct TALER_TESTING_Trait ret = { + .index = index, + .trait_name = TALER_TESTING_TRAIT_EXCHANGE_KEYS, + .ptr = (const json_t *) keys + }; + return ret; +} /** * Obtain wire details from @a cmd. |