aboutsummaryrefslogtreecommitdiff
path: root/src/mint/mint.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mint/mint.h')
-rw-r--r--src/mint/mint.h189
1 files changed, 97 insertions, 92 deletions
diff --git a/src/mint/mint.h b/src/mint/mint.h
index 05e966e1c..0a0e00d04 100644
--- a/src/mint/mint.h
+++ b/src/mint/mint.h
@@ -35,6 +35,11 @@
35#define DIR_SIGNKEYS "signkeys" 35#define DIR_SIGNKEYS "signkeys"
36#define DIR_DENOMKEYS "denomkeys" 36#define DIR_DENOMKEYS "denomkeys"
37 37
38/**
39 * For now, we just do EUR. Should become configurable
40 * in the future!
41 */
42#define MINT_CURRENCY "EUR"
38 43
39/** 44/**
40 * On disk format used for a mint signing key. 45 * On disk format used for a mint signing key.
@@ -63,7 +68,9 @@ struct TALER_MINT_DenomKeyIssuePriv
63 68
64 69
65/** 70/**
66 * Public information about a coin. 71 * Public information about a coin (including the public key
72 * of the coin, the denomination key and the signature with
73 * the denomination key).
67 */ 74 */
68struct TALER_CoinPublicInfo 75struct TALER_CoinPublicInfo
69{ 76{
@@ -119,6 +126,92 @@ struct CollectableBlindcoin
119 126
120 127
121/** 128/**
129 * Specification for a /deposit operation.
130 */
131struct Deposit
132{
133 /**
134 * Information about the coin that is being deposited.
135 */
136 struct TALER_CoinPublicInfo coin;
137
138 /**
139 * ECDSA signature affirming that the customer intends
140 * this coin to be deposited at the merchant identified
141 * by @e h_wire in relation to the contract identified
142 * by @e h_contract.
143 */
144 struct GNUNET_CRYPTO_EcdsaSignature csig;
145
146 /**
147 * Public key of the merchant. Enables later identification
148 * of the merchant in case of a need to rollback transactions.
149 */
150 struct GNUNET_CRYPTO_EddsaPublicKey merchant_pub;
151
152 /**
153 * Hash over the contract between merchant and customer
154 * (remains unknown to the Mint).
155 */
156 struct GNUNET_HashCode h_contract;
157
158 /**
159 * Hash of the (canonical) representation of @e wire, used
160 * to check the signature on the request. Generated by
161 * the mint from the detailed wire data provided by the
162 * merchant.
163 */
164 struct GNUNET_HashCode h_wire;
165
166 /**
167 * Detailed wire information for executing the transaction.
168 */
169 const json_t *wire;
170
171 /**
172 * Merchant-generated transaction ID to detect duplicate
173 * transactions.
174 */
175 uint64_t transaction_id;
176
177 /**
178 * Fraction of the coin's remaining value to be deposited.
179 * The coin is identified by @e coin_pub.
180 */
181 struct TALER_Amount amount;
182
183 /**
184 * Type of the deposit (also purpose of the signature). Either
185 * #TALER_SIGNATURE_DEPOSIT or #TALER_SIGNATURE_INCREMENTAL_DEPOSIT.
186 */
187 uint32_t purpose; // FIXME: bad type, use ENUM!
188
189
190};
191
192
193
194/**
195 * FIXME
196 */
197struct KnownCoin
198{
199 struct TALER_CoinPublicInfo public_info;
200
201 /**
202 * Refreshing session, only valid if
203 * is_refreshed==1.
204 */
205 struct GNUNET_CRYPTO_EddsaPublicKey refresh_session_pub;
206
207 struct TALER_Amount expended_balance;
208
209 int is_refreshed;
210
211};
212
213
214/**
122 * Global information for a refreshing session. 215 * Global information for a refreshing session.
123 */ 216 */
124struct RefreshSession 217struct RefreshSession
@@ -168,6 +261,9 @@ struct RefreshSession
168}; 261};
169 262
170 263
264
265
266
171/** 267/**
172 * For each (old) coin being melted, we have a `struct 268 * For each (old) coin being melted, we have a `struct
173 * RefreshCommitLink` that allows the user to find the shared secret 269 * RefreshCommitLink` that allows the user to find the shared secret
@@ -214,89 +310,8 @@ struct RefreshCommitCoin
214}; 310};
215 311
216 312
217/**
218 * FIXME
219 */
220struct KnownCoin
221{
222 struct TALER_CoinPublicInfo public_info;
223
224 /**
225 * Refreshing session, only valid if
226 * is_refreshed==1.
227 */
228 struct GNUNET_CRYPTO_EddsaPublicKey refresh_session_pub;
229
230 struct TALER_Amount expended_balance;
231 313
232 int is_refreshed;
233 314
234};
235
236
237/**
238 * Specification for a /deposit operation.
239 */
240struct Deposit
241{
242 /**
243 * Information about the coin that is being deposited.
244 */
245 struct TALER_CoinPublicInfo coin;
246
247 /**
248 * EdDSA signature affirming that the customer intends
249 * this coin to be deposited at the merchant identified
250 * by @e h_wire in relation to the contract identified
251 * by @e h_contract.
252 */
253 struct GNUNET_CRYPTO_EddsaSignature csig;
254
255 /**
256 * Public key of the merchant. Enables later identification
257 * of the merchant in case of a need to rollback transactions.
258 */
259 struct GNUNET_CRYPTO_EddsaPublicKey merchant_pub;
260
261 /**
262 * Hash over the contract between merchant and customer
263 * (remains unknown to the Mint).
264 */
265 struct GNUNET_HashCode h_contract;
266
267 /**
268 * Hash of the (canonical) representation of @e wire, used
269 * to check the signature on the request. Generated by
270 * the mint from the detailed wire data provided by the
271 * merchant.
272 */
273 struct GNUNET_HashCode h_wire;
274
275 /**
276 * Detailed wire information for executing the transaction.
277 */
278 const json_t *wire;
279
280 /**
281 * Merchant-generated transaction ID to detect duplicate
282 * transactions.
283 */
284 uint64_t transaction_id;
285
286 /**
287 * Fraction of the coin's remaining value to be deposited.
288 * The coin is identified by @e coin_pub.
289 */
290 struct TALER_AmountNBO amount;
291
292 /**
293 * Type of the deposit (also purpose of the signature). Either
294 * #TALER_SIGNATURE_DEPOSIT or #TALER_SIGNATURE_INCREMENTAL_DEPOSIT.
295 */
296 uint32_t purpose; // FIXME: bad type, use ENUM!
297
298
299};
300 315
301 316
302/** 317/**
@@ -412,16 +427,6 @@ TALER_MINT_read_denom_key (const char *filename,
412 struct TALER_MINT_DenomKeyIssuePriv *dki); 427 struct TALER_MINT_DenomKeyIssuePriv *dki);
413 428
414 429
415/**
416 * Load the configuration for the mint in the given
417 * directory.
418 *
419 * @param mint_base_dir the mint's base directory
420 * @return the mint configuratin, or NULL on error
421 */
422struct GNUNET_CONFIGURATION_Handle *
423TALER_MINT_config_load (const char *mint_base_dir);
424
425 430
426int 431int
427TALER_TALER_DB_extract_amount (PGresult *result, 432TALER_TALER_DB_extract_amount (PGresult *result,