~~ config

This commit is contained in:
swrup 2025-10-13 02:54:28 +02:00
parent f51d8ee374
commit 8676631f99

View file

@ -30,13 +30,12 @@ type url = string
type seconds = int
(* 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:
*)
module type Global = sig
val taler_home : dir_path
val taler_data_home : dir_path
val taler_config_home : dir_path
@ -44,51 +43,18 @@ filenames. For Taler exchange, it commonly contains the following paths:
val taler_runtime_dir : dir_path
end
(*
Sections with a name of the form [currency-$NAME] (where "$NAME" could
be any unique string) are used to specify details about how currencies
should be handled (and in particularly rendered) by the user interface.
A detailed motivation for this section can be found in DD51.
Different components can have different rules for the same currency. For
example, a bank or merchant may decide to render Euros or Dollars with
always exactly two fractional decimals, while an Exchange for the same
currency may support additional decimals. The required options in each
currency specification section are: *)
(* sections "[currency-$NAME]"
see DD51 *)
module type Currency = sig
(*
Set to YES or NO. If set to NO, the currency specification
section is ignored. Can be used to disable currencies or
select alternative sections for the same CODE with different
choices. *)
val enabled : [ `YES | `NO ]
(*
Code name for the currency. Can be at most 11 characters,
only the letters A-Z are allowed. Primary way to identify
the currency in the protocol. *)
(* at most 11 characters, only A-Z *)
val code : string
(*
Long human-readable name for the currency. No restrictions,
but should match the official name in English. *)
(* official name in English *)
val name : string
(*
Number of fractional digits that users are allowed to enter
manually in the user interface. *)
val fractional_input_digits : int
(*
Number of fractional digits that will be rendered normally
(in terms of size and placement). Digits shown beyond this
number will typically be rendered smaller and raised (if
possible). *)
val fractional_normal_digits : int
(*
Number of fractional digits to pad rendered amounts with
even if these digits are all zero. For example, use 2 to
render 1 USD as $1.00. *)
val fractional_trailing_zero_digits : int
(*
@ -104,8 +70,7 @@ module type Currency = sig
val alt_unit_names : (int * string) list
end
(* The following options are from the “[exchange]” section and used by most
exchange tools. *)
(* section "[exchange]" *)
module type Exchange = sig
(*
Name of the currency, e.g. EUR for Euro. *)
@ -127,15 +92,15 @@ module type Exchange = sig
(*
Should the HTTP server listen on a UNIX domain socket (set option to "unix"), or on a TCP socket (set option to "tcp"), or be activated via systemd (set option to "systemd"). *)
val serve : not_relevant
val serve : [ `Unix | `Tcp | `Systemd ]
(*
Path to listen on if we "SERVE" is set to "unix". *)
val unixpath : not_relevant
val unixpath : file_path
(*
Access permission mask to use for the "UNIXPATH". *)
val unixpath_mode : not_relevant
val unixpath_mode : int
(*
Port on which the HTTP server listens, e.g. 8080. *)
@ -303,9 +268,7 @@ module type Exchange = sig
val enable_kyc : [ `YES | `NO ]
end
(* todo: KYC and AML options *)
(* The following options must be in the section "[taler-exchange-secmod-{rsa|cs|eddsa}]". *)
(* section "[taler-exchange-secmod-{rsa|cs|eddsa}]". *)
module type Secmod = sig
(*
How long do we generate denomination and signing keys ahead of time?
@ -341,9 +304,9 @@ module type Secmod_rsa = Secmod
module type Secmod_cs = Secmod
module type Secmod_eddsa = Secmod
(* The following options must be in the section "[exchangedb]". *)
(* section "[exchangedb]". *)
module type Database = sig
(* TODO not sure about what unit of time/duration is used here *)
(* TODO not sure about what unit of time/duration is used in here *)
(*
After which time period should reserves be closed if they are idle? *)
@ -379,27 +342,6 @@ The following options must be in section “[exchangedb-postgres]” if the
end
end
(*
An exchange (or merchant) can have multiple bank accounts. The following
options are for sections named [exchange-account-SOMETHING]. The ``SOMETHING`` is
arbitrary and should be chosen to uniquely identify the bank account for
the operator. These options are used by the **taler-exchange-aggregator**, **taler-exchange-closer**, **taler-exchange-transfer** and **taler-exchange-wirewatch** tools. *)
module type Account = sig
val payto_uri : payto_uri
val enable_debit : [ `YES | `NO ]
val enable_credit : [ `YES | `NO ]
end
(*
Additionally, for each enabled account there MUST be another matching section named [exchange-accountcredentials-SOMETHING]. This section SHOULD be in a ``secret/`` configuration file that is only readable for the **taler-exchange-wirewatch** and **taler-exchange-transfer** processes. It contains the credentials to access the bank account: *)
module type Account_secret = sig
val wire_gateway_url : url
val wire_gateway_auth_method : string
val username : string
val password : string
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
@ -436,6 +378,27 @@ module type Coin = sig
val age_restricted : [ (*`YES|*) `NO ]
end
(*
An exchange (or merchant) can have multiple bank accounts. The following
options are for sections named [exchange-account-SOMETHING]. The ``SOMETHING`` is
arbitrary and should be chosen to uniquely identify the bank account for
the operator. These options are used by the **taler-exchange-aggregator**, **taler-exchange-closer**, **taler-exchange-transfer** and **taler-exchange-wirewatch** tools. *)
module type Account = sig
val payto_uri : payto_uri
val enable_debit : [ `YES | `NO ]
val enable_credit : [ `YES | `NO ]
end
(*
Additionally, for each enabled account there MUST be another matching section named [exchange-accountcredentials-SOMETHING]. This section SHOULD be in a ``secret/`` configuration file that is only readable for the **taler-exchange-wirewatch** and **taler-exchange-transfer** processes. It contains the credentials to access the bank account: *)
module type Account_secret = sig
val wire_gateway_url : url
val wire_gateway_auth_method : string
val username : string
val password : string
val token : string
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
@ -482,115 +445,3 @@ module type Offline_signing = sig
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"
(* Values that represent an amount are in the usual amount syntax: CURRENCY:VALUE.FRACTION,
e.g. EUR:1.50. The FRACTION portion may extend up to 8 places. *)
type value = {
currency: [ `Eur ];
value: int;
fraction: int;
}
let currency_round_unit = { currency= `Eur; value= 0; fraction= 1 }
let value_to_string v =
Fmt.str "%s:%d.%d" (currency_to_string v.currency) v.value v.fraction
(* https://docs.taler.net/manpages/taler-exchange.conf.5.html#exchange-coin-options *)
module Coin = struct
(* How much is the coin worth, the format is CURRENCY:VALUE.FRACTION. For
example, a 10 cent piece is EUR:0.10. *)
let value = { currency= `Eur; value= 0; fraction= 1 }
(*How long can a coin of this type be withdrawn? This limits the losses
incurred by the exchange when a denomination key is compromised.*)
let duration_withdraw = Duration.of_year 1
(*How long is a coin of the given type valid? Smaller values result in lower
storage costs for the exchange.*)
let duration_spend = Duration.of_year 1
(*How long is the coin of the given type legal?*)
let duration_legal = Duration.of_year 1
(*What does it cost to withdraw this coin? Specified using the same format as
value.*)
let fee_withdraw = { currency= `Eur; value= 0; fraction= 0 }
(*What does it cost to deposit this coin? Specified using the same format as
value.*)
let fee_deposit = { currency= `Eur; value= 0; fraction= 0 }
(*What does it cost to refresh this coin? Specified using the same format as
value.*)
let fee_refresh = { currency= `Eur; value= 0; fraction= 0 }
(*What does it cost to refund this coin? Specified using the same format as
value.*)
let fee_refund = { currency= `Eur; value= 0; fraction= 0 }
(*Which cipher to use for this coin? Must be either RSA or CS.*)
let cipher : [ `RSA | `CS ] = `RSA
(*How many bits should the RSA modulus (product of the two primes) have for
this type of coin.*)
let rsa_keysize = -1
(*Set to YES to make this a denomination with support*)
let age_restricted : [ `YES | `NO ] = `NO
end
(* Crockford Base32-encoded master public key, public version of the exchanges long-time offline signing key. *)
let master_public_key = "uhuh"
(* module type for CS/EDDSA/RSA config *)
module Secmod = struct
(* Note that the taler-exchange-secmod-rsa also evaluates the [coin_*] configuration sections described below. *)
(*How long do we generate denomination and signing keys ahead of time?*)
let lookahead_sign = Duration.of_year 1
(*How much should validity periods for coins overlap? Should be long enough to avoid problems with wallets picking one key and then due to network latency another key being valid. The DURATION_WITHDRAW period must be longer than this value.*)
let overlap_duration = Duration.of_year 1
(*
Where should the security module store its long-term private key?
SM_PRIV_KEY
Where should the security module store the private keys it manages?
KEY_DIR
On which path should the security module listen for signing requests?
UNIXPATH
*)
end
module Database = struct
(*After which time period should reserves be closed if they are idle?*)
let idle_reserve_expiration_time = -1
(*After what time do we forget about (drained) reserves during garbage collection?*)
let legal_reserve_expiration_time = -1
(*Delay between a deposit being eligible for aggregation and the aggregator actually triggering.*)
let aggregator_shift = -1
(*Number of concurrent purses that a reserve may have active if it is paid to be opened for a year.*)
let default_purse_limit = -1
(*Maximum time an AML program is allowed to run. (Optional for taler-auditor.)*)
let max_aml_program_runtime = -1
module Postgres = struct
(*How to access the database, e.g. “postgres:///taler-exchange” to use the “taler-exchange” database. Testcases use “talercheck”.*)
let config = "uhuh"
end
end