add config option

This commit is contained in:
swrup 2025-10-13 00:43:46 +02:00
parent aaae59ced0
commit 861882e5c5

View file

@ -7,7 +7,287 @@
- default config: use relevant duration, all set to 1 year for now
*)
(* ---- *)
module Global = struct 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: *)
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. *)
val code : string
(*
Long human-readable name for the currency. No restrictions,
but should match the 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
(*
JSON map determining how to encode very large or very tiny
amounts in this currency. Maps a base10 logarithm to the
respective currency symbol. Must include at least an
entry for 0 (currency unit). For example, use
{"0":""} for Euros or {"0":"$"} for Dollars. You could
additionally use {"0":"","3":"k€"} to render 3000 EUR
as 3k. For BTC a typical map would be
{"0":"BTC","-3":"mBTC"}, informing the UI to render small
amounts in milli-Bitcoin (mBTC). *)
val alt_unit_names : (int * string) list
end
(* TODO unikernel *)
type directory
(* TODO *)
(* Values that represent a time duration are represented as a series of one or more NUMBER UNIT pairs, e.g. 60 s, 4 weeks 1 day, 5 years 2 minutes. *)
type duration
(* TODO
make it Amount.t *)
type amount = string
(* TODO
still need to parse them and tell that its not supported
some maybe are relevant
idk *)
type not_relevant
type url = string
type seconds = int
(* The following options are from the “[exchange]” section and used by most
exchange tools. *)
module type Exchange = sig
(*
Name of the currency, e.g. EUR for Euro. *)
val currency : string
(*
Smallest amount in this currency that can be transferred using the
underlying RTGS. For example: "EUR:0.01" or "JPY:1". *)
val currency_round_unit : amount
(*
Plugin to use for the database, e.g. postgres. *)
val db : string
(*
Attribute encryption key for storing attributes encrypted
in the database. Should be a high-entropy nonce. *)
val attribute_encryption_key : string
(*
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
(*
Path to listen on if we "SERVE" is set to "unix". *)
val unixpath : not_relevant
(*
Access permission mask to use for the "UNIXPATH". *)
val unixpath_mode : not_relevant
(*
Port on which the HTTP server listens, e.g. 8080. *)
val port : int
(*
Hostname to which the exchange HTTP server should be bound to, e.g. "localhost". *)
val bind_to : string
(*
Crockford Base32-encoded master public key, public version of the
exchange's long-time offline signing key. This configuration option
is also used by the **auditor** to determine the public key of the
exchange which it is auditing. *)
val master_public_key : string
(*
Small amount that can be transferred to the exchange for the
KYC authentication wire transfers. Should be given as a hint
for merchants what amount they need to transfer to begin the
KYC transfer. Note that the amount is not enforced by the
exchange *and* that this option is optional. However, if it is
not given, merchants will have to guess what amount to transfer,
so it really should be configured. *)
val tiny_amount : amount option
(*
Web URL where users can discover shops that accept digital cash
offered by this exchange. Optional, but highly recommended. *)
val shopping_url : url option
(*
URL where wallets can find an open banking gateway to
initiate wire transfers when withdrawing digital cash
from this exchange. Optional (as obviously not every
exchange will have an open banking gateway attached). *)
val open_banking_gateway_url : url option
(*
Determines the variant of the AML SPA that should be shown. This
will determine the set of forms shown to AML staff, statistics to
be displayed on the main page, and influence the default set of
properties/events the AML forms show when AML staff makes decisions.
Possible values for now include "gls", "tops" and "magnet".
Optional. The AML SPA will only show certain default forms and
generic decisions if this option is not set. *)
val aml_spa_dialect : string option
(*
Determines the legal language (and possibly other UI/UX aspects)
wallets should use when providing the user interface for this bank.
Allows banks to communicate the desired compliance language they
want to see used to the wallet. Wallets SHOULD follow the guidance
provided by the bank, but some wallets MAY not understand all compliance
languages. Optional, if not set wallets will use their default UI/UX. *)
val bank_compliance_language : string option
(*
Absolute amount to add as an offset in the STEFAN fee approximation
curve (see DD47). Defaults to CURRENCY:0 if not specified. *)
val stefan_abs : amount
(*
Amount to multiply by the base-2 logarithm of the total amount
divided by the amount of the smallest denomination
in the STEFAN fee approximation curve (see DD47).
Defaults to CURRENCY:0 if not specified. *)
val stefan_log : amount
(*
Linear floating point factor to be multiplied by the total amount
to use in the STEFAN fee approximation curve (see DD47).
Defaults to 0.0 if not specified. *)
val stefan_lin : float
(*
The base URL under which the exchange can be reached.
Added to wire transfers to enable tracking by merchants.
Used by the KYC logic when interacting with OAuth 2.0. *)
val base_url : url
(*
Where to redirect visitors that access the top-level
"/" endpoint of the exchange. Should point users to
information about the exchange operator.
Optional setting, defaults to "/terms". *)
val toplevel_redirect_url : string option
(*
For how long should the taler-exchange-aggregator sleep when it is idle
before trying to look for more work? Default is 60 seconds. *)
val aggregator_idle_sleep_interval : seconds
(*
For how long should the taler-exchange-closer sleep when it is idle
before trying to look for more work? Default is 60 seconds. *)
val closer_idle_sleep_interval : seconds
(*
For how long should the taler-exchange-transfer sleep when it is idle
before trying to look for more work? Default is 60 seconds. *)
val transfer_idle_sleep_interval : seconds
(*
For how long should the taler-exchange-wirewatch sleep when it is idle
before trying to look for more work? Default is 60 seconds. *)
val wirewatch_idle_sleep_interval : seconds
(*
Which share of the range from [0,..2147483648] should be processed by one of the shards of the aggregator. Useful only for Taler exchanges with ultra high-performance needs. When changing this value, you must stop all aggregators and run "taler-exchange-dbinit -s" before resuming. Default is 2147483648 (no sharding). *)
val aggregator_shard_size : int option
(*
For how long are signatures with signing keys legally valid? *)
val signkey_legal_duration : duration
(*
For how long should clients cache ``/keys`` responses at most? *)
val max_keys_caching : duration
(*
How many requests should the HTTP server process at most before committing suicide? *)
val max_requests : int
(*
Directory where the terms of service of the exchange operator can be fund.
The directory must contain sub-directories for every supported language,
using the two-character language code in lower case, e.g. "en/" or "fr/".
Each subdirectory must then contain files with the terms of service in
various formats. The basename of the file of the current policy must be
specified under ``TERMS_ETAG``. The extension defines the mime type.
Supported extensions include "html", "htm", "txt", "pdf", "jpg", "jpeg",
"png" and "gif". For example, using a ``TERMS_ETAG`` of "0", the structure
could be the following:
- $TERMS_DIR/en/0.pdf
- $TERMS_DIR/en/0.html
- $TERMS_DIR/en/0.txt
- $TERMS_DIR/fr/0.pdf
- $TERMS_DIR/fr/0.html
- $TERMS_DIR/de/0.txt *)
val terms_dir : directory
(*
Basename of the file(s) in the ``TERMS_DIR`` with the current terms of service.
The value is also used for the "Etag" in the HTTP request to control
caching. Whenever the terms of service change, the ``TERMS_ETAG`` MUST also
change, and old values MUST NOT be repeated. For example, the date or
version number of the terms of service SHOULD be used for the Etag. If
there are minor (e.g. spelling) fixes to the terms of service, the
``TERMS_ETAG`` probably SHOULD NOT be changed. However, whenever users must
approve the new terms, the ``TERMS_ETAG`` MUST change. *)
val terms_etag : string
(*
Works the same as ``TERMS_DIR``, just for the privacy policy. *)
val privacy_dir : directory
(*
Works the same as ``TERMS_ETAG``, just for the privacy policy. *)
val privacy_etag : string
(*
Must be set to ``YES`` to enable AML/KYC rule enforcement. Note that the administrative endpoints will always work, even if the flag is set to ``NO``. *)
val enable_kyc : [ `YES | `NO ]
end
(* -- ********************************** -- *)
let currency = `Eur
let currency_to_string = function `Eur -> "EUR"