You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/developer-guide.md
+65-28Lines changed: 65 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,16 +19,23 @@ Or, for more details see the
19
19
20
20
## Technology stack
21
21
22
-
Our technology stack is:
22
+
The code technology stack includes:
23
23
*[Python 3.13](https://www.python.org/) as the programming language.
24
-
*[FastAPI](https://www.python.org/) for HTTP APIs.
24
+
The nodes (clients and hubs) are asynchronous;
25
+
the manager is synchronous.
26
+
*[FastAPI](https://www.python.org/) for server-side HTTP APIs.
27
+
*[HTTPX](https://www.python-httpx.org/) for client-side HTTP APIs.
28
+
*[Uvicorn](https://uvicorn.dev/)as the ASGI (synchronous Server Gateway Interface) web server.
25
29
*[Git](https://git-scm.com/) and [Github](https://github.com/brunorijsman/dske-python) for version control.
30
+
31
+
The development toolchain includes:
26
32
*[Github actions](https://github.com/features/actions) for continuous integration.
27
33
*[Pylint](https://pypi.org/project/pylint/) for linting.
28
34
*[Black](https://black.readthedocs.io/) for code formatting.
29
35
*[Coverage](https://coverage.readthedocs.io/) for code coverage.
30
36
*[Pip](https://pypi.org/project/pip/) for dependency management.
31
37
*[Venv](https://docs.python.org/3/library/venv.html) for virtual environments.
38
+
*[Markdown](https://en.wikipedia.org/wiki/Markdown) for documentation.
32
39
33
40
## DSKE protocol
34
41
@@ -42,8 +49,10 @@ See [the DSKE protocol page](/docs/dske-protocol.md) for more details.
42
49
## Proof of concept
43
50
44
51
The code is intended to be a proof-of-concept to study the DSKE protocol; it is not
45
-
suitable for production deployments for numerous reasons (e.g. we have made no effort to prevent
46
-
side-channel attacks).
52
+
suitable for production deployments for numerous reasons (e.g.
53
+
state is not persisted and the protocol needs to start from scratch every time a daemon restarts,
54
+
we have made no effort to prevent side-channel attacks,
55
+
etc.)
47
56
48
57
## Check-and-test script
49
58
@@ -90,41 +99,69 @@ for the network node as reported when the topology is started.
90
99
91
100
Here we provide a summary of the API endpoints and their purpose.
92
101
93
-
### Hub API endpoints
94
-
95
-
The hubs provides the following API endpoints:
96
-
97
-
| Method | URL | Purpose | Authenticated |
98
-
|-|-|-|-|
99
-
| PUT |`/hub/HUB_NAME/dske/oob/v1/registration`| Register a client with a hub. | No |
100
-
| GET |`/hub/HUB_NAME/dske/oob/v1/psrd`| Allows a client to get a block of Pre-Shared Random Data (PSRD) from the hub. | No |
101
-
| POST |`/hub/HUB_NAME/dske/api/v1/key-share`| Allows an initiator client to add a key share to the hub, so that it can later be retrieved by the responder client. | Yes |
102
-
| GET |`/hub/HUB_NAME/dske/api/v1/key-share`| Allows a responder client to add a key share to the hub, that was previously added by the initiator client. | Yes |
103
-
| GET |`/hub/HUB_NAME/mgmt/v1/status`| Get the status of the hub. | No |
104
-
| POST |`/hub/HUB_NAME/mgmt/v1/stop`| Stop the hub. | No |
105
-
106
-
See the [authentication section](#authentication) below for more details on authentication.
107
-
108
-
HUB_NAME is the name of the hub.
109
-
If each hub runs in a separate process (and hence has a separate port number) as is currently the
110
-
case, this is not really needed.
111
-
We include it anyway to allow for the possibility of running all hubs (and clients) in a single
112
-
process with a single port.
102
+
### API naming conventions
113
103
114
104
The API endpoints belong to one of the following groups:
115
105
116
106
| Endpoint path | Purpose |
117
107
|-|-|
118
108
|`.../dske/...`| DSKE protocol. |
119
-
|`.../dske/oob/...`| The out-of-band (OOB) portion of the DSKE protocol. |
120
-
|`.../dske/api/...`| The in-band portion of the DSKE protocol. . |
109
+
|`.../dske/oob/...`| The out-of-band (OOB) portion of the DSKE protocol. |
110
+
|`.../dske/api/...`| The in-band portion of the DSKE protocol. |
121
111
|`../mgmt/...`| Used for management. Since this code is not intended for production deployment, these endpoints are also not authenticated. |
122
112
113
+
All API endpoints include the node type and the node name at the start of the URL path.
114
+
For example:
115
+
116
+
| Node type | URL prefix |
117
+
|-|-|
118
+
| PUT |`/hub/HUB_NAME/...`|
119
+
| GET |`/client/CLIENT_NAME/...`|
120
+
121
+
Currently, this is not really necessary for anything, since each node runs in its own process
122
+
on a different HTTP port.
123
+
But we anticipate that we (or someone else) may run this code as a cloud-based service at some
124
+
point in the future (similar to what we did with
125
+
[QuKayDee](https://qukaydee.com) for QKD).
126
+
In that case, the cloud-based service would expose only a single HTTP port, and some proxy
127
+
(e.g [Nginx](https://nginx.org/)) would use URL-based routing to dispatch each request to the
128
+
correct node process.
129
+
123
130
All API endpoints are versioned (currently `v1`).
124
131
132
+
Putting all of this together, an example of a complete URL for one of the API endpoints is:
133
+
`/hub/HUB_NAME/dske/api/v1/key-share`
134
+
135
+
### Hub API endpoints
136
+
137
+
The hubs provides the following API endpoints:
138
+
139
+
| Method | URL | Purpose | Authenticated |
140
+
|-|-|-|-|
141
+
| PUT |`/hub/HUB_NAME /dske/oob/v1 /registration`| Register a client with a hub. | No |
142
+
| GET |`/hub/HUB_NAME /dske/oob/v1 /psrd`| A client gets a block of Pre-Shared Random Data (PSRD) from the hub. | No |
143
+
| POST |`/hub/HUB_NAME /dske/api/v1 /key-share`| An initiator client adds a key share to the hub. The share can later be retrieved by the responder client. | Yes |
144
+
| GET |`/hub/HUB_NAME /dske/api/v1 /key-share`| A responder client retrieves a key share from the hub. The share was previously added by the initiator client. | Yes |
145
+
| GET |`/hub/HUB_NAME /mgmt/v1 /status`| Get the management status of the hub. | No |
146
+
| POST |`/hub/HUB_NAME /mgmt/v1 /stop`| Stop the hub. | No |
147
+
148
+
### Clients API endpoints
149
+
150
+
The clients provides the following API endpoints:
151
+
152
+
| Method | URL | Purpose | Authenticated |
153
+
|-|-|-|-|
154
+
| GET |`/client/CLIENT_NAME /etsi/api/v1 /keys/SLAVE_SAE_ID/enc_keys`| An initiator encryptor gets a key from a client. | No |
155
+
| GET |`/client/CLIENT_NAME /etsi/api/v1 /keys/MASTER_SAE_ID/dec_keys ?key_ID=KEY_ID`| A responder encryptor gets a key with key ID from a client. | No |
156
+
| GET |`/client/CLIENT_NAME /etsi/api/v1 /keys/SLAVE_SAE_ID/status`| An encryptor gets the QKD link status from client. | No |
157
+
| GET |`/hub/HUB_NAME /mgmt/v1/status`| Get the management status of the client. | No |
158
+
| POST |`/hub/HUB_NAME /mgmt/v1/stop`| Stop the club. | No |
159
+
125
160
## Authentication
126
161
127
-
Only the in-band DSKE protocol API endpoints (`.../dske/api/...`) are authenticated.
162
+
Only the in-band DSKE protocol API endpoints (`.../dske/api/...`) are authenticated
163
+
using the authentication mechanism described in the
164
+
[protocol guide](/docs/protocol-guide.md)
128
165
129
166
The out-of-band DSKE protocol API endpoints (`.../dske/oob/...`) are not authenticated.
130
167
They only exist to simulate actions that would be some secure out-of-band physical distribution
@@ -138,7 +175,7 @@ we only implement a simplified subset of the
0 commit comments