From c2322aad3b1136077c1f17794803de83e78cf8a6 Mon Sep 17 00:00:00 2001 From: swrup Date: Mon, 13 Oct 2025 02:38:29 +0200 Subject: [PATCH] --- src/config.ml | 149 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 101 insertions(+), 48 deletions(-) diff --git a/src/config.ml b/src/config.ml index d25883ec..817c4202 100644 --- a/src/config.ml +++ b/src/config.ml @@ -29,7 +29,20 @@ type not_implemented type url = string type seconds = int -module Global = struct end +(* not relevant for mirage *) +module type Global = sig + (* +The “[PATHS]” section is special in that it contains paths that can be +referenced using “$” in other configuration values that specify +filenames. For Taler exchange, it commonly contains the following paths: + *) + + val taler_home : dir_path + val taler_data_home : dir_path + val taler_config_home : dir_path + val taler_cache_home : dir_path + val taler_runtime_dir : dir_path +end (* Sections with a name of the form “[currency-$NAME]” (where "$NAME" could @@ -292,53 +305,6 @@ end (* todo: KYC and AML options *) -(* -The functionality of the exchange can be extended by extensions. Those are -shared libraries which implement the extension-API of the exchange and are -located under ``$LIBDIR``, starting with prefix ``libtaler_extension_``. Each -extension can be enabled by adding a dedicated section -"[exchange-extension-]" and the following option: - *) -module type Extansions = sig - (* - If set to ``YES`` the extension ```` is enabled. Extension-specific - options might be set in the same section. *) - val enabled : [ (*`YES|*) `NO ] -end - -(* The following options must be in the section "[exchange-offline]". *) -module type Offline_signing = sig - (* - Location of the master private key on disk. Only used by tools that - can be run offline (as the master key is for offline signing). - Mandatory. *) - val master_priv_file : file_path - - (* TODO - - we need two different file - - there is three, not two, crypto helper modules - is it only two, because the eddsa one is not comptabilized as a "crypto helper" here? *) - (* - Where to store the public keys of both crypto helper modules. - Used to persist the keys after the first invocation of the tool, - so that if they ever change in the future, this is detected and - the tool can abort. - Mandatory. *) - val secm_tofu_file : file_path - - (* - Public key of the (RSA) crypto helper module. Optional. If not given, - we will rely on TOFU. Note that once TOFU has been established, - this option will also be ignored. *) - val secm_denom_pubkey : string option - - (* - Public key of the (EdDSA) crypto helper module. Optional. If not given, - we will rely on TOFU. Note that once TOFU has been established, - this option will also be ignored. *) - val secm_esign_pubkey : string option -end - (* The following options must be in the section "[taler-exchange-secmod-{rsa|cs|eddsa}]". *) module type Secmod = sig (* @@ -434,6 +400,93 @@ module type Account_secret = sig val token : string end +(* +The following options must be in sections starting with ``"[coin_]"`` and are +largely used by **taler-exchange-httpd** to determine the meta data for the +denomination keys. Some of the options are used by the +**taler-exchange-secmod-rsa** to determine which RSA keys to create (and of +what key length). Note that the section names must match, so this part of the +configuration MUST be shared between the RSA helper and the exchange. +Configuration values MUST NOT be changed in a running setup. Instead, if +parameters for a denomination type are to change, a fresh *section name* should +be introduced (and the existing section should be deleted). +*) +module type Coin = sig + val value : amount + val duration_withdraw : duration + val duration_spend : duration + val duration_legal : duration + val fee_withdraw : amount + val fee_deposit : amount + val fee_refresh : amount + val fee_refund : amount + + (* + What cryptosystem should be used? Must be set to either "CS" or "RSA". + The respective crypto-helper will then generate the keys for this + denomination. *) + val cipher : [ `CS | `RSA ] + + (*What is the RSA keysize modulos (in bits)? Only used if "CIPHER=RSA".*) + val rsa_keysize : int + + (* + For this option to be accepted the extension for age + restriction MUST be enabled. *) + val age_restricted : [ (*`YES|*) `NO ] +end + +(* +The functionality of the exchange can be extended by extensions. Those are +shared libraries which implement the extension-API of the exchange and are +located under ``$LIBDIR``, starting with prefix ``libtaler_extension_``. Each +extension can be enabled by adding a dedicated section +"[exchange-extension-]" and the following option: + *) +module type Extensions = sig + (* + If set to ``YES`` the extension ```` is enabled. Extension-specific + options might be set in the same section. *) + val enabled : [ (*`YES|*) `NO ] +end + +(* The following options must be in the section "[exchange-offline]". *) +module type Offline_signing = sig + (* + Location of the master private key on disk. Only used by tools that + can be run offline (as the master key is for offline signing). + Mandatory. *) + val master_priv_file : file_path + + (* TODO + - we need two different file + - there is three, not two, crypto helper modules + is it only two, because the eddsa one is not comptabilized as a "crypto helper" here? *) + (* + Where to store the public keys of both crypto helper modules. + Used to persist the keys after the first invocation of the tool, + so that if they ever change in the future, this is detected and + the tool can abort. + Mandatory. *) + val secm_tofu_file : file_path + + (* + Public key of the (RSA) crypto helper module. Optional. If not given, + we will rely on TOFU. Note that once TOFU has been established, + this option will also be ignored. *) + val secm_denom_pubkey : string option + + (* + Public key of the (EdDSA) crypto helper module. Optional. If not given, + we will rely on TOFU. Note that once TOFU has been established, + this option will also be ignored. *) + val secm_esign_pubkey : string option +end + +module type Sanctions_check = sig + (* not implemented *) +end + (* -- ********************************** -- *) let currency = `Eur let currency_to_string = function `Eur -> "EUR"