diff options
-rw-r--r-- | src/exchange/exchange.conf | 8 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_keys.c | 18 | ||||
-rw-r--r-- | src/include/taler_exchange_service.h | 8 | ||||
-rw-r--r-- | src/lib/exchange_api_handle.c | 7 |
4 files changed, 41 insertions, 0 deletions
diff --git a/src/exchange/exchange.conf b/src/exchange/exchange.conf index 30e5b0b90..d662cdd0e 100644 --- a/src/exchange/exchange.conf +++ b/src/exchange/exchange.conf @@ -47,6 +47,14 @@ BASE_URL = http://localhost:8081/ # How long should the aggregator sleep if it has nothing to do? AGGREGATOR_IDLE_SLEEP_INTERVAL = 60 s +# What type of asset is the exchange managing? Used to adjust +# the user-interface of the wallet. +# Possibilities include: "fiat", "regional" and "crypto". +# In the future (and already permitted but not yet supported by wallets) +# we also expect to have "stock" and "future" (and more). +# Default is "fiat". +ASSET_TYPE = "fiat" + # FIXME: document! ROUTER_IDLE_SLEEP_INTERVAL = 60 s diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c index b37c68d95..b11832e72 100644 --- a/src/exchange/taler-exchange-httpd_keys.c +++ b/src/exchange/taler-exchange-httpd_keys.c @@ -457,6 +457,11 @@ static struct GNUNET_SCHEDULER_Task *keys_tt; static struct GNUNET_TIME_Relative signkey_legal_duration; /** + * What type of asset are we dealing with here? + */ +static char *asset_type; + +/** * RSA security module public key, all zero if not known. */ static struct TALER_SecurityModulePublicKeyP denom_rsa_sm_pub; @@ -1279,6 +1284,17 @@ TEH_keys_init () "SIGNKEY_LEGAL_DURATION"); return GNUNET_SYSERR; } + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_string (TEH_cfg, + "exchange", + "ASSET_TYPE", + &asset_type)) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, + "exchange", + "ASSET_TYPE"); + asset_type = GNUNET_strdup ("fiat"); + } keys_eh = TEH_plugin->event_listen (TEH_plugin->cls, GNUNET_TIME_UNIT_FOREVER_REL, &es, @@ -1856,6 +1872,8 @@ create_krd (struct TEH_KeyStateHandle *ksh, TEH_base_url), GNUNET_JSON_pack_string ("currency", TEH_currency), + GNUNET_JSON_pack_string ("asset_type", + asset_type), GNUNET_JSON_pack_data_auto ("master_public_key", &TEH_master_public_key), GNUNET_JSON_pack_time_rel ("reserve_closing_delay", diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index fcb75a1b9..7ad1c2a2d 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -358,6 +358,14 @@ struct TALER_EXCHANGE_Keys */ unsigned int denom_keys_size; + /** + * Asset type used by the exchange. Typical values + * are "fiat" or "crypto" or "regional" or "stock". + * Wallets should adjust their UI/UX based on this + * value. + */ + char *asset_type; + }; diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c index 14ba73174..3a23508c2 100644 --- a/src/lib/exchange_api_handle.c +++ b/src/lib/exchange_api_handle.c @@ -732,6 +732,7 @@ decode_keys_json (const json_t *resp_obj, struct GNUNET_HashCode hash_xor = {0}; struct TALER_ExchangePublicKeyP pub; const char *currency; + const char *asset_type; json_t *wblwk = NULL; struct GNUNET_JSON_Specification mspec[] = { GNUNET_JSON_spec_fixed_auto ("denominations_sig", @@ -746,6 +747,8 @@ decode_keys_json (const json_t *resp_obj, &key_data->reserve_closing_delay), GNUNET_JSON_spec_string ("currency", ¤cy), + GNUNET_JSON_spec_string ("asset_type", + &asset_type), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_json ("wallet_balance_limit_without_kyc", &wblwk), @@ -815,6 +818,7 @@ decode_keys_json (const json_t *resp_obj, (check_sig) ? mspec : &mspec[2], NULL, NULL)); key_data->currency = GNUNET_strdup (currency); + key_data->asset_type = GNUNET_strdup (asset_type); /* parse the global fees */ { @@ -1233,6 +1237,7 @@ free_key_data (struct TALER_EXCHANGE_Keys *key_data) GNUNET_free (key_data->wallet_balance_limit_without_kyc); GNUNET_free (key_data->version); GNUNET_free (key_data->currency); + GNUNET_free (key_data->asset_type); GNUNET_free (key_data->global_fees); } @@ -1917,6 +1922,8 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange) kd->version), GNUNET_JSON_pack_string ("currency", kd->currency), + GNUNET_JSON_pack_string ("asset_type", + kd->asset_type), GNUNET_JSON_pack_data_auto ("master_public_key", &kd->master_pub), GNUNET_JSON_pack_time_rel ("reserve_closing_delay", |