From 18bcab78ff66cee0fae89572a11855d97ec24046 Mon Sep 17 00:00:00 2001 From: Richard Hua Date: Tue, 16 Apr 2024 18:09:33 -0700 Subject: [PATCH 1/9] GetInboxLogs --- pkg/identity/api/v1/service.go | 3 ++- pkg/mls/store/models.go | 9 +++++++ pkg/mls/store/store.go | 49 ++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/pkg/identity/api/v1/service.go b/pkg/identity/api/v1/service.go index a6b61a6f..20dff925 100644 --- a/pkg/identity/api/v1/service.go +++ b/pkg/identity/api/v1/service.go @@ -58,6 +58,7 @@ Start transaction End transaction */ func (s *Service) PublishIdentityUpdate(ctx context.Context, req *api.PublishIdentityUpdateRequest) (*api.PublishIdentityUpdateResponse, error) { + // How to run stuff in middle of transaction? return nil, status.Errorf(codes.Unimplemented, "unimplemented") } @@ -67,7 +68,7 @@ func (s *Service) GetIdentityUpdates(ctx context.Context, req *api.GetIdentityUp 1. Query the inbox_log table for the inbox_id, ordering by sequence_id 2. Return all of the entries */ - return nil, status.Errorf(codes.Unimplemented, "unimplemented") + return s.store.GetInboxLogs(ctx, req) } func (s *Service) GetInboxIds(ctx context.Context, req *api.GetInboxIdsRequest) (*api.GetInboxIdsResponse, error) { diff --git a/pkg/mls/store/models.go b/pkg/mls/store/models.go index 83ea0d09..b6255c0e 100644 --- a/pkg/mls/store/models.go +++ b/pkg/mls/store/models.go @@ -6,6 +6,15 @@ import ( "github.com/uptrace/bun" ) +type InboxLogEntry struct { + bun.BaseModel `bun:"table:inbox_log"` + + SequenceId uint64 + InboxId string + ServerTimestampNs int64 + IdentityUpdateProto []byte +} + type Installation struct { bun.BaseModel `bun:"table:installations"` diff --git a/pkg/mls/store/store.go b/pkg/mls/store/store.go index 64c94b32..bce69104 100644 --- a/pkg/mls/store/store.go +++ b/pkg/mls/store/store.go @@ -11,8 +11,11 @@ import ( "github.com/uptrace/bun" "github.com/uptrace/bun/migrate" migrations "github.com/xmtp/xmtp-node-go/pkg/migrations/mls" + identity "github.com/xmtp/xmtp-node-go/pkg/proto/identity/api/v1" + "github.com/xmtp/xmtp-node-go/pkg/proto/identity/associations" mlsv1 "github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1" "go.uber.org/zap" + "google.golang.org/protobuf/proto" ) const maxPageSize = 100 @@ -23,7 +26,13 @@ type Store struct { db *bun.DB } +type IdentityStore interface { + GetInboxLogs(ctx context.Context, req *identity.GetIdentityUpdatesRequest) (*identity.GetIdentityUpdatesResponse, error) +} + type MlsStore interface { + IdentityStore + CreateInstallation(ctx context.Context, installationId []byte, walletAddress string, credentialIdentity, keyPackage []byte, expiration uint64) error UpdateKeyPackage(ctx context.Context, installationId, keyPackage []byte, expiration uint64) error FetchKeyPackages(ctx context.Context, installationIds [][]byte) ([]*Installation, error) @@ -53,6 +62,46 @@ func New(ctx context.Context, config Config) (*Store, error) { return s, nil } +func (s *Store) GetInboxLogs(ctx context.Context, batched_req *identity.GetIdentityUpdatesRequest) (*identity.GetIdentityUpdatesResponse, error) { + reqs := batched_req.GetRequests() + resps := make([]*identity.GetIdentityUpdatesResponse_Response, len(reqs)) + + for i, req := range reqs { + inbox_log_entries := make([]*InboxLogEntry, 0) + + err := s.db.NewSelect(). + Model(&inbox_log_entries). + Where("sequence_id > ?", req.GetSequenceId()). + Where("inbox_id = ?", req.GetInboxId()). + Scan(ctx) + if err != nil { + return nil, err + } + + updates := make([]*identity.GetIdentityUpdatesResponse_IdentityUpdateLog, len(inbox_log_entries)) + for j, entry := range inbox_log_entries { + identity_update := &associations.IdentityUpdate{} + if err := proto.Unmarshal(entry.IdentityUpdateProto, identity_update); err != nil { + return nil, err + } + updates[j] = &identity.GetIdentityUpdatesResponse_IdentityUpdateLog{ + SequenceId: entry.SequenceId, + ServerTimestampNs: uint64(entry.ServerTimestampNs), + Update: identity_update, + } + } + + resps[i] = &identity.GetIdentityUpdatesResponse_Response{ + InboxId: req.GetInboxId(), + Updates: updates, + } + } + + return &identity.GetIdentityUpdatesResponse{ + Responses: resps, + }, nil +} + // Creates the installation and last resort key package func (s *Store) CreateInstallation(ctx context.Context, installationId []byte, walletAddress string, credentialIdentity, keyPackage []byte, expiration uint64) error { createdAt := nowNs() From 0d4c8ab0d8ce8eb460ddb54cfe6e173cc5bf0bca Mon Sep 17 00:00:00 2001 From: Richard Hua Date: Wed, 17 Apr 2024 17:02:36 -0700 Subject: [PATCH 2/9] Implement PublishIdentityUpdate --- pkg/identity/api/v1/service.go | 3 +- pkg/mls/store/store.go | 64 ++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/pkg/identity/api/v1/service.go b/pkg/identity/api/v1/service.go index c1f6a40b..fd111865 100644 --- a/pkg/identity/api/v1/service.go +++ b/pkg/identity/api/v1/service.go @@ -75,8 +75,7 @@ Start transaction (SERIALIZABLE isolation level) End transaction */ func (s *Service) PublishIdentityUpdate(ctx context.Context, req *api.PublishIdentityUpdateRequest) (*api.PublishIdentityUpdateResponse, error) { - // How to run stuff in middle of transaction? - return nil, status.Errorf(codes.Unimplemented, "unimplemented") + return s.store.PublishIdentityUpdate(ctx, req) } func (s *Service) GetIdentityUpdates(ctx context.Context, req *api.GetIdentityUpdatesRequest) (*api.GetIdentityUpdatesResponse, error) { diff --git a/pkg/mls/store/store.go b/pkg/mls/store/store.go index bce69104..14f1564c 100644 --- a/pkg/mls/store/store.go +++ b/pkg/mls/store/store.go @@ -3,6 +3,7 @@ package store import ( "context" "crypto/sha256" + "database/sql" "errors" "sort" "strings" @@ -27,6 +28,7 @@ type Store struct { } type IdentityStore interface { + PublishIdentityUpdate(ctx context.Context, req *identity.PublishIdentityUpdateRequest) (*identity.PublishIdentityUpdateResponse, error) GetInboxLogs(ctx context.Context, req *identity.GetIdentityUpdatesRequest) (*identity.GetIdentityUpdatesResponse, error) } @@ -62,6 +64,67 @@ func New(ctx context.Context, config Config) (*Store, error) { return s, nil } +func (s *Store) PublishIdentityUpdate(ctx context.Context, req *identity.PublishIdentityUpdateRequest) (*identity.PublishIdentityUpdateResponse, error) { + new_update := req.GetIdentityUpdate() + if new_update == nil { + return nil, errors.New("IdentityUpdate is required") + } + + if err := s.db.RunInTx(ctx, &sql.TxOptions{Isolation: sql.LevelSerializable}, func(ctx context.Context, tx bun.Tx) error { + inbox_log_entries := make([]*InboxLogEntry, 0) + + if err := s.db.NewSelect(). + Model(&inbox_log_entries). + Where("inbox_id = ?", new_update.GetInboxId()). + Order("sequence_id ASC"). + For("UPDATE"). + Scan(ctx); err != nil { + return err + } + + if len(inbox_log_entries) >= 256 { + return errors.New("inbox log is full") + } + + updates := make([]*associations.IdentityUpdate, 0, len(inbox_log_entries)+1) + for _, log := range inbox_log_entries { + identity_update := &associations.IdentityUpdate{} + proto.Unmarshal(log.IdentityUpdateProto, identity_update) + updates = append(updates, identity_update) + } + _ = append(updates, new_update) + + // TODO: Validate the updates, and abort transaction if failed + + proto_bytes, err := proto.Marshal(new_update) + if err != nil { + return err + } + + new_entry := InboxLogEntry{ + InboxId: new_update.GetInboxId(), + ServerTimestampNs: nowNs(), + IdentityUpdateProto: proto_bytes, + } + + _, err = s.db.NewInsert(). + Model(&new_entry). + Returning("sequence_id"). + Exec(ctx) + if err != nil { + return err + } + + // TODO: Insert or update the address_log table using sequence_id + + return nil + }); err != nil { + return nil, err + } + + return &identity.PublishIdentityUpdateResponse{}, nil +} + func (s *Store) GetInboxLogs(ctx context.Context, batched_req *identity.GetIdentityUpdatesRequest) (*identity.GetIdentityUpdatesResponse, error) { reqs := batched_req.GetRequests() resps := make([]*identity.GetIdentityUpdatesResponse_Response, len(reqs)) @@ -73,6 +136,7 @@ func (s *Store) GetInboxLogs(ctx context.Context, batched_req *identity.GetIdent Model(&inbox_log_entries). Where("sequence_id > ?", req.GetSequenceId()). Where("inbox_id = ?", req.GetInboxId()). + Order("sequence_id ASC"). Scan(ctx) if err != nil { return nil, err From cf504347eed89227b7d4aaddf8fe45bcb523b782 Mon Sep 17 00:00:00 2001 From: Richard Hua Date: Fri, 19 Apr 2024 16:30:49 -0700 Subject: [PATCH 3/9] Add tests --- pkg/identity/api/v1/service_test.go | 174 ++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 pkg/identity/api/v1/service_test.go diff --git a/pkg/identity/api/v1/service_test.go b/pkg/identity/api/v1/service_test.go new file mode 100644 index 00000000..3e060bdc --- /dev/null +++ b/pkg/identity/api/v1/service_test.go @@ -0,0 +1,174 @@ +package api + +import ( + "context" + "testing" + "time" + + "github.com/nats-io/nats-server/v2/server" + "github.com/stretchr/testify/require" + "github.com/uptrace/bun" + mlsstore "github.com/xmtp/xmtp-node-go/pkg/mls/store" + identity "github.com/xmtp/xmtp-node-go/pkg/proto/identity/api/v1" + associations "github.com/xmtp/xmtp-node-go/pkg/proto/identity/associations" + test "github.com/xmtp/xmtp-node-go/pkg/testing" +) + +func newTestService(t *testing.T, ctx context.Context) (*Service, *bun.DB, func()) { + log := test.NewLog(t) + db, _, mlsDbCleanup := test.NewMLSDB(t) + store, err := mlsstore.New(ctx, mlsstore.Config{ + Log: log, + DB: db, + }) + require.NoError(t, err) + natsServer, err := server.NewServer(&server.Options{ + Port: server.RANDOM_PORT, + }) + require.NoError(t, err) + go natsServer.Start() + if !natsServer.ReadyForConnections(4 * time.Second) { + t.Fail() + } + + svc, err := NewService(log, store) + require.NoError(t, err) + + return svc, db, func() { + svc.Close() + mlsDbCleanup() + } +} + +func makeCreateInbox(address string) *associations.IdentityAction { + return &associations.IdentityAction{ + Kind: &associations.IdentityAction_CreateInbox{ + CreateInbox: &associations.CreateInbox{ + InitialAddress: address, + Nonce: 0, + InitialAddressSignature: &associations.Signature{}, + }, + }, + } +} +func makeAddAssociation() *associations.IdentityAction { + return &associations.IdentityAction{ + Kind: &associations.IdentityAction_Add{ + Add: &associations.AddAssociation{ + NewMemberIdentifier: &associations.MemberIdentifier{}, + ExistingMemberSignature: &associations.Signature{}, + NewMemberSignature: &associations.Signature{}, + }, + }, + } +} +func makeRevokeAssociation() *associations.IdentityAction { + return &associations.IdentityAction{ + Kind: &associations.IdentityAction_Revoke{ + Revoke: &associations.RevokeAssociation{ + MemberToRevoke: &associations.MemberIdentifier{}, + RecoveryAddressSignature: &associations.Signature{}, + }, + }, + } +} +func makeChangeRecoveryAddress() *associations.IdentityAction { + return &associations.IdentityAction{ + Kind: &associations.IdentityAction_ChangeRecoveryAddress{ + ChangeRecoveryAddress: &associations.ChangeRecoveryAddress{ + NewRecoveryAddress: "", + ExistingRecoveryAddressSignature: &associations.Signature{}, + }, + }, + } +} +func makeIdentityUpdate(inbox_id string, actions ...*associations.IdentityAction) *associations.IdentityUpdate { + return &associations.IdentityUpdate{ + InboxId: inbox_id, + ClientTimestampNs: 0, + Actions: actions, + } +} + +func publishIdentityUpdateRequest(inbox_id string, actions ...*associations.IdentityAction) *identity.PublishIdentityUpdateRequest { + return &identity.PublishIdentityUpdateRequest{ + IdentityUpdate: makeIdentityUpdate(inbox_id, actions...), + } +} + +func makeUpdateRequest(inbox_id string, sequence_id uint64) *identity.GetIdentityUpdatesRequest_Request { + return &identity.GetIdentityUpdatesRequest_Request{ + InboxId: inbox_id, + SequenceId: sequence_id, + } +} + +func getIdentityUpdatesRequest(requests ...*identity.GetIdentityUpdatesRequest_Request) *identity.GetIdentityUpdatesRequest { + return &identity.GetIdentityUpdatesRequest{ + Requests: requests, + } +} + +/* +* +Tests: +- Can't publish more than 256 updates +- Publishes through one are read in the other(s) +- Ordering is preserved +- Concurrency? +- Invalid updates are rejected +*/ + +func TestPublishedUpdatesCanBeRead(t *testing.T) { + ctx := context.Background() + svc, _, cleanup := newTestService(t, ctx) + defer cleanup() + + inbox_id := "test_inbox" + address := "test_address" + + _, err := svc.PublishIdentityUpdate(ctx, publishIdentityUpdateRequest(inbox_id, makeCreateInbox(address))) + require.NoError(t, err) + + res, err := svc.GetIdentityUpdates(ctx, getIdentityUpdatesRequest(makeUpdateRequest(inbox_id, 0))) + require.NoError(t, err) + + require.Len(t, res.Responses, 1) + require.Equal(t, res.Responses[0].InboxId, inbox_id) + require.Len(t, res.Responses[0].Updates, 1) + require.Len(t, res.Responses[0].Updates[0].Update.Actions, 1) + require.Equal(t, res.Responses[0].Updates[0].Update.Actions[0].GetCreateInbox().InitialAddress, address) +} + +// func TestInboxSizeLimit(t *testing.T) { +// ctx := context.Background() +// svc, mlsDb, cleanup := newTestService(t, ctx) +// defer cleanup() +// +// inbox_id := "test_inbox" +// address := "test_address" +// +// request := makeIdentityUpdateRequest(inbox_id, makeCreateInbox(address)) +// svc.PublishIdentityUpdate(ctx, makeIdentityUpdateRequest(inbox_id, makeCreateInbox(address))) +// +// installationId := test.RandomBytes(32) +// accountAddress := test.RandomString(32) +// +// mlsValidationService.mockValidateKeyPackages(installationId, accountAddress) +// +// res, err := svc.RegisterInstallation(ctx, &mlsv1.RegisterInstallationRequest{ +// KeyPackage: &mlsv1.KeyPackageUpload{ +// KeyPackageTlsSerialized: []byte("test"), +// }, +// }) +// +// require.NoError(t, err) +// require.Equal(t, installationId, res.InstallationKey) +// +// installations := []mlsstore.Installation{} +// err = mlsDb.NewSelect().Model(&installations).Where("id = ?", installationId).Scan(ctx) +// require.NoError(t, err) +// +// require.Len(t, installations, 1) +// require.Equal(t, accountAddress, installations[0].WalletAddress) +// } From 5194d6cd6d419b7243c3fb3e8396a4c3a6eec813 Mon Sep 17 00:00:00 2001 From: Richard Hua Date: Fri, 19 Apr 2024 17:39:50 -0700 Subject: [PATCH 4/9] Automatic proto updates --- .../identity/associations/signature.pb.go | 12 +- pkg/proto/message_contents/frames.pb.go | 69 ++- pkg/proto/message_contents/invitation.pb.go | 339 ++++++++--- pkg/proto/mls/message_contents/content.pb.go | 190 +++---- .../message_contents/group_membership.pb.go | 173 ++++++ .../mls/message_contents/group_metadata.pb.go | 527 ++++++++++++++---- .../identity/api/v1/identity.swagger.json | 8 +- .../group_membership.swagger.json | 44 ++ 8 files changed, 1042 insertions(+), 320 deletions(-) create mode 100644 pkg/proto/mls/message_contents/group_membership.pb.go create mode 100644 pkg/proto/openapi/mls/message_contents/group_membership.swagger.json diff --git a/pkg/proto/identity/associations/signature.pb.go b/pkg/proto/identity/associations/signature.pb.go index 321b73cd..9a49794b 100644 --- a/pkg/proto/identity/associations/signature.pb.go +++ b/pkg/proto/identity/associations/signature.pb.go @@ -129,8 +129,8 @@ type Erc1271Signature struct { // CAIP-10 contract address // https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-10.md ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` - // Specify the block height to verify the signature against - BlockHeight int64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` + // Specify the block number to verify the signature against + BlockNumber uint64 `protobuf:"varint,2,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` // The actual signature bytes Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` } @@ -174,9 +174,9 @@ func (x *Erc1271Signature) GetContractAddress() string { return "" } -func (x *Erc1271Signature) GetBlockHeight() int64 { +func (x *Erc1271Signature) GetBlockNumber() uint64 { if x != nil { - return x.BlockHeight + return x.BlockNumber } return 0 } @@ -385,8 +385,8 @@ var file_identity_associations_signature_proto_rawDesc = []byte{ 0x72, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, - 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xbc, 0x01, 0x0a, 0x18, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, diff --git a/pkg/proto/message_contents/frames.pb.go b/pkg/proto/message_contents/frames.pb.go index 89e26f61..46dfb483 100644 --- a/pkg/proto/message_contents/frames.pb.go +++ b/pkg/proto/message_contents/frames.pb.go @@ -47,6 +47,8 @@ type FrameActionBody struct { InputText string `protobuf:"bytes,6,opt,name=input_text,json=inputText,proto3" json:"input_text,omitempty"` // A state serialized to a string (for example via JSON.stringify()). Maximum 4096 bytes. State string `protobuf:"bytes,7,opt,name=state,proto3" json:"state,omitempty"` + // A 0x wallet address + Address string `protobuf:"bytes,8,opt,name=address,proto3" json:"address,omitempty"` } func (x *FrameActionBody) Reset() { @@ -131,6 +133,13 @@ func (x *FrameActionBody) GetState() string { return "" } +func (x *FrameActionBody) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + // The outer payload that will be sent as the `messageBytes` in the // `trusted_data` part of the Frames message type FrameAction struct { @@ -210,7 +219,7 @@ var file_message_contents_frames_proto_rawDesc = []byte{ 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x95, 0x02, 0x0a, 0x0f, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaf, 0x02, 0x0a, 0x0f, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x21, 0x0a, 0x0c, @@ -228,34 +237,36 @@ var file_message_contents_frames_proto_rawDesc = []byte{ 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x54, 0x65, 0x78, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, - 0x61, 0x74, 0x65, 0x22, 0xd5, 0x01, 0x0a, 0x0b, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x12, 0x65, 0x0a, 0x18, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x5f, 0x70, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x53, 0x69, - 0x67, 0x6e, 0x65, 0x64, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x42, 0x75, 0x6e, - 0x64, 0x6c, 0x65, 0x52, 0x15, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x75, 0x62, 0x6c, 0x69, - 0x63, 0x4b, 0x65, 0x79, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x6f, 0x64, 0x79, 0x42, 0xd2, 0x01, 0x0a, 0x19, - 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x42, 0x0b, 0x46, 0x72, 0x61, 0x6d, 0x65, - 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2d, 0x6e, - 0x6f, 0x64, 0x65, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x73, 0xa2, 0x02, 0x03, 0x58, 0x4d, 0x58, 0xaa, 0x02, 0x14, 0x58, 0x6d, 0x74, 0x70, 0x2e, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xca, 0x02, - 0x14, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x73, 0xe2, 0x02, 0x20, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x58, 0x6d, 0x74, 0x70, 0x3a, - 0x3a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xd5, 0x01, + 0x0a, 0x0b, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x20, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x65, 0x0a, + 0x18, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, + 0x65, 0x79, 0x5f, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2c, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x15, 0x73, + 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x42, 0x75, + 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x42, 0x6f, 0x64, 0x79, 0x42, 0xd2, 0x01, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x6d, + 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x73, 0x42, 0x0b, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, + 0x6d, 0x74, 0x70, 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2d, 0x67, 0x6f, + 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xa2, 0x02, 0x03, 0x58, 0x4d, + 0x58, 0xaa, 0x02, 0x14, 0x58, 0x6d, 0x74, 0x70, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xca, 0x02, 0x14, 0x58, 0x6d, 0x74, 0x70, 0x5c, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xe2, + 0x02, 0x20, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x15, 0x58, 0x6d, 0x74, 0x70, 0x3a, 0x3a, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/pkg/proto/message_contents/invitation.pb.go b/pkg/proto/message_contents/invitation.pb.go index 33409240..d4e61f5c 100644 --- a/pkg/proto/message_contents/invitation.pb.go +++ b/pkg/proto/message_contents/invitation.pb.go @@ -24,6 +24,53 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// Version of consent proof payload +type ConsentProofPayloadVersion int32 + +const ( + ConsentProofPayloadVersion_CONSENT_PROOF_PAYLOAD_VERSION_UNSPECIFIED ConsentProofPayloadVersion = 0 + ConsentProofPayloadVersion_CONSENT_PROOF_PAYLOAD_VERSION_1 ConsentProofPayloadVersion = 1 +) + +// Enum value maps for ConsentProofPayloadVersion. +var ( + ConsentProofPayloadVersion_name = map[int32]string{ + 0: "CONSENT_PROOF_PAYLOAD_VERSION_UNSPECIFIED", + 1: "CONSENT_PROOF_PAYLOAD_VERSION_1", + } + ConsentProofPayloadVersion_value = map[string]int32{ + "CONSENT_PROOF_PAYLOAD_VERSION_UNSPECIFIED": 0, + "CONSENT_PROOF_PAYLOAD_VERSION_1": 1, + } +) + +func (x ConsentProofPayloadVersion) Enum() *ConsentProofPayloadVersion { + p := new(ConsentProofPayloadVersion) + *p = x + return p +} + +func (x ConsentProofPayloadVersion) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ConsentProofPayloadVersion) Descriptor() protoreflect.EnumDescriptor { + return file_message_contents_invitation_proto_enumTypes[0].Descriptor() +} + +func (ConsentProofPayloadVersion) Type() protoreflect.EnumType { + return &file_message_contents_invitation_proto_enumTypes[0] +} + +func (x ConsentProofPayloadVersion) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ConsentProofPayloadVersion.Descriptor instead. +func (ConsentProofPayloadVersion) EnumDescriptor() ([]byte, []int) { + return file_message_contents_invitation_proto_rawDescGZIP(), []int{0} +} + // Unsealed invitation V1 type InvitationV1 struct { state protoimpl.MessageState @@ -42,6 +89,8 @@ type InvitationV1 struct { // // *InvitationV1_Aes256GcmHkdfSha256 Encryption isInvitationV1_Encryption `protobuf_oneof:"encryption"` + // The user's consent proof + ConsentProof *ConsentProofPayload `protobuf:"bytes,4,opt,name=consent_proof,json=consentProof,proto3" json:"consent_proof,omitempty"` } func (x *InvitationV1) Reset() { @@ -104,6 +153,13 @@ func (x *InvitationV1) GetAes256GcmHkdfSha256() *InvitationV1_Aes256GcmHkdfsha25 return nil } +func (x *InvitationV1) GetConsentProof() *ConsentProofPayload { + if x != nil { + return x.ConsentProof + } + return nil +} + type isInvitationV1_Encryption interface { isInvitationV1_Encryption() } @@ -311,6 +367,74 @@ type SealedInvitation_V1 struct { func (*SealedInvitation_V1) isSealedInvitation_Version() {} +// Payload for user's consent proof to be set in the invitation +// Signifying the conversation should be preapproved for the user on receipt +type ConsentProofPayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // the user's signature in hex format + Signature string `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` + // approximate time when the user signed + Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + // version of the payload + PayloadVersion ConsentProofPayloadVersion `protobuf:"varint,3,opt,name=payload_version,json=payloadVersion,proto3,enum=xmtp.message_contents.ConsentProofPayloadVersion" json:"payload_version,omitempty"` +} + +func (x *ConsentProofPayload) Reset() { + *x = ConsentProofPayload{} + if protoimpl.UnsafeEnabled { + mi := &file_message_contents_invitation_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConsentProofPayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConsentProofPayload) ProtoMessage() {} + +func (x *ConsentProofPayload) ProtoReflect() protoreflect.Message { + mi := &file_message_contents_invitation_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConsentProofPayload.ProtoReflect.Descriptor instead. +func (*ConsentProofPayload) Descriptor() ([]byte, []int) { + return file_message_contents_invitation_proto_rawDescGZIP(), []int{4} +} + +func (x *ConsentProofPayload) GetSignature() string { + if x != nil { + return x.Signature + } + return "" +} + +func (x *ConsentProofPayload) GetTimestamp() uint64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *ConsentProofPayload) GetPayloadVersion() ConsentProofPayloadVersion { + if x != nil { + return x.PayloadVersion + } + return ConsentProofPayloadVersion_CONSENT_PROOF_PAYLOAD_VERSION_UNSPECIFIED +} + // Supported encryption schemes // AES256-GCM-HKDF-SHA256 type InvitationV1_Aes256GcmHkdfsha256 struct { @@ -324,7 +448,7 @@ type InvitationV1_Aes256GcmHkdfsha256 struct { func (x *InvitationV1_Aes256GcmHkdfsha256) Reset() { *x = InvitationV1_Aes256GcmHkdfsha256{} if protoimpl.UnsafeEnabled { - mi := &file_message_contents_invitation_proto_msgTypes[4] + mi := &file_message_contents_invitation_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -337,7 +461,7 @@ func (x *InvitationV1_Aes256GcmHkdfsha256) String() string { func (*InvitationV1_Aes256GcmHkdfsha256) ProtoMessage() {} func (x *InvitationV1_Aes256GcmHkdfsha256) ProtoReflect() protoreflect.Message { - mi := &file_message_contents_invitation_proto_msgTypes[4] + mi := &file_message_contents_invitation_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -376,7 +500,7 @@ type InvitationV1_Context struct { func (x *InvitationV1_Context) Reset() { *x = InvitationV1_Context{} if protoimpl.UnsafeEnabled { - mi := &file_message_contents_invitation_proto_msgTypes[5] + mi := &file_message_contents_invitation_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -389,7 +513,7 @@ func (x *InvitationV1_Context) String() string { func (*InvitationV1_Context) ProtoMessage() {} func (x *InvitationV1_Context) ProtoReflect() protoreflect.Message { - mi := &file_message_contents_invitation_proto_msgTypes[5] + mi := &file_message_contents_invitation_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -430,7 +554,7 @@ var file_message_contents_invitation_proto_rawDesc = []byte{ 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0xec, 0x03, 0x0a, 0x0c, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, + 0x22, 0xbd, 0x04, 0x0a, 0x0c, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x31, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x45, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, @@ -443,65 +567,88 @@ var file_message_contents_invitation_proto_rawDesc = []byte{ 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x31, 0x2e, 0x41, 0x65, 0x73, 0x32, 0x35, 0x36, 0x67, 0x63, 0x6d, 0x48, 0x6b, 0x64, 0x66, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x48, 0x00, 0x52, 0x13, 0x61, 0x65, 0x73, 0x32, 0x35, - 0x36, 0x47, 0x63, 0x6d, 0x48, 0x6b, 0x64, 0x66, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x1a, 0x38, - 0x0a, 0x13, 0x41, 0x65, 0x73, 0x32, 0x35, 0x36, 0x67, 0x63, 0x6d, 0x48, 0x6b, 0x64, 0x66, 0x73, - 0x68, 0x61, 0x32, 0x35, 0x36, 0x12, 0x21, 0x0a, 0x0c, 0x6b, 0x65, 0x79, 0x5f, 0x6d, 0x61, 0x74, - 0x65, 0x72, 0x69, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x6b, 0x65, 0x79, - 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x1a, 0xc6, 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, - 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x55, 0x0a, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x39, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x56, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x42, 0x0c, 0x0a, 0x0a, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0xcb, 0x01, 0x0a, 0x18, 0x53, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x31, 0x12, 0x44, 0x0a, 0x06, - 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x78, - 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x75, 0x62, 0x6c, 0x69, - 0x63, 0x4b, 0x65, 0x79, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, - 0x65, 0x72, 0x12, 0x4a, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x53, 0x69, - 0x67, 0x6e, 0x65, 0x64, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x42, 0x75, 0x6e, - 0x64, 0x6c, 0x65, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x1d, - 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x73, 0x22, 0x7a, 0x0a, - 0x12, 0x53, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x56, 0x31, 0x12, 0x21, 0x0a, 0x0c, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, - 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, - 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x78, 0x6d, 0x74, + 0x36, 0x47, 0x63, 0x6d, 0x48, 0x6b, 0x64, 0x66, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x12, 0x4f, + 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x43, 0x6f, + 0x6e, 0x73, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x1a, + 0x38, 0x0a, 0x13, 0x41, 0x65, 0x73, 0x32, 0x35, 0x36, 0x67, 0x63, 0x6d, 0x48, 0x6b, 0x64, 0x66, + 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x12, 0x21, 0x0a, 0x0c, 0x6b, 0x65, 0x79, 0x5f, 0x6d, 0x61, + 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x6b, 0x65, + 0x79, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x1a, 0xc6, 0x01, 0x0a, 0x07, 0x43, 0x6f, + 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, + 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x55, + 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x39, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x56, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x42, 0x0c, 0x0a, 0x0a, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x22, 0xcb, 0x01, 0x0a, 0x18, 0x53, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x49, 0x6e, 0x76, 0x69, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x56, 0x31, 0x12, 0x44, 0x0a, + 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, + 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x4b, 0x65, 0x79, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x06, 0x73, 0x65, 0x6e, + 0x64, 0x65, 0x72, 0x12, 0x4a, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x42, 0x75, + 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, + 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6e, 0x73, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x73, 0x22, 0x7a, + 0x0a, 0x12, 0x53, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x56, 0x31, 0x12, 0x21, 0x0a, 0x0c, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x62, + 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, + 0x72, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x78, 0x6d, + 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x73, 0x2e, 0x43, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x52, 0x0a, + 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x22, 0x60, 0x0a, 0x10, 0x53, 0x65, + 0x61, 0x6c, 0x65, 0x64, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, + 0x0a, 0x02, 0x76, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x73, 0x2e, 0x43, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x52, 0x0a, 0x63, - 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x22, 0x60, 0x0a, 0x10, 0x53, 0x65, 0x61, - 0x6c, 0x65, 0x64, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, 0x0a, - 0x02, 0x76, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x78, 0x6d, 0x74, 0x70, + 0x74, 0x73, 0x2e, 0x53, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x56, 0x31, 0x48, 0x00, 0x52, 0x02, 0x76, 0x31, 0x42, 0x09, 0x0a, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x22, 0xad, 0x01, 0x0a, + 0x13, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x12, 0x5a, 0x0a, 0x0f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x73, 0x2e, 0x53, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x56, 0x31, 0x48, 0x00, 0x52, 0x02, 0x76, 0x31, 0x42, 0x09, 0x0a, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x42, 0xd6, 0x01, 0x0a, 0x19, - 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x42, 0x0f, 0x49, 0x6e, 0x76, 0x69, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x37, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2f, 0x78, 0x6d, - 0x74, 0x70, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x73, 0xa2, 0x02, 0x03, 0x58, 0x4d, 0x58, 0xaa, 0x02, 0x14, 0x58, 0x6d, - 0x74, 0x70, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x73, 0xca, 0x02, 0x14, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xe2, 0x02, 0x20, 0x58, 0x6d, 0x74, 0x70, - 0x5c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x58, - 0x6d, 0x74, 0x70, 0x3a, 0x3a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x50, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x70, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2a, 0x70, 0x0a, 0x1a, + 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x50, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x29, 0x43, 0x4f, + 0x4e, 0x53, 0x45, 0x4e, 0x54, 0x5f, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x50, 0x41, 0x59, 0x4c, + 0x4f, 0x41, 0x44, 0x5f, 0x56, 0x45, 0x52, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, 0x1f, 0x43, 0x4f, 0x4e, + 0x53, 0x45, 0x4e, 0x54, 0x5f, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x50, 0x41, 0x59, 0x4c, 0x4f, + 0x41, 0x44, 0x5f, 0x56, 0x45, 0x52, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x31, 0x10, 0x01, 0x42, 0xd6, + 0x01, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x42, 0x0f, 0x49, 0x6e, + 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x6d, 0x74, 0x70, + 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x6b, + 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xa2, 0x02, 0x03, 0x58, 0x4d, 0x58, 0xaa, 0x02, + 0x14, 0x58, 0x6d, 0x74, 0x70, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x73, 0xca, 0x02, 0x14, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xe2, 0x02, 0x20, 0x58, + 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x15, 0x58, 0x6d, 0x74, 0x70, 0x3a, 0x3a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -516,31 +663,36 @@ func file_message_contents_invitation_proto_rawDescGZIP() []byte { return file_message_contents_invitation_proto_rawDescData } -var file_message_contents_invitation_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_message_contents_invitation_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_message_contents_invitation_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_message_contents_invitation_proto_goTypes = []interface{}{ - (*InvitationV1)(nil), // 0: xmtp.message_contents.InvitationV1 - (*SealedInvitationHeaderV1)(nil), // 1: xmtp.message_contents.SealedInvitationHeaderV1 - (*SealedInvitationV1)(nil), // 2: xmtp.message_contents.SealedInvitationV1 - (*SealedInvitation)(nil), // 3: xmtp.message_contents.SealedInvitation - (*InvitationV1_Aes256GcmHkdfsha256)(nil), // 4: xmtp.message_contents.InvitationV1.Aes256gcmHkdfsha256 - (*InvitationV1_Context)(nil), // 5: xmtp.message_contents.InvitationV1.Context - nil, // 6: xmtp.message_contents.InvitationV1.Context.MetadataEntry - (*SignedPublicKeyBundle)(nil), // 7: xmtp.message_contents.SignedPublicKeyBundle - (*Ciphertext)(nil), // 8: xmtp.message_contents.Ciphertext + (ConsentProofPayloadVersion)(0), // 0: xmtp.message_contents.ConsentProofPayloadVersion + (*InvitationV1)(nil), // 1: xmtp.message_contents.InvitationV1 + (*SealedInvitationHeaderV1)(nil), // 2: xmtp.message_contents.SealedInvitationHeaderV1 + (*SealedInvitationV1)(nil), // 3: xmtp.message_contents.SealedInvitationV1 + (*SealedInvitation)(nil), // 4: xmtp.message_contents.SealedInvitation + (*ConsentProofPayload)(nil), // 5: xmtp.message_contents.ConsentProofPayload + (*InvitationV1_Aes256GcmHkdfsha256)(nil), // 6: xmtp.message_contents.InvitationV1.Aes256gcmHkdfsha256 + (*InvitationV1_Context)(nil), // 7: xmtp.message_contents.InvitationV1.Context + nil, // 8: xmtp.message_contents.InvitationV1.Context.MetadataEntry + (*SignedPublicKeyBundle)(nil), // 9: xmtp.message_contents.SignedPublicKeyBundle + (*Ciphertext)(nil), // 10: xmtp.message_contents.Ciphertext } var file_message_contents_invitation_proto_depIdxs = []int32{ - 5, // 0: xmtp.message_contents.InvitationV1.context:type_name -> xmtp.message_contents.InvitationV1.Context - 4, // 1: xmtp.message_contents.InvitationV1.aes256_gcm_hkdf_sha256:type_name -> xmtp.message_contents.InvitationV1.Aes256gcmHkdfsha256 - 7, // 2: xmtp.message_contents.SealedInvitationHeaderV1.sender:type_name -> xmtp.message_contents.SignedPublicKeyBundle - 7, // 3: xmtp.message_contents.SealedInvitationHeaderV1.recipient:type_name -> xmtp.message_contents.SignedPublicKeyBundle - 8, // 4: xmtp.message_contents.SealedInvitationV1.ciphertext:type_name -> xmtp.message_contents.Ciphertext - 2, // 5: xmtp.message_contents.SealedInvitation.v1:type_name -> xmtp.message_contents.SealedInvitationV1 - 6, // 6: xmtp.message_contents.InvitationV1.Context.metadata:type_name -> xmtp.message_contents.InvitationV1.Context.MetadataEntry - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 7, // 0: xmtp.message_contents.InvitationV1.context:type_name -> xmtp.message_contents.InvitationV1.Context + 6, // 1: xmtp.message_contents.InvitationV1.aes256_gcm_hkdf_sha256:type_name -> xmtp.message_contents.InvitationV1.Aes256gcmHkdfsha256 + 5, // 2: xmtp.message_contents.InvitationV1.consent_proof:type_name -> xmtp.message_contents.ConsentProofPayload + 9, // 3: xmtp.message_contents.SealedInvitationHeaderV1.sender:type_name -> xmtp.message_contents.SignedPublicKeyBundle + 9, // 4: xmtp.message_contents.SealedInvitationHeaderV1.recipient:type_name -> xmtp.message_contents.SignedPublicKeyBundle + 10, // 5: xmtp.message_contents.SealedInvitationV1.ciphertext:type_name -> xmtp.message_contents.Ciphertext + 3, // 6: xmtp.message_contents.SealedInvitation.v1:type_name -> xmtp.message_contents.SealedInvitationV1 + 0, // 7: xmtp.message_contents.ConsentProofPayload.payload_version:type_name -> xmtp.message_contents.ConsentProofPayloadVersion + 8, // 8: xmtp.message_contents.InvitationV1.Context.metadata:type_name -> xmtp.message_contents.InvitationV1.Context.MetadataEntry + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_message_contents_invitation_proto_init() } @@ -600,7 +752,7 @@ func file_message_contents_invitation_proto_init() { } } file_message_contents_invitation_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InvitationV1_Aes256GcmHkdfsha256); i { + switch v := v.(*ConsentProofPayload); i { case 0: return &v.state case 1: @@ -612,6 +764,18 @@ func file_message_contents_invitation_proto_init() { } } file_message_contents_invitation_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InvitationV1_Aes256GcmHkdfsha256); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_message_contents_invitation_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*InvitationV1_Context); i { case 0: return &v.state @@ -635,13 +799,14 @@ func file_message_contents_invitation_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_message_contents_invitation_proto_rawDesc, - NumEnums: 0, - NumMessages: 7, + NumEnums: 1, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, GoTypes: file_message_contents_invitation_proto_goTypes, DependencyIndexes: file_message_contents_invitation_proto_depIdxs, + EnumInfos: file_message_contents_invitation_proto_enumTypes, MessageInfos: file_message_contents_invitation_proto_msgTypes, }.Build() File_message_contents_invitation_proto = out.File diff --git a/pkg/proto/mls/message_contents/content.pb.go b/pkg/proto/mls/message_contents/content.pb.go index 6427695b..54bf3eee 100644 --- a/pkg/proto/mls/message_contents/content.pb.go +++ b/pkg/proto/mls/message_contents/content.pb.go @@ -317,8 +317,7 @@ func (*PlaintextEnvelope_V1_) isPlaintextEnvelope_Content() {} func (*PlaintextEnvelope_V2_) isPlaintextEnvelope_Content() {} -// The initiator or new installation id that is requesting a history will send a -// request +// Initiator or new installation id requesting a history will send a request type MessageHistoryRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -376,14 +375,13 @@ func (x *MessageHistoryRequest) GetPinCode() string { return "" } -// Pre-existing installation id that is capable of supplying a history will send -// this response -type MessageHistoryResponse struct { +// Pre-existing installation id capable of supplying a history sends this reply +type MessageHistoryReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Unique identifier for each request - must match an existing request_id from a request + // Must match an existing request_id from a message history request RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` // Where the messages can be retrieved from BackupUrl string `protobuf:"bytes,2,opt,name=backup_url,json=backupUrl,proto3" json:"backup_url,omitempty"` @@ -393,8 +391,8 @@ type MessageHistoryResponse struct { ExpirationTimeNs int64 `protobuf:"varint,4,opt,name=expiration_time_ns,json=expirationTimeNs,proto3" json:"expiration_time_ns,omitempty"` } -func (x *MessageHistoryResponse) Reset() { - *x = MessageHistoryResponse{} +func (x *MessageHistoryReply) Reset() { + *x = MessageHistoryReply{} if protoimpl.UnsafeEnabled { mi := &file_mls_message_contents_content_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -402,13 +400,13 @@ func (x *MessageHistoryResponse) Reset() { } } -func (x *MessageHistoryResponse) String() string { +func (x *MessageHistoryReply) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MessageHistoryResponse) ProtoMessage() {} +func (*MessageHistoryReply) ProtoMessage() {} -func (x *MessageHistoryResponse) ProtoReflect() protoreflect.Message { +func (x *MessageHistoryReply) ProtoReflect() protoreflect.Message { mi := &file_mls_message_contents_content_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -420,33 +418,33 @@ func (x *MessageHistoryResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use MessageHistoryResponse.ProtoReflect.Descriptor instead. -func (*MessageHistoryResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use MessageHistoryReply.ProtoReflect.Descriptor instead. +func (*MessageHistoryReply) Descriptor() ([]byte, []int) { return file_mls_message_contents_content_proto_rawDescGZIP(), []int{4} } -func (x *MessageHistoryResponse) GetRequestId() string { +func (x *MessageHistoryReply) GetRequestId() string { if x != nil { return x.RequestId } return "" } -func (x *MessageHistoryResponse) GetBackupUrl() string { +func (x *MessageHistoryReply) GetBackupUrl() string { if x != nil { return x.BackupUrl } return "" } -func (x *MessageHistoryResponse) GetBackupFileHash() []byte { +func (x *MessageHistoryReply) GetBackupFileHash() []byte { if x != nil { return x.BackupFileHash } return nil } -func (x *MessageHistoryResponse) GetExpirationTimeNs() int64 { +func (x *MessageHistoryReply) GetExpirationTimeNs() int64 { if x != nil { return x.ExpirationTimeNs } @@ -524,8 +522,8 @@ type PlaintextEnvelope_V2 struct { // Types that are assignable to MessageType: // // *PlaintextEnvelope_V2_Content - // *PlaintextEnvelope_V2_MessageHistoryRequest - // *PlaintextEnvelope_V2_MessageHistoryResponse + // *PlaintextEnvelope_V2_Request + // *PlaintextEnvelope_V2_Reply MessageType isPlaintextEnvelope_V2_MessageType `protobuf_oneof:"message_type"` } @@ -582,16 +580,16 @@ func (x *PlaintextEnvelope_V2) GetContent() []byte { return nil } -func (x *PlaintextEnvelope_V2) GetMessageHistoryRequest() *MessageHistoryRequest { - if x, ok := x.GetMessageType().(*PlaintextEnvelope_V2_MessageHistoryRequest); ok { - return x.MessageHistoryRequest +func (x *PlaintextEnvelope_V2) GetRequest() *MessageHistoryRequest { + if x, ok := x.GetMessageType().(*PlaintextEnvelope_V2_Request); ok { + return x.Request } return nil } -func (x *PlaintextEnvelope_V2) GetMessageHistoryResponse() *MessageHistoryResponse { - if x, ok := x.GetMessageType().(*PlaintextEnvelope_V2_MessageHistoryResponse); ok { - return x.MessageHistoryResponse +func (x *PlaintextEnvelope_V2) GetReply() *MessageHistoryReply { + if x, ok := x.GetMessageType().(*PlaintextEnvelope_V2_Reply); ok { + return x.Reply } return nil } @@ -605,21 +603,21 @@ type PlaintextEnvelope_V2_Content struct { Content []byte `protobuf:"bytes,2,opt,name=content,proto3,oneof"` } -type PlaintextEnvelope_V2_MessageHistoryRequest struct { - // Initiator sends the request to receive history - MessageHistoryRequest *MessageHistoryRequest `protobuf:"bytes,3,opt,name=message_history_request,json=messageHistoryRequest,proto3,oneof"` +type PlaintextEnvelope_V2_Request struct { + // Initiator sends a request to receive message history + Request *MessageHistoryRequest `protobuf:"bytes,3,opt,name=request,proto3,oneof"` } -type PlaintextEnvelope_V2_MessageHistoryResponse struct { - // Other credentialed party sends response - MessageHistoryResponse *MessageHistoryResponse `protobuf:"bytes,4,opt,name=message_history_response,json=messageHistoryResponse,proto3,oneof"` +type PlaintextEnvelope_V2_Reply struct { + // Some other authorized installation sends a reply + Reply *MessageHistoryReply `protobuf:"bytes,4,opt,name=reply,proto3,oneof"` } func (*PlaintextEnvelope_V2_Content) isPlaintextEnvelope_V2_MessageType() {} -func (*PlaintextEnvelope_V2_MessageHistoryRequest) isPlaintextEnvelope_V2_MessageType() {} +func (*PlaintextEnvelope_V2_Request) isPlaintextEnvelope_V2_MessageType() {} -func (*PlaintextEnvelope_V2_MessageHistoryResponse) isPlaintextEnvelope_V2_MessageType() {} +func (*PlaintextEnvelope_V2_Reply) isPlaintextEnvelope_V2_MessageType() {} var File_mls_message_contents_content_proto protoreflect.FileDescriptor @@ -662,7 +660,7 @@ var file_mls_message_contents_content_proto_rawDesc = []byte{ 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x66, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x63, 0x6f, - 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xa4, 0x04, 0x0a, 0x11, 0x50, 0x6c, + 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xdf, 0x03, 0x0a, 0x11, 0x50, 0x6c, 0x61, 0x69, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x02, 0x76, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, @@ -676,63 +674,59 @@ var file_mls_message_contents_content_proto_rawDesc = []byte{ 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, - 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4b, 0x65, 0x79, 0x1a, 0xb4, - 0x02, 0x0a, 0x02, 0x56, 0x32, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, + 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4b, 0x65, 0x79, 0x1a, 0xef, + 0x01, 0x0a, 0x02, 0x56, 0x32, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, - 0x00, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x6a, 0x0a, 0x17, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x72, 0x65, + 0x00, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x4c, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, - 0x15, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x6d, 0x0a, 0x18, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x5f, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, - 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x69, 0x73, 0x74, - 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x16, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x22, 0x51, 0x0a, 0x15, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x69, 0x73, 0x74, 0x6f, - 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x69, 0x6e, 0x5f, - 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x69, 0x6e, 0x43, - 0x6f, 0x64, 0x65, 0x22, 0xae, 0x01, 0x0a, 0x16, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, - 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, - 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a, - 0x0a, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x55, 0x72, 0x6c, 0x12, 0x28, 0x0a, 0x10, - 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x68, 0x61, 0x73, 0x68, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x46, 0x69, - 0x6c, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x2c, 0x0a, 0x12, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x10, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, - 0x6d, 0x65, 0x4e, 0x73, 0x2a, 0x3c, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4d, 0x50, 0x52, 0x45, 0x53, 0x53, 0x49, - 0x4f, 0x4e, 0x5f, 0x44, 0x45, 0x46, 0x4c, 0x41, 0x54, 0x45, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, - 0x43, 0x4f, 0x4d, 0x50, 0x52, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x47, 0x5a, 0x49, 0x50, - 0x10, 0x01, 0x42, 0xec, 0x01, 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, - 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x73, 0x42, 0x0c, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2d, - 0x67, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x6c, 0x73, - 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x73, 0xa2, 0x02, 0x03, 0x58, 0x4d, 0x4d, 0xaa, 0x02, 0x18, 0x58, 0x6d, 0x74, 0x70, 0x2e, 0x4d, - 0x6c, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x73, 0xca, 0x02, 0x18, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x6c, 0x73, 0x5c, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xe2, 0x02, 0x24, - 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x6c, 0x73, 0x5c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1a, 0x58, 0x6d, 0x74, 0x70, 0x3a, 0x3a, 0x4d, 0x6c, 0x73, - 0x3a, 0x3a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x05, 0x72, 0x65, 0x70, 0x6c, + 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, + 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x69, 0x73, 0x74, 0x6f, + 0x72, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x48, 0x00, 0x52, 0x05, 0x72, 0x65, 0x70, 0x6c, 0x79, + 0x42, 0x0e, 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x51, 0x0a, 0x15, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x69, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x22, 0xab, + 0x01, 0x0a, 0x13, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, + 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, + 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x61, 0x63, 0x6b, 0x75, + 0x70, 0x55, 0x72, 0x6c, 0x12, 0x28, 0x0a, 0x10, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x66, + 0x69, 0x6c, 0x65, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, + 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x46, 0x69, 0x6c, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x2c, + 0x0a, 0x12, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x5f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x65, 0x78, 0x70, 0x69, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x4e, 0x73, 0x2a, 0x3c, 0x0a, 0x0b, + 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x43, + 0x4f, 0x4d, 0x50, 0x52, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x44, 0x45, 0x46, 0x4c, 0x41, + 0x54, 0x45, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x4f, 0x4d, 0x50, 0x52, 0x45, 0x53, 0x53, + 0x49, 0x4f, 0x4e, 0x5f, 0x47, 0x5a, 0x49, 0x50, 0x10, 0x01, 0x42, 0xec, 0x01, 0x0a, 0x1d, 0x63, + 0x6f, 0x6d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x42, 0x0c, 0x43, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3b, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2f, 0x78, 0x6d, + 0x74, 0x70, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x6c, 0x73, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xa2, 0x02, 0x03, 0x58, 0x4d, 0x4d, 0xaa, + 0x02, 0x18, 0x58, 0x6d, 0x74, 0x70, 0x2e, 0x4d, 0x6c, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xca, 0x02, 0x18, 0x58, 0x6d, 0x74, + 0x70, 0x5c, 0x4d, 0x6c, 0x73, 0x5c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x73, 0xe2, 0x02, 0x24, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x6c, 0x73, + 0x5c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1a, 0x58, + 0x6d, 0x74, 0x70, 0x3a, 0x3a, 0x4d, 0x6c, 0x73, 0x3a, 0x3a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -750,15 +744,15 @@ func file_mls_message_contents_content_proto_rawDescGZIP() []byte { var file_mls_message_contents_content_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_mls_message_contents_content_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_mls_message_contents_content_proto_goTypes = []interface{}{ - (Compression)(0), // 0: xmtp.mls.message_contents.Compression - (*ContentTypeId)(nil), // 1: xmtp.mls.message_contents.ContentTypeId - (*EncodedContent)(nil), // 2: xmtp.mls.message_contents.EncodedContent - (*PlaintextEnvelope)(nil), // 3: xmtp.mls.message_contents.PlaintextEnvelope - (*MessageHistoryRequest)(nil), // 4: xmtp.mls.message_contents.MessageHistoryRequest - (*MessageHistoryResponse)(nil), // 5: xmtp.mls.message_contents.MessageHistoryResponse - nil, // 6: xmtp.mls.message_contents.EncodedContent.ParametersEntry - (*PlaintextEnvelope_V1)(nil), // 7: xmtp.mls.message_contents.PlaintextEnvelope.V1 - (*PlaintextEnvelope_V2)(nil), // 8: xmtp.mls.message_contents.PlaintextEnvelope.V2 + (Compression)(0), // 0: xmtp.mls.message_contents.Compression + (*ContentTypeId)(nil), // 1: xmtp.mls.message_contents.ContentTypeId + (*EncodedContent)(nil), // 2: xmtp.mls.message_contents.EncodedContent + (*PlaintextEnvelope)(nil), // 3: xmtp.mls.message_contents.PlaintextEnvelope + (*MessageHistoryRequest)(nil), // 4: xmtp.mls.message_contents.MessageHistoryRequest + (*MessageHistoryReply)(nil), // 5: xmtp.mls.message_contents.MessageHistoryReply + nil, // 6: xmtp.mls.message_contents.EncodedContent.ParametersEntry + (*PlaintextEnvelope_V1)(nil), // 7: xmtp.mls.message_contents.PlaintextEnvelope.V1 + (*PlaintextEnvelope_V2)(nil), // 8: xmtp.mls.message_contents.PlaintextEnvelope.V2 } var file_mls_message_contents_content_proto_depIdxs = []int32{ 1, // 0: xmtp.mls.message_contents.EncodedContent.type:type_name -> xmtp.mls.message_contents.ContentTypeId @@ -766,8 +760,8 @@ var file_mls_message_contents_content_proto_depIdxs = []int32{ 0, // 2: xmtp.mls.message_contents.EncodedContent.compression:type_name -> xmtp.mls.message_contents.Compression 7, // 3: xmtp.mls.message_contents.PlaintextEnvelope.v1:type_name -> xmtp.mls.message_contents.PlaintextEnvelope.V1 8, // 4: xmtp.mls.message_contents.PlaintextEnvelope.v2:type_name -> xmtp.mls.message_contents.PlaintextEnvelope.V2 - 4, // 5: xmtp.mls.message_contents.PlaintextEnvelope.V2.message_history_request:type_name -> xmtp.mls.message_contents.MessageHistoryRequest - 5, // 6: xmtp.mls.message_contents.PlaintextEnvelope.V2.message_history_response:type_name -> xmtp.mls.message_contents.MessageHistoryResponse + 4, // 5: xmtp.mls.message_contents.PlaintextEnvelope.V2.request:type_name -> xmtp.mls.message_contents.MessageHistoryRequest + 5, // 6: xmtp.mls.message_contents.PlaintextEnvelope.V2.reply:type_name -> xmtp.mls.message_contents.MessageHistoryReply 7, // [7:7] is the sub-list for method output_type 7, // [7:7] is the sub-list for method input_type 7, // [7:7] is the sub-list for extension type_name @@ -830,7 +824,7 @@ func file_mls_message_contents_content_proto_init() { } } file_mls_message_contents_content_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageHistoryResponse); i { + switch v := v.(*MessageHistoryReply); i { case 0: return &v.state case 1: @@ -873,8 +867,8 @@ func file_mls_message_contents_content_proto_init() { } file_mls_message_contents_content_proto_msgTypes[7].OneofWrappers = []interface{}{ (*PlaintextEnvelope_V2_Content)(nil), - (*PlaintextEnvelope_V2_MessageHistoryRequest)(nil), - (*PlaintextEnvelope_V2_MessageHistoryResponse)(nil), + (*PlaintextEnvelope_V2_Request)(nil), + (*PlaintextEnvelope_V2_Reply)(nil), } type x struct{} out := protoimpl.TypeBuilder{ diff --git a/pkg/proto/mls/message_contents/group_membership.pb.go b/pkg/proto/mls/message_contents/group_membership.pb.go new file mode 100644 index 00000000..5b214607 --- /dev/null +++ b/pkg/proto/mls/message_contents/group_membership.pb.go @@ -0,0 +1,173 @@ +// Group membership + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.33.0 +// protoc (unknown) +// source: mls/message_contents/group_membership.proto + +package message_contents + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Contains a mapping of `inbox_id` -> `sequence_id` for all members of a group. +// Designed to be stored in the group context extension of the MLS group +type GroupMembership struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Members map[string]uint64 `protobuf:"bytes,1,rep,name=members,proto3" json:"members,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` +} + +func (x *GroupMembership) Reset() { + *x = GroupMembership{} + if protoimpl.UnsafeEnabled { + mi := &file_mls_message_contents_group_membership_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GroupMembership) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GroupMembership) ProtoMessage() {} + +func (x *GroupMembership) ProtoReflect() protoreflect.Message { + mi := &file_mls_message_contents_group_membership_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GroupMembership.ProtoReflect.Descriptor instead. +func (*GroupMembership) Descriptor() ([]byte, []int) { + return file_mls_message_contents_group_membership_proto_rawDescGZIP(), []int{0} +} + +func (x *GroupMembership) GetMembers() map[string]uint64 { + if x != nil { + return x.Members + } + return nil +} + +var File_mls_message_contents_group_membership_proto protoreflect.FileDescriptor + +var file_mls_message_contents_group_membership_proto_rawDesc = []byte{ + 0x0a, 0x2b, 0x6d, 0x6c, 0x73, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x6d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x19, 0x78, + 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xa0, 0x01, 0x0a, 0x0f, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x12, 0x51, 0x0a, 0x07, + 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x37, 0x2e, + 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, + 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, + 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x1a, + 0x3a, 0x0a, 0x0c, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0xf4, 0x01, 0x0a, 0x1d, + 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x42, 0x14, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2d, 0x6e, 0x6f, 0x64, 0x65, + 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x6c, + 0x73, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x73, 0xa2, 0x02, 0x03, 0x58, 0x4d, 0x4d, 0xaa, 0x02, 0x18, 0x58, 0x6d, 0x74, 0x70, 0x2e, + 0x4d, 0x6c, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x73, 0xca, 0x02, 0x18, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x6c, 0x73, 0x5c, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xe2, 0x02, + 0x24, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x6c, 0x73, 0x5c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1a, 0x58, 0x6d, 0x74, 0x70, 0x3a, 0x3a, 0x4d, 0x6c, + 0x73, 0x3a, 0x3a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_mls_message_contents_group_membership_proto_rawDescOnce sync.Once + file_mls_message_contents_group_membership_proto_rawDescData = file_mls_message_contents_group_membership_proto_rawDesc +) + +func file_mls_message_contents_group_membership_proto_rawDescGZIP() []byte { + file_mls_message_contents_group_membership_proto_rawDescOnce.Do(func() { + file_mls_message_contents_group_membership_proto_rawDescData = protoimpl.X.CompressGZIP(file_mls_message_contents_group_membership_proto_rawDescData) + }) + return file_mls_message_contents_group_membership_proto_rawDescData +} + +var file_mls_message_contents_group_membership_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_mls_message_contents_group_membership_proto_goTypes = []interface{}{ + (*GroupMembership)(nil), // 0: xmtp.mls.message_contents.GroupMembership + nil, // 1: xmtp.mls.message_contents.GroupMembership.MembersEntry +} +var file_mls_message_contents_group_membership_proto_depIdxs = []int32{ + 1, // 0: xmtp.mls.message_contents.GroupMembership.members:type_name -> xmtp.mls.message_contents.GroupMembership.MembersEntry + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_mls_message_contents_group_membership_proto_init() } +func file_mls_message_contents_group_membership_proto_init() { + if File_mls_message_contents_group_membership_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_mls_message_contents_group_membership_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GroupMembership); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_mls_message_contents_group_membership_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_mls_message_contents_group_membership_proto_goTypes, + DependencyIndexes: file_mls_message_contents_group_membership_proto_depIdxs, + MessageInfos: file_mls_message_contents_group_membership_proto_msgTypes, + }.Build() + File_mls_message_contents_group_membership_proto = out.File + file_mls_message_contents_group_membership_proto_rawDesc = nil + file_mls_message_contents_group_membership_proto_goTypes = nil + file_mls_message_contents_group_membership_proto_depIdxs = nil +} diff --git a/pkg/proto/mls/message_contents/group_metadata.pb.go b/pkg/proto/mls/message_contents/group_metadata.pb.go index 4591e7e5..a16d667f 100644 --- a/pkg/proto/mls/message_contents/group_metadata.pb.go +++ b/pkg/proto/mls/message_contents/group_metadata.pb.go @@ -125,6 +125,59 @@ func (MembershipPolicy_BasePolicy) EnumDescriptor() ([]byte, []int) { return file_mls_message_contents_group_metadata_proto_rawDescGZIP(), []int{2, 0} } +// Base policy +type MetadataPolicy_MetadataBasePolicy int32 + +const ( + MetadataPolicy_METADATA_BASE_POLICY_UNSPECIFIED MetadataPolicy_MetadataBasePolicy = 0 + MetadataPolicy_METADATA_BASE_POLICY_ALLOW MetadataPolicy_MetadataBasePolicy = 1 + MetadataPolicy_METADATA_BASE_POLICY_DENY MetadataPolicy_MetadataBasePolicy = 2 + MetadataPolicy_METADATA_BASE_POLICY_ALLOW_IF_ACTOR_CREATOR MetadataPolicy_MetadataBasePolicy = 3 +) + +// Enum value maps for MetadataPolicy_MetadataBasePolicy. +var ( + MetadataPolicy_MetadataBasePolicy_name = map[int32]string{ + 0: "METADATA_BASE_POLICY_UNSPECIFIED", + 1: "METADATA_BASE_POLICY_ALLOW", + 2: "METADATA_BASE_POLICY_DENY", + 3: "METADATA_BASE_POLICY_ALLOW_IF_ACTOR_CREATOR", + } + MetadataPolicy_MetadataBasePolicy_value = map[string]int32{ + "METADATA_BASE_POLICY_UNSPECIFIED": 0, + "METADATA_BASE_POLICY_ALLOW": 1, + "METADATA_BASE_POLICY_DENY": 2, + "METADATA_BASE_POLICY_ALLOW_IF_ACTOR_CREATOR": 3, + } +) + +func (x MetadataPolicy_MetadataBasePolicy) Enum() *MetadataPolicy_MetadataBasePolicy { + p := new(MetadataPolicy_MetadataBasePolicy) + *p = x + return p +} + +func (x MetadataPolicy_MetadataBasePolicy) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MetadataPolicy_MetadataBasePolicy) Descriptor() protoreflect.EnumDescriptor { + return file_mls_message_contents_group_metadata_proto_enumTypes[2].Descriptor() +} + +func (MetadataPolicy_MetadataBasePolicy) Type() protoreflect.EnumType { + return &file_mls_message_contents_group_metadata_proto_enumTypes[2] +} + +func (x MetadataPolicy_MetadataBasePolicy) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use MetadataPolicy_MetadataBasePolicy.Descriptor instead. +func (MetadataPolicy_MetadataBasePolicy) EnumDescriptor() ([]byte, []int) { + return file_mls_message_contents_group_metadata_proto_rawDescGZIP(), []int{3, 0} +} + // Parent message for group metadata type GroupMetadataV1 struct { state protoimpl.MessageState @@ -197,7 +250,7 @@ type PolicySet struct { AddMemberPolicy *MembershipPolicy `protobuf:"bytes,1,opt,name=add_member_policy,json=addMemberPolicy,proto3" json:"add_member_policy,omitempty"` RemoveMemberPolicy *MembershipPolicy `protobuf:"bytes,2,opt,name=remove_member_policy,json=removeMemberPolicy,proto3" json:"remove_member_policy,omitempty"` - UpdateGroupNamePolicy *MembershipPolicy `protobuf:"bytes,3,opt,name=update_group_name_policy,json=updateGroupNamePolicy,proto3" json:"update_group_name_policy,omitempty"` + UpdateGroupNamePolicy *MetadataPolicy `protobuf:"bytes,3,opt,name=update_group_name_policy,json=updateGroupNamePolicy,proto3" json:"update_group_name_policy,omitempty"` } func (x *PolicySet) Reset() { @@ -246,7 +299,7 @@ func (x *PolicySet) GetRemoveMemberPolicy() *MembershipPolicy { return nil } -func (x *PolicySet) GetUpdateGroupNamePolicy() *MembershipPolicy { +func (x *PolicySet) GetUpdateGroupNamePolicy() *MetadataPolicy { if x != nil { return x.UpdateGroupNamePolicy } @@ -349,6 +402,102 @@ func (*MembershipPolicy_AndCondition_) isMembershipPolicy_Kind() {} func (*MembershipPolicy_AnyCondition_) isMembershipPolicy_Kind() {} +// A policy that governs updating metadata +type MetadataPolicy struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Kind: + // + // *MetadataPolicy_Base + // *MetadataPolicy_AndCondition_ + // *MetadataPolicy_AnyCondition_ + Kind isMetadataPolicy_Kind `protobuf_oneof:"kind"` +} + +func (x *MetadataPolicy) Reset() { + *x = MetadataPolicy{} + if protoimpl.UnsafeEnabled { + mi := &file_mls_message_contents_group_metadata_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MetadataPolicy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MetadataPolicy) ProtoMessage() {} + +func (x *MetadataPolicy) ProtoReflect() protoreflect.Message { + mi := &file_mls_message_contents_group_metadata_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MetadataPolicy.ProtoReflect.Descriptor instead. +func (*MetadataPolicy) Descriptor() ([]byte, []int) { + return file_mls_message_contents_group_metadata_proto_rawDescGZIP(), []int{3} +} + +func (m *MetadataPolicy) GetKind() isMetadataPolicy_Kind { + if m != nil { + return m.Kind + } + return nil +} + +func (x *MetadataPolicy) GetBase() MetadataPolicy_MetadataBasePolicy { + if x, ok := x.GetKind().(*MetadataPolicy_Base); ok { + return x.Base + } + return MetadataPolicy_METADATA_BASE_POLICY_UNSPECIFIED +} + +func (x *MetadataPolicy) GetAndCondition() *MetadataPolicy_AndCondition { + if x, ok := x.GetKind().(*MetadataPolicy_AndCondition_); ok { + return x.AndCondition + } + return nil +} + +func (x *MetadataPolicy) GetAnyCondition() *MetadataPolicy_AnyCondition { + if x, ok := x.GetKind().(*MetadataPolicy_AnyCondition_); ok { + return x.AnyCondition + } + return nil +} + +type isMetadataPolicy_Kind interface { + isMetadataPolicy_Kind() +} + +type MetadataPolicy_Base struct { + Base MetadataPolicy_MetadataBasePolicy `protobuf:"varint,1,opt,name=base,proto3,enum=xmtp.mls.message_contents.MetadataPolicy_MetadataBasePolicy,oneof"` +} + +type MetadataPolicy_AndCondition_ struct { + AndCondition *MetadataPolicy_AndCondition `protobuf:"bytes,2,opt,name=and_condition,json=andCondition,proto3,oneof"` +} + +type MetadataPolicy_AnyCondition_ struct { + AnyCondition *MetadataPolicy_AnyCondition `protobuf:"bytes,3,opt,name=any_condition,json=anyCondition,proto3,oneof"` +} + +func (*MetadataPolicy_Base) isMetadataPolicy_Kind() {} + +func (*MetadataPolicy_AndCondition_) isMetadataPolicy_Kind() {} + +func (*MetadataPolicy_AnyCondition_) isMetadataPolicy_Kind() {} + // Combine multiple policies. All must evaluate to true type MembershipPolicy_AndCondition struct { state protoimpl.MessageState @@ -361,7 +510,7 @@ type MembershipPolicy_AndCondition struct { func (x *MembershipPolicy_AndCondition) Reset() { *x = MembershipPolicy_AndCondition{} if protoimpl.UnsafeEnabled { - mi := &file_mls_message_contents_group_metadata_proto_msgTypes[3] + mi := &file_mls_message_contents_group_metadata_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -374,7 +523,7 @@ func (x *MembershipPolicy_AndCondition) String() string { func (*MembershipPolicy_AndCondition) ProtoMessage() {} func (x *MembershipPolicy_AndCondition) ProtoReflect() protoreflect.Message { - mi := &file_mls_message_contents_group_metadata_proto_msgTypes[3] + mi := &file_mls_message_contents_group_metadata_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -409,7 +558,7 @@ type MembershipPolicy_AnyCondition struct { func (x *MembershipPolicy_AnyCondition) Reset() { *x = MembershipPolicy_AnyCondition{} if protoimpl.UnsafeEnabled { - mi := &file_mls_message_contents_group_metadata_proto_msgTypes[4] + mi := &file_mls_message_contents_group_metadata_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -422,7 +571,7 @@ func (x *MembershipPolicy_AnyCondition) String() string { func (*MembershipPolicy_AnyCondition) ProtoMessage() {} func (x *MembershipPolicy_AnyCondition) ProtoReflect() protoreflect.Message { - mi := &file_mls_message_contents_group_metadata_proto_msgTypes[4] + mi := &file_mls_message_contents_group_metadata_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -445,6 +594,102 @@ func (x *MembershipPolicy_AnyCondition) GetPolicies() []*MembershipPolicy { return nil } +// Combine multiple policies. All must evaluate to true +type MetadataPolicy_AndCondition struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Policies []*MetadataPolicy `protobuf:"bytes,1,rep,name=policies,proto3" json:"policies,omitempty"` +} + +func (x *MetadataPolicy_AndCondition) Reset() { + *x = MetadataPolicy_AndCondition{} + if protoimpl.UnsafeEnabled { + mi := &file_mls_message_contents_group_metadata_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MetadataPolicy_AndCondition) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MetadataPolicy_AndCondition) ProtoMessage() {} + +func (x *MetadataPolicy_AndCondition) ProtoReflect() protoreflect.Message { + mi := &file_mls_message_contents_group_metadata_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MetadataPolicy_AndCondition.ProtoReflect.Descriptor instead. +func (*MetadataPolicy_AndCondition) Descriptor() ([]byte, []int) { + return file_mls_message_contents_group_metadata_proto_rawDescGZIP(), []int{3, 0} +} + +func (x *MetadataPolicy_AndCondition) GetPolicies() []*MetadataPolicy { + if x != nil { + return x.Policies + } + return nil +} + +// Combine multiple policies. Any must evaluate to true +type MetadataPolicy_AnyCondition struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Policies []*MetadataPolicy `protobuf:"bytes,1,rep,name=policies,proto3" json:"policies,omitempty"` +} + +func (x *MetadataPolicy_AnyCondition) Reset() { + *x = MetadataPolicy_AnyCondition{} + if protoimpl.UnsafeEnabled { + mi := &file_mls_message_contents_group_metadata_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MetadataPolicy_AnyCondition) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MetadataPolicy_AnyCondition) ProtoMessage() {} + +func (x *MetadataPolicy_AnyCondition) ProtoReflect() protoreflect.Message { + mi := &file_mls_message_contents_group_metadata_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MetadataPolicy_AnyCondition.ProtoReflect.Descriptor instead. +func (*MetadataPolicy_AnyCondition) Descriptor() ([]byte, []int) { + return file_mls_message_contents_group_metadata_proto_rawDescGZIP(), []int{3, 1} +} + +func (x *MetadataPolicy_AnyCondition) GetPolicies() []*MetadataPolicy { + if x != nil { + return x.Policies + } + return nil +} + var File_mls_message_contents_group_metadata_proto protoreflect.FileDescriptor var file_mls_message_contents_group_metadata_proto_rawDesc = []byte{ @@ -466,7 +711,7 @@ var file_mls_message_contents_group_metadata_proto_rawDesc = []byte{ 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x53, 0x65, 0x74, 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x22, 0xa9, + 0x79, 0x53, 0x65, 0x74, 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x22, 0xa7, 0x02, 0x0a, 0x09, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x53, 0x65, 0x74, 0x12, 0x57, 0x0a, 0x11, 0x61, 0x64, 0x64, 0x5f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, @@ -479,74 +724,114 @@ var file_mls_message_contents_group_metadata_proto_rawDesc = []byte{ 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x12, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x50, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x12, 0x64, 0x0a, 0x18, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x67, + 0x6c, 0x69, 0x63, 0x79, 0x12, 0x62, 0x0a, 0x18, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x50, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x52, 0x15, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0xdc, 0x04, 0x0a, 0x10, 0x4d, - 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, - 0x4c, 0x0a, 0x04, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x36, 0x2e, - 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, - 0x73, 0x68, 0x69, 0x70, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x50, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x00, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x5f, 0x0a, - 0x0d, 0x61, 0x6e, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, + 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x50, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x52, 0x15, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, + 0x6d, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0xdc, 0x04, 0x0a, 0x10, 0x4d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x4c, 0x0a, + 0x04, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x36, 0x2e, 0x78, 0x6d, + 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, + 0x69, 0x70, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x50, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x48, 0x00, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x0d, 0x61, + 0x6e, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x4d, + 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, + 0x41, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0c, + 0x61, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5f, 0x0a, 0x0d, + 0x61, 0x6e, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, + 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x41, 0x6e, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, + 0x0c, 0x61, 0x6e, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x57, 0x0a, + 0x0c, 0x41, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x47, 0x0a, + 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2b, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x08, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x1a, 0x57, 0x0a, 0x0c, 0x41, 0x6e, 0x79, 0x43, 0x6f, 0x6e, + 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x47, 0x0a, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, + 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x50, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x22, + 0x7e, 0x0a, 0x0a, 0x42, 0x61, 0x73, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x1b, 0x0a, + 0x17, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x53, + 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x42, 0x41, + 0x53, 0x45, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, + 0x01, 0x12, 0x14, 0x0a, 0x10, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, + 0x5f, 0x44, 0x45, 0x4e, 0x59, 0x10, 0x02, 0x12, 0x26, 0x0a, 0x22, 0x42, 0x41, 0x53, 0x45, 0x5f, + 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x5f, 0x49, 0x46, 0x5f, + 0x41, 0x43, 0x54, 0x4f, 0x52, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x4f, 0x52, 0x10, 0x03, 0x42, + 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0x85, 0x05, 0x0a, 0x0e, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x52, 0x0a, 0x04, 0x62, 0x61, + 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3c, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, + 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x50, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x61, 0x73, 0x65, + 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x00, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x5d, + 0x0a, 0x0d, 0x61, 0x6e, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, + 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x73, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x2e, 0x41, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, + 0x0c, 0x61, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5d, 0x0a, + 0x0d, 0x61, 0x6e, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, - 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x50, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x2e, 0x41, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, - 0x52, 0x0c, 0x61, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5f, - 0x0a, 0x0d, 0x61, 0x6e, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, + 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, + 0x41, 0x6e, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0c, + 0x61, 0x6e, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x55, 0x0a, 0x0c, + 0x41, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x08, + 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, + 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x69, 0x65, 0x73, 0x1a, 0x55, 0x0a, 0x0c, 0x41, 0x6e, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x50, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x2e, 0x41, 0x6e, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x48, - 0x00, 0x52, 0x0c, 0x61, 0x6e, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x1a, - 0x57, 0x0a, 0x0c, 0x41, 0x6e, 0x64, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x47, 0x0a, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x2b, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x4d, 0x65, - 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x08, - 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x1a, 0x57, 0x0a, 0x0c, 0x41, 0x6e, 0x79, 0x43, - 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x47, 0x0a, 0x08, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x78, 0x6d, 0x74, - 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, - 0x70, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, - 0x73, 0x22, 0x7e, 0x0a, 0x0a, 0x42, 0x61, 0x73, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, - 0x1b, 0x0a, 0x17, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x55, - 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, - 0x42, 0x41, 0x53, 0x45, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x41, 0x4c, 0x4c, 0x4f, - 0x57, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x50, 0x4f, 0x4c, 0x49, - 0x43, 0x59, 0x5f, 0x44, 0x45, 0x4e, 0x59, 0x10, 0x02, 0x12, 0x26, 0x0a, 0x22, 0x42, 0x41, 0x53, - 0x45, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x5f, 0x49, - 0x46, 0x5f, 0x41, 0x43, 0x54, 0x4f, 0x52, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x4f, 0x52, 0x10, - 0x03, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x2a, 0x6c, 0x0a, 0x10, 0x43, 0x6f, 0x6e, - 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x21, 0x0a, - 0x1d, 0x43, 0x4f, 0x4e, 0x56, 0x45, 0x52, 0x53, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x56, 0x45, 0x52, 0x53, 0x41, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x01, 0x12, 0x18, 0x0a, - 0x14, 0x43, 0x4f, 0x4e, 0x56, 0x45, 0x52, 0x53, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x44, 0x4d, 0x10, 0x02, 0x42, 0xf2, 0x01, 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, - 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x42, 0x12, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x6d, 0x74, 0x70, - 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x6b, - 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x6c, 0x73, 0x2f, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xa2, 0x02, 0x03, 0x58, - 0x4d, 0x4d, 0xaa, 0x02, 0x18, 0x58, 0x6d, 0x74, 0x70, 0x2e, 0x4d, 0x6c, 0x73, 0x2e, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xca, 0x02, 0x18, - 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x6c, 0x73, 0x5c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xe2, 0x02, 0x24, 0x58, 0x6d, 0x74, 0x70, 0x5c, - 0x4d, 0x6c, 0x73, 0x5c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x1a, 0x58, 0x6d, 0x74, 0x70, 0x3a, 0x3a, 0x4d, 0x6c, 0x73, 0x3a, 0x3a, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x22, 0xaa, 0x01, 0x0a, 0x12, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x61, 0x73, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x12, 0x24, 0x0a, 0x20, 0x4d, 0x45, 0x54, 0x41, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x42, 0x41, + 0x53, 0x45, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x1a, 0x4d, 0x45, 0x54, 0x41, 0x44, + 0x41, 0x54, 0x41, 0x5f, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, + 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x4d, 0x45, 0x54, 0x41, 0x44, + 0x41, 0x54, 0x41, 0x5f, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, + 0x44, 0x45, 0x4e, 0x59, 0x10, 0x02, 0x12, 0x2f, 0x0a, 0x2b, 0x4d, 0x45, 0x54, 0x41, 0x44, 0x41, + 0x54, 0x41, 0x5f, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x41, + 0x4c, 0x4c, 0x4f, 0x57, 0x5f, 0x49, 0x46, 0x5f, 0x41, 0x43, 0x54, 0x4f, 0x52, 0x5f, 0x43, 0x52, + 0x45, 0x41, 0x54, 0x4f, 0x52, 0x10, 0x03, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x2a, + 0x6c, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x21, 0x0a, 0x1d, 0x43, 0x4f, 0x4e, 0x56, 0x45, 0x52, 0x53, 0x41, 0x54, + 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x56, 0x45, 0x52, + 0x53, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, + 0x50, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x43, 0x4f, 0x4e, 0x56, 0x45, 0x52, 0x53, 0x41, 0x54, + 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x4d, 0x10, 0x02, 0x42, 0xf2, 0x01, + 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x42, + 0x12, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2f, 0x78, 0x6d, 0x74, 0x70, 0x2d, 0x6e, 0x6f, 0x64, 0x65, + 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x6c, + 0x73, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x73, 0xa2, 0x02, 0x03, 0x58, 0x4d, 0x4d, 0xaa, 0x02, 0x18, 0x58, 0x6d, 0x74, 0x70, 0x2e, + 0x4d, 0x6c, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x73, 0xca, 0x02, 0x18, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x6c, 0x73, 0x5c, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0xe2, 0x02, + 0x24, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x6c, 0x73, 0x5c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1a, 0x58, 0x6d, 0x74, 0x70, 0x3a, 0x3a, 0x4d, 0x6c, + 0x73, 0x3a, 0x3a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -561,33 +846,42 @@ func file_mls_message_contents_group_metadata_proto_rawDescGZIP() []byte { return file_mls_message_contents_group_metadata_proto_rawDescData } -var file_mls_message_contents_group_metadata_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_mls_message_contents_group_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_mls_message_contents_group_metadata_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_mls_message_contents_group_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_mls_message_contents_group_metadata_proto_goTypes = []interface{}{ - (ConversationType)(0), // 0: xmtp.mls.message_contents.ConversationType - (MembershipPolicy_BasePolicy)(0), // 1: xmtp.mls.message_contents.MembershipPolicy.BasePolicy - (*GroupMetadataV1)(nil), // 2: xmtp.mls.message_contents.GroupMetadataV1 - (*PolicySet)(nil), // 3: xmtp.mls.message_contents.PolicySet - (*MembershipPolicy)(nil), // 4: xmtp.mls.message_contents.MembershipPolicy - (*MembershipPolicy_AndCondition)(nil), // 5: xmtp.mls.message_contents.MembershipPolicy.AndCondition - (*MembershipPolicy_AnyCondition)(nil), // 6: xmtp.mls.message_contents.MembershipPolicy.AnyCondition + (ConversationType)(0), // 0: xmtp.mls.message_contents.ConversationType + (MembershipPolicy_BasePolicy)(0), // 1: xmtp.mls.message_contents.MembershipPolicy.BasePolicy + (MetadataPolicy_MetadataBasePolicy)(0), // 2: xmtp.mls.message_contents.MetadataPolicy.MetadataBasePolicy + (*GroupMetadataV1)(nil), // 3: xmtp.mls.message_contents.GroupMetadataV1 + (*PolicySet)(nil), // 4: xmtp.mls.message_contents.PolicySet + (*MembershipPolicy)(nil), // 5: xmtp.mls.message_contents.MembershipPolicy + (*MetadataPolicy)(nil), // 6: xmtp.mls.message_contents.MetadataPolicy + (*MembershipPolicy_AndCondition)(nil), // 7: xmtp.mls.message_contents.MembershipPolicy.AndCondition + (*MembershipPolicy_AnyCondition)(nil), // 8: xmtp.mls.message_contents.MembershipPolicy.AnyCondition + (*MetadataPolicy_AndCondition)(nil), // 9: xmtp.mls.message_contents.MetadataPolicy.AndCondition + (*MetadataPolicy_AnyCondition)(nil), // 10: xmtp.mls.message_contents.MetadataPolicy.AnyCondition } var file_mls_message_contents_group_metadata_proto_depIdxs = []int32{ 0, // 0: xmtp.mls.message_contents.GroupMetadataV1.conversation_type:type_name -> xmtp.mls.message_contents.ConversationType - 3, // 1: xmtp.mls.message_contents.GroupMetadataV1.policies:type_name -> xmtp.mls.message_contents.PolicySet - 4, // 2: xmtp.mls.message_contents.PolicySet.add_member_policy:type_name -> xmtp.mls.message_contents.MembershipPolicy - 4, // 3: xmtp.mls.message_contents.PolicySet.remove_member_policy:type_name -> xmtp.mls.message_contents.MembershipPolicy - 4, // 4: xmtp.mls.message_contents.PolicySet.update_group_name_policy:type_name -> xmtp.mls.message_contents.MembershipPolicy + 4, // 1: xmtp.mls.message_contents.GroupMetadataV1.policies:type_name -> xmtp.mls.message_contents.PolicySet + 5, // 2: xmtp.mls.message_contents.PolicySet.add_member_policy:type_name -> xmtp.mls.message_contents.MembershipPolicy + 5, // 3: xmtp.mls.message_contents.PolicySet.remove_member_policy:type_name -> xmtp.mls.message_contents.MembershipPolicy + 6, // 4: xmtp.mls.message_contents.PolicySet.update_group_name_policy:type_name -> xmtp.mls.message_contents.MetadataPolicy 1, // 5: xmtp.mls.message_contents.MembershipPolicy.base:type_name -> xmtp.mls.message_contents.MembershipPolicy.BasePolicy - 5, // 6: xmtp.mls.message_contents.MembershipPolicy.and_condition:type_name -> xmtp.mls.message_contents.MembershipPolicy.AndCondition - 6, // 7: xmtp.mls.message_contents.MembershipPolicy.any_condition:type_name -> xmtp.mls.message_contents.MembershipPolicy.AnyCondition - 4, // 8: xmtp.mls.message_contents.MembershipPolicy.AndCondition.policies:type_name -> xmtp.mls.message_contents.MembershipPolicy - 4, // 9: xmtp.mls.message_contents.MembershipPolicy.AnyCondition.policies:type_name -> xmtp.mls.message_contents.MembershipPolicy - 10, // [10:10] is the sub-list for method output_type - 10, // [10:10] is the sub-list for method input_type - 10, // [10:10] is the sub-list for extension type_name - 10, // [10:10] is the sub-list for extension extendee - 0, // [0:10] is the sub-list for field type_name + 7, // 6: xmtp.mls.message_contents.MembershipPolicy.and_condition:type_name -> xmtp.mls.message_contents.MembershipPolicy.AndCondition + 8, // 7: xmtp.mls.message_contents.MembershipPolicy.any_condition:type_name -> xmtp.mls.message_contents.MembershipPolicy.AnyCondition + 2, // 8: xmtp.mls.message_contents.MetadataPolicy.base:type_name -> xmtp.mls.message_contents.MetadataPolicy.MetadataBasePolicy + 9, // 9: xmtp.mls.message_contents.MetadataPolicy.and_condition:type_name -> xmtp.mls.message_contents.MetadataPolicy.AndCondition + 10, // 10: xmtp.mls.message_contents.MetadataPolicy.any_condition:type_name -> xmtp.mls.message_contents.MetadataPolicy.AnyCondition + 5, // 11: xmtp.mls.message_contents.MembershipPolicy.AndCondition.policies:type_name -> xmtp.mls.message_contents.MembershipPolicy + 5, // 12: xmtp.mls.message_contents.MembershipPolicy.AnyCondition.policies:type_name -> xmtp.mls.message_contents.MembershipPolicy + 6, // 13: xmtp.mls.message_contents.MetadataPolicy.AndCondition.policies:type_name -> xmtp.mls.message_contents.MetadataPolicy + 6, // 14: xmtp.mls.message_contents.MetadataPolicy.AnyCondition.policies:type_name -> xmtp.mls.message_contents.MetadataPolicy + 15, // [15:15] is the sub-list for method output_type + 15, // [15:15] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name } func init() { file_mls_message_contents_group_metadata_proto_init() } @@ -633,7 +927,7 @@ func file_mls_message_contents_group_metadata_proto_init() { } } file_mls_message_contents_group_metadata_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MembershipPolicy_AndCondition); i { + switch v := v.(*MetadataPolicy); i { case 0: return &v.state case 1: @@ -645,6 +939,18 @@ func file_mls_message_contents_group_metadata_proto_init() { } } file_mls_message_contents_group_metadata_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MembershipPolicy_AndCondition); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mls_message_contents_group_metadata_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MembershipPolicy_AnyCondition); i { case 0: return &v.state @@ -656,19 +962,48 @@ func file_mls_message_contents_group_metadata_proto_init() { return nil } } + file_mls_message_contents_group_metadata_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MetadataPolicy_AndCondition); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mls_message_contents_group_metadata_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MetadataPolicy_AnyCondition); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_mls_message_contents_group_metadata_proto_msgTypes[2].OneofWrappers = []interface{}{ (*MembershipPolicy_Base)(nil), (*MembershipPolicy_AndCondition_)(nil), (*MembershipPolicy_AnyCondition_)(nil), } + file_mls_message_contents_group_metadata_proto_msgTypes[3].OneofWrappers = []interface{}{ + (*MetadataPolicy_Base)(nil), + (*MetadataPolicy_AndCondition_)(nil), + (*MetadataPolicy_AnyCondition_)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_mls_message_contents_group_metadata_proto_rawDesc, - NumEnums: 2, - NumMessages: 5, + NumEnums: 3, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, diff --git a/pkg/proto/openapi/identity/api/v1/identity.swagger.json b/pkg/proto/openapi/identity/api/v1/identity.swagger.json index 40c27df5..c0e1850b 100644 --- a/pkg/proto/openapi/identity/api/v1/identity.swagger.json +++ b/pkg/proto/openapi/identity/api/v1/identity.swagger.json @@ -217,10 +217,10 @@ "type": "string", "title": "CAIP-10 contract address\nhttps://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-10.md" }, - "blockHeight": { + "blockNumber": { "type": "string", - "format": "int64", - "title": "Specify the block height to verify the signature against" + "format": "uint64", + "title": "Specify the block number to verify the signature against" }, "signature": { "type": "string", @@ -278,7 +278,7 @@ "$ref": "#/definitions/identityassociationsRecoverableEcdsaSignature" } }, - "description": "An existing address on xmtpv2 may have already signed a legacy identity key\nof type SignedPublicKey via the 'Create Identity' signature.\nFor migration to xmtpv3, the legacy key is permitted to sign on behalf of the \naddress to create a matching xmtpv3 installation key.\nThis signature type can ONLY be used for CreateXid and AddAssociation\npayloads, and can only be used once in xmtpv3." + "description": "An existing address on xmtpv2 may have already signed a legacy identity key\nof type SignedPublicKey via the 'Create Identity' signature.\nFor migration to xmtpv3, the legacy key is permitted to sign on behalf of the\naddress to create a matching xmtpv3 installation key.\nThis signature type can ONLY be used for CreateXid and AddAssociation\npayloads, and can only be used once in xmtpv3." }, "associationsMemberIdentifier": { "type": "object", diff --git a/pkg/proto/openapi/mls/message_contents/group_membership.swagger.json b/pkg/proto/openapi/mls/message_contents/group_membership.swagger.json new file mode 100644 index 00000000..75ce1b1b --- /dev/null +++ b/pkg/proto/openapi/mls/message_contents/group_membership.swagger.json @@ -0,0 +1,44 @@ +{ + "swagger": "2.0", + "info": { + "title": "mls/message_contents/group_membership.proto", + "version": "version not set" + }, + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": {}, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + } + } +} From 514d12abb39d1965c5a4cf32f00400b878ada607 Mon Sep 17 00:00:00 2001 From: Richard Hua Date: Sat, 20 Apr 2024 17:04:00 -0700 Subject: [PATCH 5/9] Fix unsupported isolation level, sequences unsupported by default --- pkg/mls/store/models.go | 2 +- pkg/mls/store/store.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/mls/store/models.go b/pkg/mls/store/models.go index b6255c0e..4ac6342f 100644 --- a/pkg/mls/store/models.go +++ b/pkg/mls/store/models.go @@ -9,7 +9,7 @@ import ( type InboxLogEntry struct { bun.BaseModel `bun:"table:inbox_log"` - SequenceId uint64 + SequenceId uint64 `bun:",autoincrement"` InboxId string ServerTimestampNs int64 IdentityUpdateProto []byte diff --git a/pkg/mls/store/store.go b/pkg/mls/store/store.go index 14f1564c..c46ddf52 100644 --- a/pkg/mls/store/store.go +++ b/pkg/mls/store/store.go @@ -70,7 +70,8 @@ func (s *Store) PublishIdentityUpdate(ctx context.Context, req *identity.Publish return nil, errors.New("IdentityUpdate is required") } - if err := s.db.RunInTx(ctx, &sql.TxOptions{Isolation: sql.LevelSerializable}, func(ctx context.Context, tx bun.Tx) error { + // TODO: Implement serializable isolation level once supported + if err := s.db.RunInTx(ctx, &sql.TxOptions{ /*Isolation: sql.LevelSerializable*/ }, func(ctx context.Context, tx bun.Tx) error { inbox_log_entries := make([]*InboxLogEntry, 0) if err := s.db.NewSelect(). From eafaab25551106e59516d03b8fed3493833267f0 Mon Sep 17 00:00:00 2001 From: Richard Hua Date: Sat, 20 Apr 2024 17:09:54 -0700 Subject: [PATCH 6/9] Add inbox size limit test --- pkg/identity/api/v1/service_test.go | 58 +++++++++++++---------------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/pkg/identity/api/v1/service_test.go b/pkg/identity/api/v1/service_test.go index 3e060bdc..b5558e80 100644 --- a/pkg/identity/api/v1/service_test.go +++ b/pkg/identity/api/v1/service_test.go @@ -140,35 +140,29 @@ func TestPublishedUpdatesCanBeRead(t *testing.T) { require.Equal(t, res.Responses[0].Updates[0].Update.Actions[0].GetCreateInbox().InitialAddress, address) } -// func TestInboxSizeLimit(t *testing.T) { -// ctx := context.Background() -// svc, mlsDb, cleanup := newTestService(t, ctx) -// defer cleanup() -// -// inbox_id := "test_inbox" -// address := "test_address" -// -// request := makeIdentityUpdateRequest(inbox_id, makeCreateInbox(address)) -// svc.PublishIdentityUpdate(ctx, makeIdentityUpdateRequest(inbox_id, makeCreateInbox(address))) -// -// installationId := test.RandomBytes(32) -// accountAddress := test.RandomString(32) -// -// mlsValidationService.mockValidateKeyPackages(installationId, accountAddress) -// -// res, err := svc.RegisterInstallation(ctx, &mlsv1.RegisterInstallationRequest{ -// KeyPackage: &mlsv1.KeyPackageUpload{ -// KeyPackageTlsSerialized: []byte("test"), -// }, -// }) -// -// require.NoError(t, err) -// require.Equal(t, installationId, res.InstallationKey) -// -// installations := []mlsstore.Installation{} -// err = mlsDb.NewSelect().Model(&installations).Where("id = ?", installationId).Scan(ctx) -// require.NoError(t, err) -// -// require.Len(t, installations, 1) -// require.Equal(t, accountAddress, installations[0].WalletAddress) -// } +func TestInboxSizeLimit(t *testing.T) { + ctx := context.Background() + svc, _, cleanup := newTestService(t, ctx) + defer cleanup() + + inbox_id := "test_inbox" + address := "test_address" + + _, err := svc.PublishIdentityUpdate(ctx, publishIdentityUpdateRequest(inbox_id, makeCreateInbox(address))) + require.NoError(t, err) + + for i := 0; i < 255; i++ { + _, err = svc.PublishIdentityUpdate(ctx, publishIdentityUpdateRequest(inbox_id, makeAddAssociation())) + require.NoError(t, err) + } + + _, err = svc.PublishIdentityUpdate(ctx, publishIdentityUpdateRequest(inbox_id, makeAddAssociation())) + require.Error(t, err) + + res, err := svc.GetIdentityUpdates(ctx, getIdentityUpdatesRequest(makeUpdateRequest(inbox_id, 0))) + require.NoError(t, err) + + require.Len(t, res.Responses, 1) + require.Equal(t, res.Responses[0].InboxId, inbox_id) + require.Len(t, res.Responses[0].Updates, 256) +} From 7ede4b5ab258366786e4ab8cee78b735732bd606 Mon Sep 17 00:00:00 2001 From: Richard Hua Date: Sat, 20 Apr 2024 17:25:21 -0700 Subject: [PATCH 7/9] Remaining tests --- pkg/identity/api/v1/service_test.go | 70 ++++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 10 deletions(-) diff --git a/pkg/identity/api/v1/service_test.go b/pkg/identity/api/v1/service_test.go index b5558e80..522e9bdd 100644 --- a/pkg/identity/api/v1/service_test.go +++ b/pkg/identity/api/v1/service_test.go @@ -109,16 +109,6 @@ func getIdentityUpdatesRequest(requests ...*identity.GetIdentityUpdatesRequest_R } } -/* -* -Tests: -- Can't publish more than 256 updates -- Publishes through one are read in the other(s) -- Ordering is preserved -- Concurrency? -- Invalid updates are rejected -*/ - func TestPublishedUpdatesCanBeRead(t *testing.T) { ctx := context.Background() svc, _, cleanup := newTestService(t, ctx) @@ -140,6 +130,66 @@ func TestPublishedUpdatesCanBeRead(t *testing.T) { require.Equal(t, res.Responses[0].Updates[0].Update.Actions[0].GetCreateInbox().InitialAddress, address) } +func TestPublishedUpdatesAreInOrder(t *testing.T) { + ctx := context.Background() + svc, _, cleanup := newTestService(t, ctx) + defer cleanup() + + inbox_id := "test_inbox" + address := "test_address" + + _, err := svc.PublishIdentityUpdate(ctx, publishIdentityUpdateRequest(inbox_id, makeCreateInbox(address))) + require.NoError(t, err) + _, err = svc.PublishIdentityUpdate(ctx, publishIdentityUpdateRequest(inbox_id, makeAddAssociation(), makeChangeRecoveryAddress())) + require.NoError(t, err) + _, err = svc.PublishIdentityUpdate(ctx, publishIdentityUpdateRequest(inbox_id, makeRevokeAssociation())) + require.NoError(t, err) + + res, err := svc.GetIdentityUpdates(ctx, getIdentityUpdatesRequest(makeUpdateRequest(inbox_id, 0))) + require.NoError(t, err) + + require.Len(t, res.Responses, 1) + require.Equal(t, res.Responses[0].InboxId, inbox_id) + require.Len(t, res.Responses[0].Updates, 3) + require.NotNil(t, res.Responses[0].Updates[0].Update.Actions[0].GetCreateInbox()) + require.NotNil(t, res.Responses[0].Updates[1].Update.Actions[0].GetAdd()) + require.NotNil(t, res.Responses[0].Updates[1].Update.Actions[1].GetChangeRecoveryAddress()) + require.NotNil(t, res.Responses[0].Updates[2].Update.Actions[0].GetRevoke()) + + res, err = svc.GetIdentityUpdates(ctx, getIdentityUpdatesRequest(makeUpdateRequest(inbox_id, 1))) + require.NoError(t, err) + + require.Len(t, res.Responses, 1) + require.Equal(t, res.Responses[0].InboxId, inbox_id) + require.Len(t, res.Responses[0].Updates, 2) + require.NotNil(t, res.Responses[0].Updates[0].Update.Actions[0].GetAdd()) + require.NotNil(t, res.Responses[0].Updates[0].Update.Actions[1].GetChangeRecoveryAddress()) + require.NotNil(t, res.Responses[0].Updates[1].Update.Actions[0].GetRevoke()) +} + +func TestQueryMultipleInboxes(t *testing.T) { + ctx := context.Background() + svc, _, cleanup := newTestService(t, ctx) + defer cleanup() + + first_inbox_id := "test_inbox" + second_inbox_id := "second_inbox" + first_address := "test_address" + second_address := "test_address" + + _, err := svc.PublishIdentityUpdate(ctx, publishIdentityUpdateRequest(first_inbox_id, makeCreateInbox(first_address))) + require.NoError(t, err) + _, err = svc.PublishIdentityUpdate(ctx, publishIdentityUpdateRequest(second_inbox_id, makeCreateInbox(second_address))) + require.NoError(t, err) + + res, err := svc.GetIdentityUpdates(ctx, getIdentityUpdatesRequest(makeUpdateRequest(first_inbox_id, 0), makeUpdateRequest(second_inbox_id, 0))) + require.NoError(t, err) + + require.Len(t, res.Responses, 2) + require.Equal(t, res.Responses[0].Updates[0].Update.Actions[0].GetCreateInbox().InitialAddress, first_address) + require.Equal(t, res.Responses[1].Updates[0].Update.Actions[0].GetCreateInbox().InitialAddress, second_address) +} + func TestInboxSizeLimit(t *testing.T) { ctx := context.Background() svc, _, cleanup := newTestService(t, ctx) From 5b575aa817518f070c90cd50c26696fff43a3840 Mon Sep 17 00:00:00 2001 From: Richard Hua Date: Sat, 20 Apr 2024 17:28:48 -0700 Subject: [PATCH 8/9] Rename files for clarity --- pkg/identity/api/v1/{service.go => identity_service.go} | 0 pkg/identity/api/v1/{service_test.go => identity_service_test.go} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename pkg/identity/api/v1/{service.go => identity_service.go} (100%) rename pkg/identity/api/v1/{service_test.go => identity_service_test.go} (100%) diff --git a/pkg/identity/api/v1/service.go b/pkg/identity/api/v1/identity_service.go similarity index 100% rename from pkg/identity/api/v1/service.go rename to pkg/identity/api/v1/identity_service.go diff --git a/pkg/identity/api/v1/service_test.go b/pkg/identity/api/v1/identity_service_test.go similarity index 100% rename from pkg/identity/api/v1/service_test.go rename to pkg/identity/api/v1/identity_service_test.go From 5b731b5c3901e42328fea7a78cbf03b047f90293 Mon Sep 17 00:00:00 2001 From: Richard Hua Date: Sat, 20 Apr 2024 17:45:26 -0700 Subject: [PATCH 9/9] Fix lint --- pkg/mls/store/store.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/mls/store/store.go b/pkg/mls/store/store.go index c46ddf52..f26a42d3 100644 --- a/pkg/mls/store/store.go +++ b/pkg/mls/store/store.go @@ -90,7 +90,9 @@ func (s *Store) PublishIdentityUpdate(ctx context.Context, req *identity.Publish updates := make([]*associations.IdentityUpdate, 0, len(inbox_log_entries)+1) for _, log := range inbox_log_entries { identity_update := &associations.IdentityUpdate{} - proto.Unmarshal(log.IdentityUpdateProto, identity_update) + if err := proto.Unmarshal(log.IdentityUpdateProto, identity_update); err != nil { + return err + } updates = append(updates, identity_update) } _ = append(updates, new_update)