Skip to content

Commit

Permalink
Merge pull request #160 from xmtp/insipx/api-mls-validation-service
Browse files Browse the repository at this point in the history
feat: AssociationState Protos for Validation Service
  • Loading branch information
insipx authored Apr 22, 2024
2 parents 06a5f87 + c09b4fb commit 82a05e5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
26 changes: 26 additions & 0 deletions proto/identity/associations/association.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -72,3 +78,23 @@ 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;
}

/// state diff between two final AssociationStates
message AssociationStateDiff {
repeated MemberIdentifier new_members = 1;
repeated MemberIdentifier removed_members = 2;
}
19 changes: 19 additions & 0 deletions proto/mls_validation/v1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -11,6 +13,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
Expand Down Expand Up @@ -59,3 +64,17 @@ message ValidateGroupMessagesResponse {

repeated ValidationResponse responses = 1;
}

// Request to get a final association state for identity updates
message GetAssociationStateRequest {
// List of identity updates
repeated xmtp.identity.associations.IdentityUpdate old_updates = 1;
repeated xmtp.identity.associations.IdentityUpdate new_updates = 2;
}

// 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;
}

0 comments on commit 82a05e5

Please sign in to comment.