aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/exchangedb/exchange-0001.sql8
-rw-r--r--src/include/taler_crypto_lib.h40
-rw-r--r--src/include/taler_signatures.h32
-rw-r--r--src/util/offline_signatures.c18
-rw-r--r--src/util/util.c16
5 files changed, 113 insertions, 1 deletions
diff --git a/src/exchangedb/exchange-0001.sql b/src/exchangedb/exchange-0001.sql
index a3996d120..58a6b7288 100644
--- a/src/exchangedb/exchange-0001.sql
+++ b/src/exchangedb/exchange-0001.sql
@@ -858,6 +858,14 @@ CREATE TABLE IF NOT EXISTS global_fee
,history_fee_frac INT4 NOT NULL
,kyc_fee_val INT8 NOT NULL
,kyc_fee_frac INT4 NOT NULL
+ ,account_fee_val INT8 NOT NULL
+ ,account_fee_frac INT4 NOT NULL
+ ,purse_fee_val INT8 NOT NULL
+ ,purse_fee_frac INT4 NOT NULL
+ ,purse_timeout INT8 NOT NULL
+ ,kyc_timeout INT8 NOT NULL
+ ,history_expiration INT8 NOT NULL
+ ,purse_account_limit INT4 NOT NULL
,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
,PRIMARY KEY (start_date)
);
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 40f407b66..5f091e771 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -695,6 +695,18 @@ struct TALER_GlobalFeeSetNBOP
*/
struct TALER_AmountNBO kyc;
+ /**
+ * The fee the exchange charges for keeping
+ * an account or reserve open for a year.
+ */
+ struct TALER_AmountNBO account;
+
+ /**
+ * The fee the exchange charges if a purse
+ * is abandoned and this was not covered by
+ * the account limit.
+ */
+ struct TALER_AmountNBO purse;
};
@@ -783,6 +795,18 @@ struct TALER_GlobalFeeSet
*/
struct TALER_Amount kyc;
+ /**
+ * The fee the exchange charges for keeping
+ * an account or reserve open for a year.
+ */
+ struct TALER_Amount account;
+
+ /**
+ * The fee the exchange charges if a purse
+ * is abandoned and this was not covered by
+ * the account limit.
+ */
+ struct TALER_Amount purse;
};
@@ -3296,6 +3320,10 @@ TALER_exchange_offline_wire_fee_verify (
* @param start_time when do the fees start to apply
* @param end_time when do the fees start to apply
* @param fees the global fees
+ * @param purse_timeout how long do unmerged purses stay around
+ * @param kyc_timeout how long do we keep funds in a reserve without KYC?
+ * @param history_expiration how long do we keep the history of an account
+ * @param purse_account_limit how many concurrent purses are free per account holder
* @param master_priv private key to sign with
* @param[out] master_sig where to write the signature
*/
@@ -3304,6 +3332,10 @@ TALER_exchange_offline_global_fee_sign (
struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Timestamp end_time,
const struct TALER_GlobalFeeSet *fees,
+ struct GNUNET_TIME_Relative purse_timeout,
+ struct GNUNET_TIME_Relative kyc_timeout,
+ struct GNUNET_TIME_Relative history_expiration,
+ uint32_t purse_account_limit,
const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig);
@@ -3314,6 +3346,10 @@ TALER_exchange_offline_global_fee_sign (
* @param start_time when do the fees start to apply
* @param end_time when do the fees start to apply
* @param fees the global fees
+ * @param purse_timeout how long do unmerged purses stay around
+ * @param kyc_timeout how long do we keep funds in a reserve without KYC?
+ * @param history_expiration how long do we keep the history of an account
+ * @param purse_account_limit how many concurrent purses are free per account holder
* @param master_pub public key to verify against
* @param master_sig the signature the signature
* @return #GNUNET_OK if the signature is valid
@@ -3323,6 +3359,10 @@ TALER_exchange_offline_global_fee_verify (
struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Timestamp end_time,
const struct TALER_GlobalFeeSet *fees,
+ struct GNUNET_TIME_Relative purse_timeout,
+ struct GNUNET_TIME_Relative kyc_timeout,
+ struct GNUNET_TIME_Relative history_expiration,
+ uint32_t purse_account_limit,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig);
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index 77a234218..5c5aaeebf 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -1275,10 +1275,42 @@ struct TALER_MasterGlobalFeePS
struct GNUNET_TIME_TimestampNBO end_date;
/**
+ * How long does an exchange keep a purse around after a purse
+ * has expired (or been successfully merged)? A 'GET' request
+ * for a purse will succeed until the purse expiration time
+ * plus this value.
+ */
+ struct GNUNET_TIME_RelativeNBO purse_timeout;
+
+ /**
+ * How long does the exchange promise to keep funds
+ * an account for which the KYC has never happened
+ * after a purse was merged into an account? Basically,
+ * after this time funds in an account without KYC are
+ * forfeit.
+ */
+ struct GNUNET_TIME_RelativeNBO kyc_timeout;
+
+ /**
+ * How long will the exchange preserve the account history? After an
+ * account was deleted/closed, the exchange will retain the account history
+ * for legal reasons until this time.
+ */
+ struct GNUNET_TIME_RelativeNBO history_expiration;
+
+ /**
* Fee charged to the merchant per wire transfer.
*/
struct TALER_GlobalFeeSetNBOP fees;
+ /**
+ * Number of concurrent purses that any
+ * account holder is allowed to create without having
+ * to pay the @e purse_fee. Here given in NBO.
+ */
+ uint32_t purse_account_limit;
+
+
};
diff --git a/src/util/offline_signatures.c b/src/util/offline_signatures.c
index 2a358bbf1..1085ac151 100644
--- a/src/util/offline_signatures.c
+++ b/src/util/offline_signatures.c
@@ -471,6 +471,10 @@ TALER_exchange_offline_global_fee_sign (
struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Timestamp end_time,
const struct TALER_GlobalFeeSet *fees,
+ struct GNUNET_TIME_Relative purse_timeout,
+ struct GNUNET_TIME_Relative kyc_timeout,
+ struct GNUNET_TIME_Relative history_expiration,
+ uint32_t purse_account_limit,
const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig)
{
@@ -479,6 +483,10 @@ TALER_exchange_offline_global_fee_sign (
.purpose.size = htonl (sizeof (kv)),
.start_date = GNUNET_TIME_timestamp_hton (start_time),
.end_date = GNUNET_TIME_timestamp_hton (end_time),
+ .purse_timeout = GNUNET_TIME_relative_hton (purse_timeout),
+ .kyc_timeout = GNUNET_TIME_relative_hton (kyc_timeout),
+ .history_expiration = GNUNET_TIME_relative_hton (history_expiration),
+ .purse_account_limit = htonl (purse_account_limit)
};
TALER_global_fee_set_hton (&kv.fees,
@@ -494,6 +502,10 @@ TALER_exchange_offline_global_fee_verify (
struct GNUNET_TIME_Timestamp start_time,
struct GNUNET_TIME_Timestamp end_time,
const struct TALER_GlobalFeeSet *fees,
+ struct GNUNET_TIME_Relative purse_timeout,
+ struct GNUNET_TIME_Relative kyc_timeout,
+ struct GNUNET_TIME_Relative history_expiration,
+ uint32_t purse_account_limit,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig)
{
@@ -501,7 +513,11 @@ TALER_exchange_offline_global_fee_verify (
.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_GLOBAL_FEES),
.purpose.size = htonl (sizeof (wf)),
.start_date = GNUNET_TIME_timestamp_hton (start_time),
- .end_date = GNUNET_TIME_timestamp_hton (end_time)
+ .end_date = GNUNET_TIME_timestamp_hton (end_time),
+ .purse_timeout = GNUNET_TIME_relative_hton (purse_timeout),
+ .kyc_timeout = GNUNET_TIME_relative_hton (kyc_timeout),
+ .history_expiration = GNUNET_TIME_relative_hton (history_expiration),
+ .purse_account_limit = htonl (purse_account_limit)
};
TALER_global_fee_set_hton (&wf.fees,
diff --git a/src/util/util.c b/src/util/util.c
index 33b0a77cc..2d10fd69d 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -84,6 +84,10 @@ TALER_global_fee_set_hton (struct TALER_GlobalFeeSetNBOP *nbo,
&fees->history);
TALER_amount_hton (&nbo->kyc,
&fees->kyc);
+ TALER_amount_hton (&nbo->account,
+ &fees->account);
+ TALER_amount_hton (&nbo->purse,
+ &fees->purse);
}
@@ -95,6 +99,10 @@ TALER_global_fee_set_ntoh (struct TALER_GlobalFeeSet *fees,
&nbo->history);
TALER_amount_ntoh (&fees->kyc,
&nbo->kyc);
+ TALER_amount_ntoh (&fees->account,
+ &nbo->account);
+ TALER_amount_ntoh (&fees->purse,
+ &nbo->purse);
}
@@ -138,6 +146,14 @@ TALER_global_fee_set_cmp (const struct TALER_GlobalFeeSet *f1,
&f2->kyc);
if (0 != ret)
return ret;
+ ret = TALER_amount_cmp (&f1->account,
+ &f2->account);
+ if (0 != ret)
+ return ret;
+ ret = TALER_amount_cmp (&f1->purse,
+ &f2->purse);
+ if (0 != ret)
+ return ret;
return 0;
}