From e1144af6f4dee167e048e62910ddb06e253d81a8 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Mon, 20 Oct 2025 19:07:48 +0400 Subject: [PATCH] removal protocol --- docs/rfcs/2025-10-20-chat-relays.md | 99 ++++++++++++++++++++++++++++- 1 file changed, 96 insertions(+), 3 deletions(-) diff --git a/docs/rfcs/2025-10-20-chat-relays.md b/docs/rfcs/2025-10-20-chat-relays.md index 4ba7b3560a..cd3c57af27 100644 --- a/docs/rfcs/2025-10-20-chat-relays.md +++ b/docs/rfcs/2025-10-20-chat-relays.md @@ -21,7 +21,7 @@ par With each relay O ->> R: 5. Contact request
(x.grp.relay.inv) R ->> RSMP: 6. Create relay link RSMP -->> R: - R ->> O: 7. Accept request
(x.grp.relay.acpt) + R ->> O: 7. Accept request
(x.grp.relay.acpt
incl. relay link) O ->> OSMP: 8. Update short link
(add relay link) OSMP -->> O: O ->> R: 9. Notify relay link added
(x.grp.info) @@ -34,10 +34,17 @@ O -->> O: 13. Share group short link
(social, out-of-band) note over OSMP, M: New member connects -M ->> OSMP: 1. Retrieve short link data +M ->> OSMP: 14. Retrieve short link data OSMP -->> M: -M ->> R: 2. Connect via relay link(s) +M -->> M: 15. Prepare group record,
save relay links +M ->> R: 16. Connect via relay link(s) R -->> M: + +note over O, M: Message forwarding + +O ->> R: 17. Send message +R ->> M: 18. Forward message +M -->> M: 19. Deduplicate message ``` Notes: @@ -61,3 +68,89 @@ Notes: - Link is recoverable from profile, e.g. for purpose of restoring connection with group via new chat relays. Overall it just seems a natural and convenient way to store group link for all members, rather than having it separately. + +- Owner should reject contact requests to their group link. + +- Chat relay should reject contact requests to its relay link until chat relay confirms it is attached to the group link data. + + +## Protocol for removing chat relay from group, restoring connection to group + +```mermaid +sequenceDiagram + participant OSMP as Owner's
SMP server + participant O as Owner + participant R as Chat relay + participant RSMP as Chat relays'
SMP server(s) + participant M as Member + +note over OSMP, M: Scenario 1. Owner deletes chat relay, notifies relay + +par Owner to chat relay + O ->> R: 1a. Delete chat relay
(x.grp.mem.del) + par Chat relay to SMP + R ->> RSMP: 2a. Delete relay link + and Chat relay to members + R ->> M: 2b. Forward relay is deleted + M -->> M: 3. Delete connections with relay + end +and Owner to SMP + O ->> OSMP: 1b. Remove relay link
(update group link data) + OSMP -->> O: +and + O -->> O: 1c. Delete connection with relay +end + +note over OSMP, M: Scenario 2. Owner deletes chat relay, fails to notify relay + +par Owner to chat relay + O --x R: 1a. Fail to notify relay +and Owner to SMP + O ->> OSMP: 1b. Remove relay link
(update group link data) + OSMP -->> O: +and + O -->> O: 1c. Delete connection with relay +end +loop Chat relay periodic checks + R ->> OSMP: 2. Retrieve short link data for served gorup + OSMP -->> R: + R --x R: 3. Check relay link added +end +par Chat relay to SMP + destroy RSMP + R ->> RSMP: 4a. Delete relay link +and Chat relay to members + destroy R + R ->> M: 4b. Notify relay is deleted + M -->> M: 5. Delete connections with relay +end + +note over OSMP, M: Last relay is deleted + +O --x M: Owner can't send messages to members +M -->> M: Attempt to restore
connection to group (manual) +M ->> OSMP: Retrieve short link data +OSMP -->> M: +M --x M: Members can't restore connection to group + +note over OSMP, M: Restore connection to group + +create participant NR as New chat relay +O <<-->> NR: 1. Add new relay, relay creates and sends link +O <<-->> OSMP: 2. Update short link
(add relay link) +M -->> M: 3. Attempt to restore
connection to group (manual) +M ->> OSMP: 4. Retrieve short link data +OSMP -->> M: +M ->> NR: 5. Connect via relay link +NR -->> M: +O ->> NR: 6. Send message +NR ->> M: 7. Forward message +M -->> M: 8. Deduplicate message +``` + +Notes: + +- New relay doesn't have group history. + - We can prohibit to remove last relay without adding new one. + - Relays can synchronize history. + - Can be considered after MVP.