Skip to content

Commit

Permalink
Merge branch 'main' into nm/update-transcript-messages
Browse files Browse the repository at this point in the history
  • Loading branch information
neekolas committed May 19, 2024
2 parents 3c6b340 + 216f4b1 commit 3e84e18
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 65 deletions.
15 changes: 15 additions & 0 deletions proto/message_contents/private_preferences.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ message PrivatePreferencesAction {
repeated string wallet_addresses = 1;
}

// Allow V3 1:1 direct message (DM) access
message AllowInboxId {
// Add the given inbox id to the allow list
repeated string inbox_ids = 1;
}

// Deny (block) V3 1:1 direct message (DM) access
message DenyInboxId {
// Add the given inbox id to the deny list
repeated string inbox_ids = 1;
}


// Allow Group access
message AllowGroup {
// Add the given group_ids to the allow list
Expand All @@ -43,6 +56,8 @@ message PrivatePreferencesAction {
DenyAddress deny_address = 2;
AllowGroup allow_group = 3;
DenyGroup deny_group = 4;
AllowInboxId allow_inbox_id = 5;
DenyInboxId deny_inbox_id = 6;
}
}

Expand Down
66 changes: 2 additions & 64 deletions proto/mls/message_contents/group_metadata.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Group metadata
// Group immutable metadata
syntax = "proto3";

package xmtp.mls.message_contents;
Expand All @@ -11,8 +11,7 @@ message GroupMetadataV1 {
ConversationType conversation_type = 1;
// This will be removed soon
string creator_account_address = 2;
PolicySet policies = 3;
string creator_inbox_id = 4;
string creator_inbox_id = 3;
}

// Defines the type of conversation
Expand All @@ -22,64 +21,3 @@ enum ConversationType {
CONVERSATION_TYPE_DM = 2;
CONVERSATION_TYPE_SYNC = 3;
}

// The set of policies that govern the group
message PolicySet {
MembershipPolicy add_member_policy = 1;
MembershipPolicy remove_member_policy = 2;
map<string, MetadataPolicy> update_metadata_policy = 3;
}

// A policy that governs adding/removing members or installations
message MembershipPolicy {
// Base policy
enum BasePolicy {
BASE_POLICY_UNSPECIFIED = 0;
BASE_POLICY_ALLOW = 1;
BASE_POLICY_DENY = 2;
BASE_POLICY_ALLOW_IF_ACTOR_CREATOR = 3;
}

// Combine multiple policies. All must evaluate to true
message AndCondition {
repeated MembershipPolicy policies = 1;
}

// Combine multiple policies. Any must evaluate to true
message AnyCondition {
repeated MembershipPolicy policies = 1;
}

oneof kind {
BasePolicy base = 1;
AndCondition and_condition = 2;
AnyCondition any_condition = 3;
}
}

// A policy that governs updating metadata
message MetadataPolicy {
// Base policy
enum MetadataBasePolicy {
METADATA_BASE_POLICY_UNSPECIFIED = 0;
METADATA_BASE_POLICY_ALLOW = 1;
METADATA_BASE_POLICY_DENY = 2;
METADATA_BASE_POLICY_ALLOW_IF_ACTOR_CREATOR = 3;
}

// Combine multiple policies. All must evaluate to true
message AndCondition {
repeated MetadataPolicy policies = 1;
}

// Combine multiple policies. Any must evaluate to true
message AnyCondition {
repeated MetadataPolicy policies = 1;
}

oneof kind {
MetadataBasePolicy base = 1;
AndCondition and_condition = 2;
AnyCondition any_condition = 3;
}
}
13 changes: 12 additions & 1 deletion proto/mls/message_contents/group_mutable_metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@ package xmtp.mls.message_contents;
option go_package = "github.com/xmtp/proto/v3/go/mls/message_contents";
option java_package = "org.xmtp.proto.mls.message.contents";


// Message for group mutable metadata
message GroupMutableMetadataV1 {
map<string, string> attributes = 1; // Map to store various metadata attributes
// Map to store various metadata attributes (Group name, etc.)
map<string, string> attributes = 1;
Inboxes admin_list = 2;
// Creator starts as only super_admin
// Only super_admin can add/remove other super_admin
Inboxes super_admin_list = 3;
}

// Wrapper around a list of repeated Inbox Ids
message Inboxes {
repeated string inbox_ids = 1;
}
105 changes: 105 additions & 0 deletions proto/mls/message_contents/group_permissions.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// Group mutable permissions metadata
syntax = "proto3";

package xmtp.mls.message_contents;

option go_package = "github.com/xmtp/proto/v3/go/mls/message_contents";
option java_package = "org.xmtp.proto.mls.message.contents";

// Message for group mutable metadata
message GroupMutablePermissionsV1 {
PolicySet policies = 1;
}

// The set of policies that govern the group
message PolicySet {
MembershipPolicy add_member_policy = 1;
MembershipPolicy remove_member_policy = 2;
map<string, MetadataPolicy> update_metadata_policy = 3;
PermissionsUpdatePolicy add_admin_policy = 4;
PermissionsUpdatePolicy remove_admin_policy = 5;
PermissionsUpdatePolicy update_permissions_policy = 6;
}

