|
@@ -8,7 +8,14 @@ Commonly used **API** among different dependencies. For example **key-exchange-s
|
8
|
8
|
|
9
|
9
|
## Web-Client 🦘
|
10
|
10
|
|
11
|
|
-Client library for communication from browser and *Near blockchain*. It's a high-level **API**. User doesn't need to understand how blockchain works.
|
|
11
|
+It's a client that exchange keys between meeting moderator and participants.
|
|
12
|
+To achieve solid security used blockchain as a trust point for establishing secure channels between ```moderator``` and ```participant```. Each user in a blockchain has an ```ED25519``` PublicKey. For creating a secure channel **Diffie–Hellman** algorithm is used, provided by [Dalek cryptography](https://github.com/dalek-cryptography). Unfortunately, it's not possible to exchange keys with ```ED25519``` keys, because it is using a ```Edwards``` point, and for algorithm needs a ```Montgomery``` point. For this purpose, conversion happened [here](https://github.com/Relayz-io/near-client/blob/376708def420a158b3ca4e5af2aff2e380fd58af/src/crypto/dhx.rs#L168).
|
|
13
|
+
|
|
14
|
+> NOTE! Used the maximum key length for each algorithm
|
|
15
|
+
|
|
16
|
+Then we have proper keys for the **Diffie–Hellman** exchange. Let's create out secret with [dhx](https://github.com/Relayz-io/key-exchange-client/blob/develop/web-client/src/crypto.rs#LL8C5-L8C5). After we need to provide a uniformly distributed secret key. For this purpose used a ***_KDF_*** algorithm [```blake3```](https://github.com/BLAKE3-team/BLAKE3). [Here](https://github.com/Relayz-io/key-exchange-client/blob/86450c015c2370742c765d94629ae97837224eee/web-client/src/crypto.rs#L18) is an implementation.
|
|
17
|
+
|
|
18
|
+The next stage is to pass a randomly generated key in a secure way for each participant. To do this let's encrypt _generated key_ with a just generated after ***_KDF_*** secure key, that is unique for each ```participant = moderator``` pair. Encrypt randomly generated key by [ChaCha20](https://rust-random.github.io/rand/rand_chacha/struct.ChaCha20Rng.html) with a [AES-GCM](https://github.com/Relayz-io/key-exchange-client/blob/86450c015c2370742c765d94629ae97837224eee/web-client/src/crypto.rs#L30). That's all.
|
12
|
19
|
|
13
|
20
|
### Usage of web-client library:
|
14
|
21
|
|