Skip to content

Commit fa746dd

Browse files
committed
extended README.md to doxygen mainpage and add to doxygen build
1 parent 0e4c094 commit fa746dd

File tree

3 files changed

+113
-43
lines changed

3 files changed

+113
-43
lines changed

CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ else()
1414
add_compile_options(-Wall -Wextra -pedantic)
1515
endif()
1616

17-
project(oc-mint VERSION 0.0.1 LANGUAGES CXX)
17+
project(oc-issuer VERSION 0.0.2 LANGUAGES CXX)
1818

1919
include(FetchContent)
2020

@@ -64,10 +64,10 @@ find_package(Doxygen
6464
REQUIRED dot
6565
OPTIONAL_COMPONENTS mscgen dia)
6666
set(DOXYGEN_HAVE_DOT YES)
67-
doxygen_add_docs(
68-
doc
69-
src
70-
COMMENT "Generate documentation"
67+
doxygen_add_docs( doc
68+
README.md
69+
src
70+
COMMENT "Generate documentation"
7171
)
7272

7373
# build common library
@@ -76,8 +76,8 @@ add_library(oc-mint-lib ${LIB_SOURCES})
7676
target_link_libraries(oc-mint-lib PUBLIC Crow::Crow)
7777
target_include_directories(oc-mint-lib PUBLIC ${expected_SOURCE_DIR}/include src)
7878

79-
add_executable(oc-mint src/main.cpp)
80-
target_link_libraries(oc-mint PRIVATE oc-mint-lib INTERFACE tl::expected::expected)
79+
add_executable(${PROJECT_NAME} src/main.cpp)
80+
target_link_libraries(${PROJECT_NAME} PRIVATE oc-mint-lib INTERFACE tl::expected::expected)
8181

8282
## these are unittests that can be run on any platform
8383
add_executable(tests test/test_big_int.cpp test/test.cpp)

README.md

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,47 @@
1-
![build](https://github.com/OpenCoin/oc-mint-cpp/actions/workflows/cmake.yaml/badge.svg)
1+
opencoin-issuer-cpp - a C++ OpenCoin Issuer REST-API implementation {#mainpage}
2+
=============================================================
23

3-
# oc mint sample
4+
![build](https://github.com/OpenCoin/opencoin-issuer-cpp/actions/workflows/cmake.yaml/badge.svg)
5+
[![Documentation](https://github.com/OpenCoin/opencoin-issuer-cpp/actions/workflows/doxygen-gh-pages.yml/badge.svg)](https://github.com/OpenCoin/opencoin-issuer-cpp/actions/workflows/doxygen-gh-pages.yml)
46

5-
this is a C++ implementation of the opencoin protocol
6-
as mapping to some kind of REST interface
7+
# opencoin issuer
78

8-
actually it is a work in progress.
9+
this is a C++ implementation of the [opencoin protocol](https://opencoin.org/0.4/OpenCoin.html)
10+
done as mapping to some kind of REST interface.
911

10-
## Protocol Questions
12+
As all issuer related interactions of the protocol follows a request/response mechanism we are able to map all of them to Http-Requests.
1113

12-
+ What is signed as cdd - only the content of the cdd item with curly braces
13-
or also the key?
14-
+ the weighted URL as array has a different js encoding as other elements
15-
+ Clarify PSS usage (see https://crypto.stackexchange.com/questions/12707/usability-of-padding-scheme-in-blinded-rsa-signature)
14+
We decided to use POST-Requests in all cases,
15+
as the protocol uses JSON-formatted messages for requests.
16+
17+
The following table gives an overview of the mapping of requests to URLs:
18+
19+
| Request | URL | Response | C++ Interface Method |
20+
|:------------------|:-------------|:------------------------------|:---------------------------------------------------|
21+
| RequestCDDCSerial | /cddc/serial | ResponseCDDCSerial | cdd.cdd_serial of Model::getCurrentCDDC() |
22+
| RequestCDDC | /cddc | ResponseCDDC | Model::getCurrentCDDC() |
23+
| RequestMKCs | /mkcs | ResponseMKCs | Model::getMKCs |
24+
| RequestMint | /mint | ResponseMint | Model::mint |
25+
| RequestRenew | /renew | ResponseMint or ResponseDelay | ? |
26+
| RequestResume | /resume | ResponseMint or ResponseDelay | ? |
27+
| RequestRedeem | /redeem | ResponseRedeem | Model::redeem |
28+
29+
actually the implementation is a work in progress.
1630

1731
## TODO
1832

19-
+ [x] bigint type for big integers encoded as string
20-
+ [ ] blinding utilizing crypto++
21-
- [x] complete from_json conversions
22-
- [x] complete tests
23-
- [x] drone config
2433
- [ ] select crypto library
2534
+ https://en.wikipedia.org/wiki/Comparison_of_cryptography_libraries
35+
+ [ ] blinding utilizing crypto++
36+
+ [ ] integrate session and login to make transactions account based
37+
+ [ ] bookkeeping for accounts
38+
39+
## Protocol Questions
40+
41+
+ What is signed as cdd - only the content of the cdd item with curly braces
42+
or also the key?
43+
+ the weighted URL as array has a different js encoding as other elements
44+
+ Clarify PSS usage (see https://crypto.stackexchange.com/questions/12707/usability-of-padding-scheme-in-blinded-rsa-signature)
2645

2746
### Blinding Notes
2847

src/model.hpp

Lines changed: 72 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
*/
2934
struct 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 {
237243
public:
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

254305
private:

0 commit comments

Comments
 (0)