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.h192
1 files changed, 188 insertions, 4 deletions
diff --git a/src/mint/mint.h b/src/mint/mint.h
index 644a9d292..39dda7d5f 100644
--- a/src/mint/mint.h
+++ b/src/mint/mint.h
@@ -13,14 +13,15 @@
13 You should have received a copy of the GNU General Public License along with 13 You should have received a copy of the GNU General Public License along with
14 TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> 14 TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
15*/ 15*/
16
17/** 16/**
18 * @file taler_mint.h 17 * @file mint.h
19 * @brief Common functionality for the mint 18 * @brief Common functionality for the mint
20 * @author Florian Dold 19 * @author Florian Dold
21 * @author Benedikt Mueller 20 * @author Benedikt Mueller
21 *
22 * TODO:
23 * - revisit and document `struct Deposit` members.
22 */ 24 */
23
24#ifndef _MINT_H 25#ifndef _MINT_H
25#define _MINT_H 26#define _MINT_H
26 27
@@ -55,11 +56,195 @@ struct TALER_MINT_DenomKeyIssuePriv
55 * not available. 56 * not available.
56 */ 57 */
57 struct TALER_RSA_PrivateKey *denom_priv; 58 struct TALER_RSA_PrivateKey *denom_priv;
59
58 struct TALER_MINT_DenomKeyIssue issue; 60 struct TALER_MINT_DenomKeyIssue issue;
59}; 61};
60 62
61 63
62 64
65/**
66 * Public information about a coin.
67 */
68struct TALER_CoinPublicInfo
69{
70 /**
71 * The coin's public key.
72 */
73 struct GNUNET_CRYPTO_EcdsaPublicKey coin_pub;
74
75 /*
76 * The public key signifying the coin's denomination.
77 */
78 struct TALER_RSA_PublicKeyBinaryEncoded denom_pub;
79
80 /**
81 * Signature over coin_pub by denom_pub.
82 */
83 struct TALER_RSA_Signature denom_sig;
84};
85
86
87
88
89
90
91
92struct CollectableBlindcoin
93{
94 struct TALER_RSA_BlindedSignaturePurpose ev;
95 struct TALER_RSA_Signature ev_sig;
96 struct TALER_RSA_PublicKeyBinaryEncoded denom_pub;
97 struct GNUNET_CRYPTO_EddsaPublicKey reserve_pub;
98 struct GNUNET_CRYPTO_EddsaSignature reserve_sig;
99};
100
101
102struct RefreshSession
103{
104 int has_commit_sig;
105 struct GNUNET_CRYPTO_EddsaSignature commit_sig;
106 struct GNUNET_CRYPTO_EddsaPublicKey session_pub;
107 uint16_t num_oldcoins;
108 uint16_t num_newcoins;
109 uint16_t kappa;
110 uint16_t noreveal_index;
111 uint8_t reveal_ok;
112};
113
114
115#define TALER_REFRESH_SHARED_SECRET_LENGTH (sizeof (struct GNUNET_HashCode))
116#define TALER_REFRESH_LINK_LENGTH (sizeof (struct LinkData))
117
118struct RefreshCommitLink
119{
120 struct GNUNET_CRYPTO_EddsaPublicKey session_pub;
121 struct GNUNET_CRYPTO_EcdsaPublicKey transfer_pub;
122 uint16_t cnc_index;
123 uint16_t oldcoin_index;
124 char shared_secret_enc[sizeof (struct GNUNET_HashCode)];
125};
126
127struct LinkData
128{
129 struct GNUNET_CRYPTO_EcdsaPrivateKey coin_priv;
130 struct TALER_RSA_BlindingKeyBinaryEncoded bkey_enc;
131};
132
133
134GNUNET_NETWORK_STRUCT_BEGIN
135
136struct SharedSecretEnc
137{
138 char data[TALER_REFRESH_SHARED_SECRET_LENGTH];
139};
140
141
142struct LinkDataEnc
143{
144 char data[sizeof (struct LinkData)];
145};
146
147GNUNET_NETWORK_STRUCT_END
148
149struct RefreshCommitCoin
150{
151 struct GNUNET_CRYPTO_EddsaPublicKey session_pub;
152 struct TALER_RSA_BlindedSignaturePurpose coin_ev;
153 uint16_t cnc_index;
154 uint16_t newcoin_index;
155 char link_enc[sizeof (struct LinkData)];
156};
157
158
159struct KnownCoin
160{
161 struct TALER_CoinPublicInfo public_info;
162 struct TALER_Amount expended_balance;
163 int is_refreshed;
164 /**
165 * Refreshing session, only valid if
166 * is_refreshed==1.
167 */
168 struct GNUNET_CRYPTO_EddsaPublicKey refresh_session_pub;
169};
170
171
172/**
173 * Specification for a /deposit operation.
174 */
175struct Deposit
176{
177 /* FIXME: should be TALER_CoinPublicInfo */
178 struct GNUNET_CRYPTO_EddsaPublicKey coin_pub;
179
180 struct TALER_RSA_PublicKeyBinaryEncoded denom_pub;
181
182 struct TALER_RSA_Signature coin_sig;
183
184 struct TALER_RSA_Signature ubsig;
185
186 /**
187 * Type of the deposit (also purpose of the signature). Either
188 * #TALER_SIGNATURE_DEPOSIT or #TALER_SIGNATURE_INCREMENTAL_DEPOSIT.
189 */
190 struct TALER_RSA_SignaturePurpose purpose;
191
192 uint64_t transaction_id;
193
194 struct TALER_AmountNBO amount;
195
196 struct GNUNET_CRYPTO_EddsaPublicKey merchant_pub;
197
198 struct GNUNET_HashCode h_contract;
199
200 struct GNUNET_HashCode h_wire;
201
202 /* TODO: uint16_t wire_size */
203 char wire[]; /* string encoded wire JSON object */
204
205};
206
207
208/**
209 * Reserve row. Corresponds to table 'reserves' in the mint's
210 * database. FIXME: not sure this is how we want to store this
211 * information. Also, may currently used in different ways in the
212 * code, so we might need to separate the struct into different ones
213 * depending on the context it is used in.
214 */
215struct Reserve
216{
217 /**
218 * Signature over the purse.
219 * Only valid if (blind_session_missing==GNUNET_YES).
220 */
221 struct GNUNET_CRYPTO_EddsaSignature status_sig;
222 /**
223 * Signature with purpose TALER_SIGNATURE_PURSE.
224 * Only valid if (blind_session_missing==GNUNET_YES).
225 */
226 struct GNUNET_CRYPTO_EccSignaturePurpose status_sig_purpose;
227 /**
228 * Signing key used to sign the purse.
229 * Only valid if (blind_session_missing==GNUNET_YES).
230 */
231 struct GNUNET_CRYPTO_EddsaPublicKey status_sign_pub;
232 /**
233 * Withdraw public key, identifies the purse.
234 * Only the customer knows the corresponding private key.
235 */
236 struct GNUNET_CRYPTO_EddsaPublicKey reserve_pub;
237 /**
238 * Remaining balance in the purse.
239 */
240 struct TALER_AmountNBO balance;
241
242 /**
243 * Expiration date for the purse.
244 */
245 struct GNUNET_TIME_AbsoluteNBO expiration;
246};
247
63 248
64 249
65 250
@@ -153,4 +338,3 @@ TALER_TALER_DB_extract_amount_nbo (PGresult *result, unsigned int row,
153 int indices[3], struct TALER_AmountNBO *denom_nbo); 338 int indices[3], struct TALER_AmountNBO *denom_nbo);
154 339
155#endif /* _MINT_H */ 340#endif /* _MINT_H */
156