// A policy that governs adding/removing members or installations
message MembershipPolicy {
// Base policy
enum BasePolicy {
BASE_POLICY_UNSPECIFIED = 0;
BASE_POLICY_ALLOW = 1;
BASE_POLICY_DENY = 2;
BASE_POLICY_ALLOW_IF_ADMIN_OR_SUPER_ADMIN = 3;
BASE_POLICY_ALLOW_IF_SUPER_ADMIN = 4;
}

// Combine multiple policies. All must evaluate to true
message AndCondition {
repeated MembershipPolicy policies = 1;
}

// Combine multiple policies. Any must evaluate to true
message AnyCondition {
repeated MembershipPolicy policies = 1;
}

oneof kind {
BasePolicy base = 1;
AndCondition and_condition = 2;
AnyCondition any_condition = 3;
}
}

// A policy that governs updating metadata
message MetadataPolicy {
// Base policy
enum MetadataBasePolicy {
METADATA_BASE_POLICY_UNSPECIFIED = 0;
METADATA_BASE_POLICY_ALLOW = 1;
METADATA_BASE_POLICY_DENY = 2;
METADATA_BASE_POLICY_ALLOW_IF_ADMIN = 3;
METADATA_BASE_POLICY_ALLOW_IF_SUPER_ADMIN = 4;
}

// Combine multiple policies. All must evaluate to true
message AndCondition {
repeated MetadataPolicy policies = 1;
}

// Combine multiple policies. Any must evaluate to true
message AnyCondition {
repeated MetadataPolicy policies = 1;
}

oneof kind {
MetadataBasePolicy base = 1;
AndCondition and_condition = 2;
AnyCondition any_condition = 3;
}
}

// A policy that governs updating permissions
message PermissionsUpdatePolicy {
// Base policy
enum PermissionsBasePolicy {
PERMISSIONS_BASE_POLICY_UNSPECIFIED = 0;
PERMISSIONS_BASE_POLICY_DENY = 1;
PERMISSIONS_BASE_POLICY_ALLOW_IF_ADMIN = 2;
PERMISSIONS_BASE_POLICY_ALLOW_IF_SUPER_ADMIN = 3;
}

// Combine multiple policies. All must evaluate to true
message AndCondition {
repeated PermissionsUpdatePolicy policies = 1;
}

// Combine multiple policies. Any must evaluate to true
message AnyCondition {
repeated PermissionsUpdatePolicy policies = 1;
}

oneof kind {
PermissionsBasePolicy base = 1;
AndCondition and_condition = 2;
AnyCondition any_condition = 3;
}
}
47 changes: 47 additions & 0 deletions proto/mls_validation/v1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package xmtp.mls_validation.v1;

import "identity/associations/association.proto";
import "identity/credential.proto";

option go_package = "github.com/xmtp/proto/v3/go/mls_validation/v1";

Expand All @@ -16,6 +17,27 @@ service ValidationApi {

// Gets the final association state for a batch of identity updates
rpc GetAssociationState(GetAssociationStateRequest) returns (GetAssociationStateResponse) {}

// Validates InboxID key packages and returns credential information for them, without checking
// whether an InboxId <> InstallationPublicKey pair is really valid.
rpc ValidateInboxIdKeyPackages(ValidateKeyPackagesRequest) returns (ValidateInboxIdKeyPackagesResponse) {}

// Validate an InboxID Key Package
// need public key possibly
rpc ValidateInboxIds(ValidateInboxIdsRequest) returns (ValidateInboxIdsResponse) {}
}

// Validates a Inbox-ID Key Package Type
message ValidateInboxIdKeyPackagesResponse {
// one response corresponding to information about one key package
message Response {
bool is_ok = 1;
string error_message = 2;
xmtp.identity.MlsCredential credential = 3;
bytes installation_public_key = 4;
}

repeated Response responses = 1;
}

// Contains a batch of serialized Key Packages
Expand Down Expand Up @@ -78,3 +100,28 @@ message GetAssociationStateResponse {
xmtp.identity.associations.AssociationState association_state = 1;
xmtp.identity.associations.AssociationStateDiff state_diff = 2;
}

// Request to validate an InboxID with the backend service. Ensures an Inbox Id <> Installation key are valid.
message ValidateInboxIdsRequest {
// a single validation request
message ValidationRequest {
xmtp.identity.MlsCredential credential = 1;
bytes installation_public_key = 2;
repeated xmtp.identity.associations.IdentityUpdate identity_updates = 3;
}

// list of validation requests
repeated ValidationRequest requests = 1;
}

// Response to ValidateInboxIdRequest
message ValidateInboxIdsResponse {
// a single validation response
message ValidationResponse {
bool is_ok = 1;
string error_message = 2;
string inbox_id = 3;
}
// List of validation responses
repeated ValidationResponse responses = 1;
}

0 comments on commit 3e84e18

Please sign in to comment.