From 55122bab503937c895b5be78a5f8406277044fde Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Wed, 10 Apr 2024 16:24:04 -0400 Subject: [PATCH 1/8] draft protos for mls-api --- proto/identity/associations/association.proto | 6 ++++ proto/mls_validation/v1/service.proto | 34 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/proto/identity/associations/association.proto b/proto/identity/associations/association.proto index 12becb26..96c5949e 100644 --- a/proto/identity/associations/association.proto +++ b/proto/identity/associations/association.proto @@ -16,6 +16,12 @@ message MemberIdentifier { } } +// single member that optionally indicates the member that added them +message Member { + MemberIdentifier identifier = 1; + optional MemberIdentifier added_by_entity = 2; +} + // The first entry of any XID log. The XID must be deterministically derivable // from the address and nonce. // The recovery address defaults to the initial associated_address unless diff --git a/proto/mls_validation/v1/service.proto b/proto/mls_validation/v1/service.proto index 7cff4d27..de2ead95 100644 --- a/proto/mls_validation/v1/service.proto +++ b/proto/mls_validation/v1/service.proto @@ -59,3 +59,37 @@ message ValidateGroupMessagesResponse { repeated ValidationResponse responses = 1; } + +// Request to get a final association state for identity updates +message GetAssociationStateRequest { + // a single identity update + message IdentityUpdate { + uint64 client_timestamp_ns = 1; + // single action for an identity update + message Action { + oneof kind { + xmtp.identity.CreateInbox create_inbox = 1; + xmtp.identity.AddAssociation add_association = 2; + xmtp.identity.RevokeAssociation revoke_association = 3; + xmtp.identity.ChangeRecoveryAddress change_recovery_address = 4; + } + } + } + + repeated IdentityUpdate updates = 1; +} + +// Map of members belonging to an inbox_id +message MemberMap { + xmtp.identity.MemberIdentifier key = 1; + xmtp.identity.Member value = 2; +} + +// Reponse to GetAssociationStateRequest, containing the final association state +// for an InboxID +message GetAssociationStateResponse { + string inbox_id = 1; + repeated MemberMap members = 2; + string recovery_address = 3; + repeated bytes seen_signatures = 4; +} From 2604641639d5c53756ecb1e49578d2f84a4ccc6f Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Wed, 10 Apr 2024 16:28:36 -0400 Subject: [PATCH 2/8] rpc service --- proto/mls_validation/v1/service.proto | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proto/mls_validation/v1/service.proto b/proto/mls_validation/v1/service.proto index de2ead95..8329d7ff 100644 --- a/proto/mls_validation/v1/service.proto +++ b/proto/mls_validation/v1/service.proto @@ -11,6 +11,9 @@ service ValidationApi { // Validates and parses a group message and returns relevant details rpc ValidateGroupMessages(ValidateGroupMessagesRequest) returns (ValidateGroupMessagesResponse) {} + + // Gets the final association state for a batch of identity updates + rpc GetAssociationState(GetAssociationStateRequest) returns (GetAssociationStateResponse) {} } // Contains a batch of serialized Key Packages From 5414d8d77dbbe6f9f961aac8e1c3004eab9b69d3 Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Thu, 11 Apr 2024 13:04:39 -0400 Subject: [PATCH 3/8] Import association proto into mls_service proto --- proto/mls_validation/v1/service.proto | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/proto/mls_validation/v1/service.proto b/proto/mls_validation/v1/service.proto index 8329d7ff..ccbaec6b 100644 --- a/proto/mls_validation/v1/service.proto +++ b/proto/mls_validation/v1/service.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package xmtp.mls_validation.v1; +import "identity/associations/association.proto"; + option go_package = "github.com/xmtp/proto/v3/go/mls_validation/v1"; // RPCs for the new MLS API @@ -71,10 +73,10 @@ message GetAssociationStateRequest { // single action for an identity update message Action { oneof kind { - xmtp.identity.CreateInbox create_inbox = 1; - xmtp.identity.AddAssociation add_association = 2; - xmtp.identity.RevokeAssociation revoke_association = 3; - xmtp.identity.ChangeRecoveryAddress change_recovery_address = 4; + xmtp.identity.associations.CreateInbox create_inbox = 1; + xmtp.identity.associations.AddAssociation add_association = 2; + xmtp.identity.associations.RevokeAssociation revoke_association = 3; + xmtp.identity.associations.ChangeRecoveryAddress change_recovery_address = 4; } } } @@ -84,8 +86,8 @@ message GetAssociationStateRequest { // Map of members belonging to an inbox_id message MemberMap { - xmtp.identity.MemberIdentifier key = 1; - xmtp.identity.Member value = 2; + xmtp.identity.associations.MemberIdentifier key = 1; + xmtp.identity.associations.Member value = 2; } // Reponse to GetAssociationStateRequest, containing the final association state From f561f62bd6f35488cde7804b856aec73b0ede8ac Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Thu, 11 Apr 2024 14:32:50 -0400 Subject: [PATCH 4/8] reuse types --- proto/mls_validation/v1/service.proto | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/proto/mls_validation/v1/service.proto b/proto/mls_validation/v1/service.proto index ccbaec6b..0bc458d0 100644 --- a/proto/mls_validation/v1/service.proto +++ b/proto/mls_validation/v1/service.proto @@ -67,21 +67,8 @@ message ValidateGroupMessagesResponse { // Request to get a final association state for identity updates message GetAssociationStateRequest { - // a single identity update - message IdentityUpdate { - uint64 client_timestamp_ns = 1; - // single action for an identity update - message Action { - oneof kind { - xmtp.identity.associations.CreateInbox create_inbox = 1; - xmtp.identity.associations.AddAssociation add_association = 2; - xmtp.identity.associations.RevokeAssociation revoke_association = 3; - xmtp.identity.associations.ChangeRecoveryAddress change_recovery_address = 4; - } - } - } - - repeated IdentityUpdate updates = 1; + // List of identity updates + repeated xmtp.identity.associations.IdentityUpdate updates = 1; } // Map of members belonging to an inbox_id From faf67a0e51a5eebd0a5b10443cb2452a4ddcfa7a Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Wed, 17 Apr 2024 13:43:02 -0400 Subject: [PATCH 5/8] split up association state --- proto/identity/associations/association.proto | 14 ++++++++++++++ proto/mls_validation/v1/service.proto | 11 +---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/proto/identity/associations/association.proto b/proto/identity/associations/association.proto index 96c5949e..682ccaf1 100644 --- a/proto/identity/associations/association.proto +++ b/proto/identity/associations/association.proto @@ -78,3 +78,17 @@ message IdentityUpdate { uint64 client_timestamp_ns = 2; string inbox_id = 3; } + +// Map of members belonging to an inbox_id +message MemberMap { + MemberIdentifier key = 1; + Member value = 2; +} + +// A final association state resulting from multiple `IdentityUpdates` +message AssociationState { + string inbox_id = 1; + repeated MemberMap members = 2; + string recovery_address = 3; + repeated bytes seen_signatures = 4; +} diff --git a/proto/mls_validation/v1/service.proto b/proto/mls_validation/v1/service.proto index 0bc458d0..d2fafe45 100644 --- a/proto/mls_validation/v1/service.proto +++ b/proto/mls_validation/v1/service.proto @@ -71,17 +71,8 @@ message GetAssociationStateRequest { repeated xmtp.identity.associations.IdentityUpdate updates = 1; } -// Map of members belonging to an inbox_id -message MemberMap { - xmtp.identity.associations.MemberIdentifier key = 1; - xmtp.identity.associations.Member value = 2; -} - // Reponse to GetAssociationStateRequest, containing the final association state // for an InboxID message GetAssociationStateResponse { - string inbox_id = 1; - repeated MemberMap members = 2; - string recovery_address = 3; - repeated bytes seen_signatures = 4; + xmtp.identity.associations.AssociationState association_state = 1; } From ef5fa74d6c8f4fd77a440b78fbfa027e7b2dbb97 Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Wed, 17 Apr 2024 16:37:14 -0400 Subject: [PATCH 6/8] protos --- proto/identity/associations/association.proto | 6 ++++++ proto/mls_validation/v1/service.proto | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/proto/identity/associations/association.proto b/proto/identity/associations/association.proto index 682ccaf1..e59a136e 100644 --- a/proto/identity/associations/association.proto +++ b/proto/identity/associations/association.proto @@ -92,3 +92,9 @@ message AssociationState { string recovery_address = 3; repeated bytes seen_signatures = 4; } + +/// state diff between two final AssociationStates +message AssociationStateDiff { + repeated MemberIdentifier new_members = 1; + repeated MemberIdentifier removed_members = 2; +} diff --git a/proto/mls_validation/v1/service.proto b/proto/mls_validation/v1/service.proto index d2fafe45..cbb504c1 100644 --- a/proto/mls_validation/v1/service.proto +++ b/proto/mls_validation/v1/service.proto @@ -69,10 +69,12 @@ message ValidateGroupMessagesResponse { message GetAssociationStateRequest { // List of identity updates repeated xmtp.identity.associations.IdentityUpdate updates = 1; + old_sequence_id uint64 = 2; } -// Reponse to GetAssociationStateRequest, containing the final association state +// Response to GetAssociationStateRequest, containing the final association state // for an InboxID message GetAssociationStateResponse { xmtp.identity.associations.AssociationState association_state = 1; + xmtp.identity.associations.AssociationStateDiff state_diff = 2; } From cb6857cac3afbf38ce7ff6951b5f27db59ce7408 Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Wed, 17 Apr 2024 16:39:08 -0400 Subject: [PATCH 7/8] typo --- proto/mls_validation/v1/service.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/mls_validation/v1/service.proto b/proto/mls_validation/v1/service.proto index cbb504c1..c04fb6ba 100644 --- a/proto/mls_validation/v1/service.proto +++ b/proto/mls_validation/v1/service.proto @@ -69,7 +69,7 @@ message ValidateGroupMessagesResponse { message GetAssociationStateRequest { // List of identity updates repeated xmtp.identity.associations.IdentityUpdate updates = 1; - old_sequence_id uint64 = 2; + uint64 old_sequence_id = 2; } // Response to GetAssociationStateRequest, containing the final association state From c09b4fb5816c63384e51e562b797e31387cda7c2 Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Thu, 18 Apr 2024 11:01:14 -0400 Subject: [PATCH 8/8] old<>new --- proto/mls_validation/v1/service.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proto/mls_validation/v1/service.proto b/proto/mls_validation/v1/service.proto index c04fb6ba..5a0482bd 100644 --- a/proto/mls_validation/v1/service.proto +++ b/proto/mls_validation/v1/service.proto @@ -68,8 +68,8 @@ message ValidateGroupMessagesResponse { // Request to get a final association state for identity updates message GetAssociationStateRequest { // List of identity updates - repeated xmtp.identity.associations.IdentityUpdate updates = 1; - uint64 old_sequence_id = 2; + repeated xmtp.identity.associations.IdentityUpdate old_updates = 1; + repeated xmtp.identity.associations.IdentityUpdate new_updates = 2; } // Response to GetAssociationStateRequest, containing the final association state