diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-20 15:17:41 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-20 15:17:41 +0100 |
commit | 93a98f8091329d44fe63c092da5f4eaf3bcb983d (patch) | |
tree | 8bb70e9d3bc4513a484bc136d3a53d9d5a8b8c56 /src/mint/taler-mint-httpd_responses.c | |
parent | ed51946442e5e22a7dea68f14ff2bf563503c755 (diff) | |
download | exchange-93a98f8091329d44fe63c092da5f4eaf3bcb983d.tar.xz |
starting to refactor refresh code, moving response generation logic to response generation file
Diffstat (limited to 'src/mint/taler-mint-httpd_responses.c')
-rw-r--r-- | src/mint/taler-mint-httpd_responses.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/mint/taler-mint-httpd_responses.c b/src/mint/taler-mint-httpd_responses.c index 78e239b7c..7aedec1d3 100644 --- a/src/mint/taler-mint-httpd_responses.c +++ b/src/mint/taler-mint-httpd_responses.c @@ -290,5 +290,39 @@ TALER_MINT_reply_withdraw_sign_success (struct MHD_Connection *connection, } +/** + * Send a response to a "/refresh/commit" request. + * + * FIXME: maybe not the ideal argument type for @a refresh_session here. + * + * @param connection the connection to send the response to + * @param refresh_session the refresh session + * @return a MHD status code + */ +int +TALER_MINT_reply_refresh_commit_success (struct MHD_Connection *connection, + struct RefreshSession *refresh_session) +{ + struct RefreshCommitResponseSignatureBody body; + struct GNUNET_CRYPTO_EddsaSignature sig; + json_t *sig_json; + + body.purpose.size = htonl (sizeof (struct RefreshCommitResponseSignatureBody)); + body.purpose.purpose = htonl (TALER_SIGNATURE_REFRESH_COMMIT_RESPONSE); + body.noreveal_index = htons (refresh_session->noreveal_index); + TALER_MINT_keys_sign (&body.purpose, + &sig); + sig_json = TALER_JSON_from_sig (&body.purpose, &sig); + GNUNET_assert (NULL != sig_json); + return TALER_MINT_reply_json_pack (connection, + MHD_HTTP_OK, + "{s:i, s:o}", + "noreveal_index", (int) refresh_session->noreveal_index, + "signature", sig_json); +} + + + + /* end of taler-mint-httpd_responses.c */ |