Expand description
This adds end-to-end encryption for peer communications over the base sbd communication protocol via libsodium secretstream.
§Message Type Header
Adds a single-byte header to messages sent.
Messages with bytes other than the following three should be ignored for future compatibility.
0x10- NewStream – must be followed by 24 byte secret stream header.0x11- Message – encrypted message including abytes.0x12- RequestNewStream – only this single byte.
§Message Type Handling
- When sending a message to a new (or not recent) peer, clients MUST establish a new outgoing (encryption) secret stream state and send the 24 byte header in a “NewStream” message.
- On receiving a “RequestNewStream” message, clients MUST establish a new outgoing (encryption) secret stream state and send the 24 byte header in a “NewStream” message.
- On receiving a “NewStream” message, clients MUST establish a new incoming (decryption) secret stream state.
- On receiving a “Message” that cannot be decrypted, clients MUST (1) ignore the message, (2) delete any incoming (decryption) state, and (3) send a “RequestNewStream” message. Any message receipt tracking or re-requesting will not be handled by this library, but may be added by implementors as a layer on top of this.
Enums§
- Protocol
- E2e crypto protocol enum.
Constants§
- T_
MESSAGE - Encrypted stream message.
- T_
NEW_ STREAM - Start a new stream.
- T_
REQ_ NEW_ STREAM - Request start of new stream.