summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_kyc-proof.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-01-27 15:10:25 +0100
committerChristian Grothoff <christian@grothoff.org>2023-01-27 15:10:25 +0100
commitd79c23aaabb5dc1c9073555d574bea01b75668cd (patch)
tree70adc8db776468bf8295b9c0092e687fe5d1be9c /src/exchange/taler-exchange-httpd_kyc-proof.c
parent6da3cbedd468638a6161fb46063dcec83c069c80 (diff)
downloadexchange-d79c23aaabb5dc1c9073555d574bea01b75668cd.tar.gz
exchange-d79c23aaabb5dc1c9073555d574bea01b75668cd.tar.bz2
exchange-d79c23aaabb5dc1c9073555d574bea01b75668cd.zip
add logic to store attributes
Diffstat (limited to 'src/exchange/taler-exchange-httpd_kyc-proof.c')
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-proof.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/exchange/taler-exchange-httpd_kyc-proof.c b/src/exchange/taler-exchange-httpd_kyc-proof.c
index 1904c4acb..11d179667 100644
--- a/src/exchange/taler-exchange-httpd_kyc-proof.c
+++ b/src/exchange/taler-exchange-httpd_kyc-proof.c
@@ -195,8 +195,43 @@ proof_cb (
if (TALER_KYCLOGIC_STATUS_SUCCESS == status)
{
enum GNUNET_DB_QueryStatus qs;
-
- // FIXME: also store 'attributes' in DB!
+ size_t eas;
+ void *ea;
+ const char *birthdate;
+ struct GNUNET_ShortHashCode kyc_prox;
+
+ // FIXME: compute kyc_prox properly!
+ memset (&kyc_prox,
+ 0,
+ sizeof (kyc_prox));
+ birthdate = json_string_value (json_object_get (attributes,
+ "birthdate"));
+ TALER_CRYPTO_kyc_attributes_encrypt (&TEH_attribute_key,
+ attributes,
+ &ea,
+ &eas);
+ qs = TEH_plugin->insert_kyc_attributes (
+ TEH_plugin->cls,
+ &kpc->h_payto,
+ &kyc_prox,
+ kpc->provider_section,
+ birthdate,
+ GNUNET_TIME_timestamp_get (),
+ GNUNET_TIME_absolute_to_timestamp (expiration),
+ eas,
+ ea);
+ GNUNET_free (ea);
+ if (GNUNET_DB_STATUS_HARD_ERROR == qs)
+ {
+ GNUNET_break (0);
+ if (NULL != response)
+ MHD_destroy_response (response);
+ kpc->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
+ kpc->response = TALER_MHD_make_error (TALER_EC_GENERIC_DB_STORE_FAILED,
+ "insert_kyc_attributes");
+ GNUNET_async_scope_restore (&old_scope);
+ return;
+ }
qs = TEH_plugin->update_kyc_process_by_row (TEH_plugin->cls,
kpc->process_row,
kpc->provider_section,