Skip to content

Chat Private #93

Draft
jazzz wants to merge 20 commits intomasterfrom
jazzz/private
Draft

Chat Private #93
jazzz wants to merge 20 commits intomasterfrom
jazzz/private

Conversation

@jazzz
Copy link
Contributor

@jazzz jazzz commented Oct 26, 2025

This PR adds a specification which describes a conversation protocol for pairwise communication called PRIVATE1.

It covers payload generation and operation after a key has been agreed upon by both parties.

Notes

This may eventually be simplified and use Reliable Channels but its explicit in how it utilizes SDS + segmentation and the reasons for doing so.


The following mappings connect PRIVATE1 concepts to SDS fields:

- `sender_id`: !TODO: This requires PRIVATE1 to be identity aware
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure exactly what the best course of action is here. Recent changes to SDS requires an sender_id be attached the the SdsMessage.

This then brings in a concept of identity to this specification. Its definitely possible to introduce Identity concepts in order to pass them through to SDS, however it seems like a lot of added complexity

@jazzz jazzz marked this pull request as ready for review October 28, 2025 23:44
@jazzz jazzz requested review from jm-clius and plopezlpz October 28, 2025 23:44
@jazzz jazzz marked this pull request as draft February 2, 2026 17:33
- **[DOUBLERATCHET]** "The Double Ratchet Algorithm", Signal, 2016.
https://signal.org/docs/specifications/doubleratchet/

- **[SDS]** "Scalable Data Sync Specification", vac, 2024.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these github references from vacp2p and waku-org are broken.

Copy link

@osmaczko osmaczko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. The reasoning behind the Content -> Segmentation -> Reliability -> Encryption layering makes sense.

Please remember to address the TODOs before merging.

Comment on lines +57 to +61
```mermaid
flowchart LR
Content:::plain--> PrivateV1 --> Payload:::plain
classDef plain fill:none,stroke:transparent;
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```mermaid
flowchart LR
Content:::plain--> PrivateV1 --> Payload:::plain
classDef plain fill:none,stroke:transparent;
```
```mermaid
flowchart LR
Content:::plain --> PrivateV1
PrivateV1 --> F1[Frame 1] --> P1[Payload 1]:::plain
PrivateV1 -.-> F2[Frame 2] -.-> P2[Payload 2]:::plain
PrivateV1 -.-> FN[Frame N] -.-> PN[Payload N]:::plain
classDef plain fill:none,stroke:transparent;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally like these changes, but looking to understand more to see if there is more optimizations to be made.

I see two changes here.

  1. An explicit reference to Frames
  2. An specific update the the cardinality of messages.

I can see # 2 being an improvement as it explicitly refers to segmentation being a responsibility of the protocol.

At a high level does adding Frames increase understanding at a 40,000ft view?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a high level does adding Frames increase understanding at a 40,000ft view?

Don’t have a strong opinion here. Including frames makes it clear at first glance that segmentation happens in the chat protocol rather than in the delivery service.

Implementation specifics:
- Error correction is not used, as reliable delivery is already provided by lower layers.
- `segmentSize` = `max_seg_size`
- All payloads regardless of size are wrapped in a segmentation message.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This contradicts segmentation specs:

Messages whose payload size is ≤ segmentSize are sent unmodified.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point.

I specifically have suggested a change in that PR.

Sending the message unmodified violates the functional requirement of "deterministic decoding".

To decode those messages one would first attempt to decode as a Segmentation message, and then on failure, assume its a different type.

I'd prefer to spend the extra 4 bytes and make it explicit.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to spend the extra 4 bytes and make it explicit.

Totally agree 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants