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
The class `Block` represents a block PSRD bytes that the hub sends to the client.
188
-
The hub sends the block to the client using some secure out-of-band mechanism;
189
-
in our code this mechanism is represented by the `.../dske/oob/v1/psrd` REST interface endpoint.
181
+
The class `Block` represents a block of PSRD bytes that the hub sends to the client.
182
+
183
+
A client requests one block of PSRD from the hub sending a GET request to the
184
+
`/hub/HUB_NAME/dske/oob/v1/psrd` API endpoint.
190
185
191
186
The `Block` class has the following attributes:
192
187
193
188
| Attribute | Type | Purpose |
194
189
|-|-|-|
195
190
| block_uuid | UUID | Uniquely identifies the block. |
196
191
| size | int | Size of the block in bytes. |
197
-
| owned | bool | True is the block is owned: it is possible to both allocate and consume fragments from this block. False if the block is not owned: it is not possible to locally allocate fragments; it is only possible to consume fragments that have been allocated by the peer node. The concept of ownership is described in more detail below. |
198
192
| data | bytes | The bytes in the block. |
199
193
| allocated | bitarray | A bit for each byte in the block to indicate whether the byte is allocated. |
200
194
| consumed | bitarray | A bit for each byte in the block to indicate whether the byte is consumed. |
@@ -205,18 +199,28 @@ The state of each byte in the block is described by the following Finite State M
205
199
206
200
When the block is created, each byte is unallocated.
207
201
208
-
The code can locally allocate bytes from the block.
209
-
A contiguous sequence of bytes allocated from a block is called a fragment.
202
+
A node can have multiple blocks, organized into pools.
203
+
A pool is represented by the `Pool` class.
204
+
205
+
A node may need to allocate some bytes from a pool for the purpose of allocating an encryption
206
+
key to encrypt an outgoing message to a signing key to sign an outgoing message.
207
+
Such an allocation of bytes is represented by the `Allocation` class.
208
+
209
+
When allocation is created, one or more blocks are selected to allocate the bytes from.
210
+
A contiguous sequence of bytes within a block that is assigned to an allocation is called
211
+
a fragment and represented by the `Fragment` class.
212
+
An allocation may span multiple blocks and hence consist of multiple fragments.
210
213
211
-
Bytes that have been allocated can be consumed. The byte value used to encrypt or authenticate
212
-
a key share. The byte in the block is zeroed out.
214
+
Allocating bytes from a block is a two step process.
213
215
214
-
It is also possible to consume bytes that have not been _locally_ allocated from a block.
215
-
This happens when the bytes have been _remotely_ allocated by the peer node, and the allocated
216
-
fragment is communicated through the DSKE protocol.
216
+
First the bytes are _allocated_ which means that they are assigned to an allocation.
217
217
218
-
Under circumstances the code can return an allocated byte to the block without consuming it.
219
-
This is called deallocating the byte. Once a byte has been consumed, it can no longer be deallocated.
218
+
Then the allocated bytes are _consumed_ which means that the allocated bytes are taken out of
219
+
the block and erased in the block.
220
+
221
+
A byte which has been allocated but not yet consumed can be deallocated.
222
+
223
+
TODO: CONTINUE FROM HERE
220
224
221
225
### Class `Fragment`
222
226
@@ -235,8 +239,6 @@ The `Fragment` class has the following attributes:
235
239
236
240
The relationship between a block and its fragments in shown in the following figure:
237
241
238
-

239
-
240
242
### The concept of block ownership
241
243
242
244
When a hub and a client share a block of Pre-Shared Random Data (PSRD) there is a `Block` object
0 commit comments