From 2074c001c793666c5dc5f653a4f12f47c7afe9b9 Mon Sep 17 00:00:00 2001 From: SG Date: Wed, 24 May 2023 13:50:11 +0200 Subject: [PATCH] Documentation for Transmat --- transphase/docs/Protocol.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 transphase/docs/Protocol.md diff --git a/transphase/docs/Protocol.md b/transphase/docs/Protocol.md new file mode 100644 index 0000000..268a07b --- /dev/null +++ b/transphase/docs/Protocol.md @@ -0,0 +1,22 @@ +# Transmat protocol description +## ver. 0.1 + +### **Dramatis Personae:** +*Relay* - Transphase relay Relay +*Sender* - sending party +*Receiver* - receiving party + +* *Sender* creates a low-entropy password, derives a key and a `peer_group_id` vaule and sends the message containing the `peer_group_id` to the *Relay* +* *Relay* maintains a list of all its peers grouped by their `peer_group_id` value. + * If the current message has a new unique `peer_group_id`, then a new peer group is created. + * If the current message has a known `peer_group_id`, then a new peer group is created from it and the party that sent the message (normally the *Sender*) is added to that group. +* *Sender* passes the low-entropy password to the *Receiver* over a different channel (e.g. phone or SSH). +* *Receiver* derives a key and a `peer_group_id` value and sends the message containing the `peer_group_id` to the *Relay*. + * This message contains 0 as `chunk_number` so that the *Sender* knows that the transfer should start from the very beginning. +* *Relay* forwards this message to all other peers in the corresponding peer group (that is to the *Sender*). +* *Sender* receives this message; sends the encrypted chunk and metadata; and then waits for the *Receiver* to send a confirmation that it has successfully received the message. +* *Relay* forwards this message to all other peers in the corresponding peer group (that is to the *Receiver*). +* *Receiver* decrypts the payload and writes it to the target file. (TODO: Check chunk hash) Then it sends a confirmation to the *Relay*. The confirmation contains the incremented number as the `chunk_id` + * If this was the last chunk in the transmission, *Receiver* closes the Websocket connection to the *Relay* +* *Sender* receives the confirmation and sends the next encrypted chunk and metadata. + * If *Sender* has no more chunks to send, *Sender* closes the Websocket connection to the *Relay* \ No newline at end of file