Skip to content

Commit 6edeadb

Browse files
authored
feat: out-of-band conversation type (#288)
Changes: 1. Defines a 'oneshot' conversation type 2. Defines a 'readd request' oneshot message, which is used to request fork recovery 3. Defines a readd intent, which is the response to the request. The creator of the intent will publish a commit and then send welcomes to the requester. __________ Optional notes: Readd requests need to be sent to superadmins outside of the main group (as the sender is forked), however they still need MLS level authentication and privacy guarantees. We could create a single-use group and then send a message on it, but given only a single message is needed, an alternative is to embed the message on the immutable metadata of the group itself, and have the recipient 'receive' the message at the time of decrypting the welcome, without persisting the group (ie: use openMLS to construct the group/StagedWelcome in-memory, pull the message from the immutable metadata, then throw the group away). That would allow us to avoid: - Delays from the sender needing to send an additional message on the group after the welcomes have been sent - Delays from the recipient needing to sync the group after receiving the welcome to receive the message - Any unintentional consequences around group storage, syncing on it in the future, calling maybe_update_installations, or rendering it in UI. Also means we don't create a new topic on the server.
1 parent 8b46912 commit 6edeadb

File tree

8 files changed

+44
-11
lines changed

8 files changed

+44
-11
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,14 @@ jobs:
3737
uses: actions/checkout@v4
3838
- uses: actions/checkout@v4
3939
with:
40-
repository: 'xmtp/xmtpd'
40+
repository: "xmtp/xmtpd"
4141
path: xmtpd
4242
- uses: actions/setup-go@v5
4343
- name: Execute xmtpd protos builder
4444
run: |
4545
cd xmtpd
46+
shopt -s globstar
47+
rm -rf pkg/proto/**/*.pb.go pkg/proto/**/*.pb.gw.go pkg/proto/**/*.swagger.json
48+
shopt -u globstar
4649
go tool -modfile=tools/go.mod buf generate ../proto/
47-
go build ./...
50+
go build ./...

dev/kotlin/generate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ docker run --platform linux/x86_64 --rm -i -v${PWD}:/code xmtp/protoc-kotlin \
4949
mls/message_contents/group_mutable_metadata.proto \
5050
mls/message_contents/commit_log.proto \
5151
mls/message_contents/content.proto \
52-
mls/message_contents/out_of_band.proto \
52+
mls/message_contents/oneshot.proto \
5353
mls/message_contents/transcript_messages.proto \
5454
mls/message_contents/wrapper_encryption.proto \
5555
mls/message_contents/content_types/multi_remote_attachment.proto \

dev/ts/generate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ docker run --rm -i -v${PWD}:/code xmtp/protoc \
4444
mls/message_contents/group_membership.proto \
4545
mls/message_contents/group_metadata.proto \
4646
mls/message_contents/group_mutable_metadata.proto \
47-
mls/message_contents/out_of_band.proto \
47+
mls/message_contents/oneshot.proto \
4848
mls/message_contents/transcript_messages.proto \
4949
mls/message_contents/content_types/multi_remote_attachment.proto \
5050
mls/message_contents/content_types/reaction.proto \

proto/mls/database/intents.proto

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ message AddressesOrInstallationIds {
3838
}
3939
}
4040

41+
// DEPRECATED
4142
// The data required to add members to a group
4243
message AddMembersData {
4344
// V1 of AddMembersPublishData
@@ -50,6 +51,7 @@ message AddMembersData {
5051
}
5152
}
5253

54+
// DEPRECATED
5355
// The data required to remove members from a group
5456
message RemoveMembersData {
5557
// V1 of RemoveMembersPublishData
@@ -80,6 +82,19 @@ message UpdateGroupMembershipData {
8082
}
8183
}
8284

