diff options
Diffstat (limited to 'src/testing/testing_api_cmd_reserve_attest.c')
-rw-r--r-- | src/testing/testing_api_cmd_reserve_attest.c | 56 |
1 files changed, 45 insertions, 11 deletions
diff --git a/src/testing/testing_api_cmd_reserve_attest.c b/src/testing/testing_api_cmd_reserve_attest.c index 5ed25c13c..cf4b3a0c2 100644 --- a/src/testing/testing_api_cmd_reserve_attest.c +++ b/src/testing/testing_api_cmd_reserve_attest.c @@ -71,6 +71,28 @@ struct AttestState * Interpreter state. */ struct TALER_TESTING_Interpreter *is; + + /* TODO: expose fields below as traits... */ + + /** + * Attested attributes returned by the exchange. + */ + json_t *attributes; + + /** + * Expiration time of the attested attributes. + */ + struct GNUNET_TIME_Timestamp expiration_time; + + /** + * Signature by the exchange affirming the attributes. + */ + struct TALER_ExchangeSignatureP exchange_sig; + + /** + * Online signing key used by the exchange. + */ + struct TALER_ExchangePublicKeyP exchange_pub; }; @@ -108,7 +130,10 @@ reserve_attest_cb ( TALER_TESTING_interpreter_next (is); return; } - /* FIXME: persist attestation... */ + ss->attributes = json_incref ((json_t*) rs->details.ok.attributes); + ss->expiration_time = rs->details.ok.expiration_time; + ss->exchange_pub = rs->details.ok.exchange_pub; + ss->exchange_sig = rs->details.ok.exchange_sig; TALER_TESTING_interpreter_next (is); } @@ -127,8 +152,15 @@ attest_run (void *cls, { struct AttestState *ss = cls; const struct TALER_TESTING_Command *create_reserve; + const char *exchange_url; ss->is = is; + exchange_url = TALER_TESTING_get_exchange_url (is); + if (NULL == exchange_url) + { + GNUNET_break (0); + return; + } create_reserve = TALER_TESTING_interpreter_lookup_command (is, ss->reserve_reference); @@ -150,12 +182,15 @@ attest_run (void *cls, } GNUNET_CRYPTO_eddsa_key_get_public (&ss->reserve_priv->eddsa_priv, &ss->reserve_pub.eddsa_pub); - ss->rsh = TALER_EXCHANGE_reserves_attest (is->exchange, - ss->reserve_priv, - ss->attrs_len, - ss->attrs, - &reserve_attest_cb, - ss); + ss->rsh = TALER_EXCHANGE_reserves_attest ( + TALER_TESTING_interpreter_get_context (is), + exchange_url, + TALER_TESTING_get_keys (is), + ss->reserve_priv, + ss->attrs_len, + ss->attrs, + &reserve_attest_cb, + ss); } @@ -174,13 +209,12 @@ attest_cleanup (void *cls, if (NULL != ss->rsh) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Command %u (%s) did not complete\n", - ss->is->ip, - cmd->label); + TALER_TESTING_command_incomplete (ss->is, + cmd->label); TALER_EXCHANGE_reserves_attest_cancel (ss->rsh); ss->rsh = NULL; } + json_decref (ss->attributes); GNUNET_free (ss->attrs); GNUNET_free (ss); } |