From 376ec590ea5da21315a37292817997352e58dee6 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Thu, 15 Apr 2021 03:39:36 +0300 Subject: Create the static site DON'T FORGET TO CHANGE site/config.toml BEFORE DEPLOYMENT --- site/content/register_docs.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 site/content/register_docs.md (limited to 'site/content/register_docs.md') diff --git a/site/content/register_docs.md b/site/content/register_docs.md new file mode 100644 index 0000000..45571fb --- /dev/null +++ b/site/content/register_docs.md @@ -0,0 +1,42 @@ ++++ +title = "Register" +description = "Register Documentation" +weight = 3 ++++ + +POST request to /register endpoint +Lets a [`User`] (=student) to authenticate themselves to the system +This `request` can be rejected if the payload is malformed (=not authenticated properly) or if +the [`AuthRequest.user_id`] of the `request` is not in the list of users that can hold a Gradecoin account + +# Authentication Process +- Gradecoin's Public Key (`gradecoin_public_key`) is listed on moodle. +- Gradecoin's Private Key (`gradecoin_private_key`) is loaded here + +- Student picks a short temporary key (`k_temp`) +- Creates a JSON object (`auth_plaintext`) with their `metu_id` and `public key` in base64 (PEM) format (`S_PK`): +{ + student_id: "e12345", + passwd: "15 char secret" + public_key: "---BEGIN PUBLIC KEY..." +} + +- Encrypts the serialized string of `auth_plaintext` with 128 bit block AES in CBC mode with Pkcs7 padding using the temporary key (`k_temp`), the result is `auth_ciphertext` TODO should this be base64'd? +- The temporary key student has picked `k_temp` is encrypted using RSA with OAEP padding scheme +using sha256 with `gradecoin_public_key` (TODO base64? same as above), giving us `key_ciphertext` +- The payload JSON object (`auth_request`) can be JSON serialized now: +{ + c: "auth_ciphertext" + key: "key_ciphertext" +} + +## Gradecoin Side + +- Upon receiving, we first RSA decrypt with OAEP padding scheme using SHA256 with `gradecoin_private_key` as the key and auth_request.key `key` as the ciphertext, receiving `temp_key` (this is the temporary key chosen by stu +- With `temp_key`, we can AES 128 Cbc Pkcs7 decrypt the `auth_request.c`, giving us +auth_plaintext +- The `auth_plaintext` String can be deserialized to [`AuthRequest`] +- We then verify the payload and calculate the User fingerprint +- Finally, create the new [`User`] object, insert to users HashMap `` + + -- cgit v1.2.3-70-g09d2 From 77b99f7d3a8747f562f2b8f1e8df551aafea1b28 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Thu, 15 Apr 2021 13:35:06 +0300 Subject: Remove lorems and inpsumses --- site/content/block_docs.md | 27 ++++++++++-- site/content/register_docs.md | 51 +++++++++++----------- site/content/transaction_docs.md | 23 ++++++++-- site/public/block-docs/index.html | 49 +++++++++++++++++++-- site/public/register-docs/index.html | 75 ++++++++++++--------------------- site/public/search_index.en.js | 2 +- site/public/transaction-docs/index.html | 47 ++++++++++++++++++--- src/handlers.rs | 2 +- src/schema.rs | 2 +- 9 files changed, 183 insertions(+), 95 deletions(-) (limited to 'site/content/register_docs.md') diff --git a/site/content/block_docs.md b/site/content/block_docs.md index 26803bd..4227f26 100644 --- a/site/content/block_docs.md +++ b/site/content/block_docs.md @@ -4,8 +4,27 @@ description = "Block Documentation" weight = 2 +++ -Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod -tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At -vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd -ubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. +A block that was proposed to commit Transactions in `transaction_list` to the +ledger with a nonce that made `hash` valid; 6 zeroes at the left hand side of the +hash (24 bytes). +We are _mining_ using [blake2s](https://www.blake2.net/) algorithm, which produces 256 bit hashes. Hash/second is roughly 20x10^3 on my machine, a new block can be mined in around 4-6 minutes. + +# Requests + +## GET +A HTTP `GET` request to [/block](/block) endpoint will return the latest mined block. + +## POST + +A HTTP `POST` request with Authorization using JWT will allow you to propose your own blocks. + +# Fields +``` +transaction_list: [array of Fingerprints] +nonce: unsigned 32-bit integer +timestamp: ISO 8601 T