85+
// The data required to remove and readd existing leaf nodes
86+
// on the MLS tree. Does not change or update the members list.
87+
// Used for fork recovery
88+
message ReaddInstallationsData {
89+
message V1 {
90+
repeated bytes readded_installations = 1;
91+
}
92+
93+
oneof version {
94+
V1 v1 = 1;
95+
}
96+
}
97+
8398
// The data required to update group metadata
8499
message UpdateMetadataData {
85100
// V1 of UpdateMetadataPublishData

proto/mls/message_contents/content.proto

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ syntax = "proto3";
55
package xmtp.mls.message_contents;
66

77
import "device_sync/content.proto";
8-
import "mls/message_contents/out_of_band.proto";
98

109
option go_package = "github.com/xmtp/proto/v3/go/mls/message_contents";
1110
option java_package = "org.xmtp.proto.mls.message.contents";
@@ -70,9 +69,11 @@ message PlaintextEnvelope {
7069
xmtp.device_sync.content.DeviceSyncReply device_sync_reply = 4;
7170
// A serialized user preference update
7271
xmtp.device_sync.content.V1UserPreferenceUpdate user_preference_update = 5;
73-
// A readd request for fork recovery
74-
ReaddRequest readd_request = 6;
7572
}
73+
74+
// Removed; moved to oneshot message
75+
reserved 6;
76+
reserved "readd_request";
7677
}
7778

7879
// Selector which declares which version of the EncodedContent this

proto/mls/message_contents/group_metadata.proto

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ syntax = "proto3";
33

44
package xmtp.mls.message_contents;
55

6+
import "mls/message_contents/oneshot.proto";
7+
68
option go_package = "github.com/xmtp/proto/v3/go/mls/message_contents";
79
option java_package = "org.xmtp.proto.mls.message.contents";
810

@@ -14,6 +16,8 @@ message GroupMetadataV1 {
1416
string creator_inbox_id = 3;
1517
// Should only be present for CONVERSATION_TYPE_DM
1618
optional DmMembers dm_members = 4;
19+
// Should only be present for CONVERSATION_TYPE_ONESHOT
20+
optional xmtp.mls.message_contents.OneshotMessage oneshot_message = 5;
1721
}
1822

1923
// Defines the type of conversation
@@ -22,6 +26,7 @@ enum ConversationType {
2226
CONVERSATION_TYPE_GROUP = 1;
2327
CONVERSATION_TYPE_DM = 2;
2428
CONVERSATION_TYPE_SYNC = 3;
29+
CONVERSATION_TYPE_ONESHOT = 4;
2530
}
2631

2732
// Wrapper around an Inbox Id

proto/mls/message_contents/group_mutable_metadata.proto

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ message GroupMutableMetadataV1 {
1414
// Creator starts as only super_admin
1515
// Only super_admin can add/remove other super_admin
1616
Inboxes super_admin_list = 3;
17-
// The ED25519 private key used to sign commit log entries
18-
// Must match the first entry in the commit log to be valid
19-
optional bytes commit_log_signer = 4;
17+
// Top-level commit_log_signer removed in favor of attribute
18+
reserved 4;
19+
reserved "commit_log_signer";
2020
}
2121

2222
// Wrapper around a list of repeated Inbox Ids

proto/mls/message_contents/out_of_band.proto renamed to proto/mls/message_contents/oneshot.proto

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,19 @@ syntax = "proto3";
44

55
package xmtp.mls.message_contents;
66

7+
message OneshotMessage {
8+
oneof message_type {
9+
ReaddRequest readd_request = 1;
10+
}
11+
}
12+
713
// A request sent by an installation to recover from a fork. Other members
814
// may remove and readd that installation from the group.
915
// XIP: https://community.xmtp.org/t/xip-68-draft-automated-fork-recovery/951
1016
message ReaddRequest {
1117
bytes group_id = 1;
12-
uint64 commit_log_epoch = 2;
18+
// The sequence ID of the latest commit log entry at the time the request
19+
// is sent; used to disambiguate cases where an installation forks
20+
// and is readded multiple times.
21+
uint64 latest_commit_sequence_id = 2;
1322
}

0 commit comments

Comments
 (0)