So when I initially added the hello message, the idea behind it was that we would add additional fields in the future for handshaking which would allow supporting “sharing codes” for folders.
These codes, just like existing possible folder setups would not be authorative (as in, there is no such thing as read only codes as we don’t have signing of messages etc), and are purely cosmetical for the purpose of establishing a relationship.
I am thinking of the following of the following workflow.
- You on device A “Share” a folder which generates a code, the code is probably time based (valid for N days) and count based (valid for a single use, or valid for 3 relationship establishments). The code has some significant entropy not to be bruteforceable.
- The code is stored in the config, with validity, usage count.
- A payload is posted to hello.syncthing.net. The payload contains:
SHA(code), Validity, AES(code, {deviceId, folderId, otherStuff})
. - The hello.syncthing.net service promises to store the payload under SHA(code) lookup key until Validity.
- On the other side, device B, the user can use the code to join (accept?) the folder, which does a lookup in hello.syncthing.net, and retrieves the AES encrypted payload by looking up SHA(code), checks validity.
- Device B decrypts the payload using code, asks the user to configure the folder path (or shares an existing folder based on auto-introduce logic probably), adds device A to it’s own config (which it found in the payload), and stores the pending code association with the device A (ala
device.pendingCodes = append(device.pendingCodes, newCode)
). A becomes a normal device on B. - Upon B connecting to the remote device A (where A is not yet aware of B), we include any pending codes in the hello message addressed to device A. If we get past Hello, we discard any codes that were pending (or blow up in flames if the code is no longer valid or something like that, or the folder we expected to get shared is no longer there?)
- Remote device A accepts hello message, checks for known codes that were issued, if the code is still valid and still has use attempts, it adds that device and shares that folder with the device and adjusts code usage accordingly.
Thoughts?
If we ever get to elliptic curve based signing and AES encryption of folders, the payload could include private EC key for signing, or just the AES key for decryption, so you would have different features part of the code.