It goes in small numbered pieces
Your browser sends the file in pieces of the same size, each locked and numbered.
No piece is sent until the recipient has said yes to the file.
The transfer, frame by frame
When the sender chooses the file, their browser computes its SHA-256 checksum.
- INIT
- The sender sends the transfer ID. It is the only frame not encrypted. Changing it changes the file key, so the next frame fails to decrypt. Replaying it in a later attempt doesn't work either, because the recipient's new attempt ID changes the key.
- CHECK
- With the safety number on, each side's answer, encrypted, once the person on that side has compared the numbers: matches or differs. META waits for both answers.
- META
- The file name, size and type and the sender's typed name, encrypted. The recipient sees them and chooses.
- ACCEPT or DECLINE
- The recipient's answer, encrypted. ACCEPT also says where to start: at the beginning, or after the part of the file a dropped connection left with the recipient. It proves that the recipient has the key. No file data is sent before it.
- CREDIT
- How many chunks the sender may send, encrypted. The recipient grants 128 at a time and more as it writes them, so a slow recipient never has more than about 6 MiB waiting. A sender that gets further ahead than that is stopped.
- CHUNK
- The file in frames of equal size, up to 48 KiB each, from where ACCEPT says.
- END
- The whole file's exact size and the checksum computed when it was chosen.
- RECEIPT
- The checksum the recipient computed from what arrived. The sender counts the file as delivered only when it matches. It isn't proof that the file arrived: END already carries the checksum, so a modified recipient's page, which has the key anyway, can skip every chunk and send the checksum back.