@@ -25,30 +25,36 @@ struct WeightedUrl {
2525 crow::json::wvalue to_json () const ;
2626};
2727
28- /* * currency description document */
28+ /* * @brief currency description document
29+ *
30+ * this structure describes a currency based on opencoin protocol.
31+ * It can be converted to json to provide the specified currency
32+ * description document.
33+ */
2934struct CDD {
3035
3136 std::string additional_info;
32- time_t cdd_expiry_date;// : 2023-07-22T15:45:53.164685
33- std::string cdd_location;// : https://opencent.org,
34- size_t cdd_serial;// : 1,
35- time_t cdd_signing_date;// : 2022-07-22T15:45:53.164685,
36- size_t currency_divisor;// : 100,
37- std::string currency_name;// : OpenCent,
38- std::vector<unsigned > denominations;// : [1, 2, 5],
39- BigInt id;// : 23ed956e629ba35f0002eaf833ea436aea7db5c2,
40-
41- std::vector<WeightedUrl> info_service;
42- /* eCipherSuite*/ std::string issuer_cipher_suite; // : RSA-SHA256-PSS-CHAUM82,
43- PublicKey
44- issuer_public_master_key; // : {
45- // modulus:
46- // daaa63ddda38c189b8c49020c8276adbe0a695685a...,
47- // public_exponent: 65537,
48- // type: rsa public key
49- // },
37+ time_t cdd_expiry_date; // / expiry date of this document (e.g.
38+ // /2023-07-22T15:45:53.164685)
39+ std::string cdd_location; // / URL of location of this document (e.g
40+ // /https://opencent.org)
41+ size_t cdd_serial; // / serial number of currency description document
42+ time_t cdd_signing_date; // / date of signing this document (e.g.
43+ // /2022-07-22T15:45:53.164685)
44+ size_t currency_divisor; // / divisor used for coins of this currency
45+ std::string currency_name; // / name of the currency (e.g. OpenCent)
46+ std::vector<unsigned >
47+ denominations; // / the available denominations of this currency
48+ BigInt id; // / an identity for this currency
49+
50+ std::vector<WeightedUrl> info_service;
51+ /* eCipherSuite*/
52+ std::string issuer_cipher_suite; // / the cipher suite used for this currencey
53+ // / (currently only RSA-SHA256-PSS-CHAUM82
54+ // / is supported)
55+ PublicKey issuer_public_master_key; // / the public key of this currency
5056 std::vector<WeightedUrl> mint_service;
51- std::string protocol_version; // : https://opencoin.org/1.0,
57+ std::string protocol_version; // e.g. https://opencoin.org/1.0
5258 std::vector<WeightedUrl> redeem_service;
5359 std::vector<WeightedUrl> renew_service;
5460
@@ -237,18 +243,63 @@ class Model {
237243public:
238244 virtual ~Model (){};
239245
246+ /* *
247+ * return the CurrencyDocumentDescription certifikate for a specific
248+ * serial version number of it.
249+ * [see spec](https://opencoin.org/0.4/schemata.html#cddc)
250+ * @return returns a pointer to the CDDC if successful, false otherwise
251+ */
240252 virtual tl::expected<CDDC *, bool > getCDDC (unsigned int cdd_serial) = 0;
241- virtual tl::expected<CDDC *, bool > getCurrentCDDC () = 0;
242253
254+ /* *
255+ * return the CurrencyDocumentDescription certifikate
256+ * [see spec](https://opencoin.org/0.4/schemata.html#cddc)
257+ * @return returns a pointer to the CDDC if successful, false otherwise
258+ */ virtual tl::expected<CDDC *, bool > getCurrentCDDC () = 0;
259+
260+ /* *
261+ * return the MintKey certificates for a given list of denominations
262+ * and mint key ids
263+ *
264+ * @param denominations
265+ * @param mint_key_ids
266+ *
267+ * @return mint key certificates for given denominations and mint_key_ids
268+ */
243269 virtual const std::vector<MintKeyCert>
244270 getMKCs (const std::vector<unsigned int > &denominations,
245271 const std::vector<BigInt> &mint_key_ids) = 0 ;
246272
273+
274+ /* *
275+ * returns the vector of blind signatures for a given vector of blinds
276+ *
277+ * @param transaction_reference reference to a transaction (send from client)
278+ * @param blinds the vector of blinds to sign
279+ *
280+ * @return
281+ */
247282 virtual std::vector<BlindSignature>
248283 mint (std::string const & transaction_reference,
249284 const std::vector<Blind> &blinds) = 0 ;
285+
286+ /* *
287+ * redeem valid coins into real money
288+ *
289+ * @param coins the coins to redeem
290+ *
291+ * @return true if successful, false on error
292+ */
250293 virtual bool redeem (const std::vector<Coin> &coins) = 0;
251294
295+ /* *
296+ * factory function returning a concrete backend for Opencoin API handling.
297+ * based on backend_name a concrete backend will be returned
298+ * or in case of error null.
299+ * @param backend_name
300+ *
301+ * @return pointer to backend instance or null on invalid backend name
302+ */
252303 static std::unique_ptr<Model> getModel (const std::string &backend_name);
253304
254305private:
0 commit comments