From 1a39bf8043a0c5495212c10aba4f42163bde160b Mon Sep 17 00:00:00 2001 From: Richard Hua Date: Mon, 22 Apr 2024 13:28:16 -0700 Subject: [PATCH 1/7] Implement PublishIdentityUpdate and GetInboxLogs endpoints (#377) Stubbed out the validation service for now, as well as the `GetInboxIds` endpoint - these will be implemented in the next PR. Also will add more efficient InboxID encoding, and idempotent publishes, shortly. Notes: 1. I did not split the logic between 'store' and 'service' layers. It seems 90% of the logic would be in the database anyway, and it felt like splitting it up would make it harder to optimize later. Happy to refactor if anyone disagrees though. 2. Our ORM Bun does not currently support [custom isolation levels](https://github.com/uptrace/bun/blob/b005dc2a9034715c6f59dcfc8e76aa3b85df38ab/driver/pgdriver/driver.go#L218) for Postgres. Decided to punt this for now - using SERIALIZABLE isolation level just prevents races when two `CreateInbox` updates are published simultaneously, which should be mostly prevented by our hash validation mechanism anyway. --- .../v1/{service.go => identity_service.go} | 4 +- pkg/identity/api/v1/identity_service_test.go | 218 ++++++++ pkg/mls/store/models.go | 9 + pkg/mls/store/store.go | 116 ++++ .../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 ++ 12 files changed, 1387 insertions(+), 322 deletions(-) rename pkg/identity/api/v1/{service.go => identity_service.go} (95%) create mode 100644 pkg/identity/api/v1/identity_service_test.go 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/identity/api/v1/service.go b/pkg/identity/api/v1/identity_service.go similarity index 95% rename from pkg/identity/api/v1/service.go rename to pkg/identity/api/v1/identity_service.go index e0383502..fd111865 100644 --- a/pkg/identity/api/v1/service.go +++ b/pkg/identity/api/v1/identity_service.go @@ -75,7 +75,7 @@ Start transaction (SERIALIZABLE isolation level) End transaction */ func (s *Service) PublishIdentityUpdate(ctx context.Context, req *api.PublishIdentityUpdateRequest) (*api.PublishIdentityUpdateResponse, error) { - 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) { @@ -84,7 +84,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/identity/api/v1/identity_service_test.go b/pkg/identity/api/v1/identity_service_test.go new file mode 100644 index 00000000..522e9bdd --- /dev/null +++ b/pkg/identity/api/v1/identity_service_test.go @@ -0,0 +1,218 @@ +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, + } +} + +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 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) + 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) +} diff --git a/pkg/mls/store/models.go b/pkg/mls/store/models.go index 83ea0d09..4ac6342f 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 `bun:",autoincrement"` + 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..f26a42d3 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" @@ -11,8 +12,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 +27,14 @@ type Store struct { db *bun.DB } +type IdentityStore interface { + PublishIdentityUpdate(ctx context.Context, req *identity.PublishIdentityUpdateRequest) (*identity.PublishIdentityUpdateResponse, error) + 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 +64,111 @@ 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") + } + + // 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(). + 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{} + if err := proto.Unmarshal(log.IdentityUpdateProto, identity_update); err != nil { + return err + } + 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)) + + 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()). + Order("sequence_id ASC"). + 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() 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 2df0a533fcbde5a9e81e5679b9b39a2c703ddce5 Mon Sep 17 00:00:00 2001 From: Richard Hua Date: Wed, 24 Apr 2024 10:10:08 -0700 Subject: [PATCH 2/7] Add support for validation service (#378) * Generate protos * Add support for validation service endpoint * Add validation service handle to identity service * Fix lint * Identity service does not need nats server --- pkg/api/server.go | 2 +- pkg/identity/api/v1/identity_service.go | 13 +- pkg/identity/api/v1/identity_service_test.go | 36 +- pkg/mls/api/v1/service_test.go | 5 + pkg/mlsvalidate/service.go | 22 + pkg/mlsvalidate/service_test.go | 4 + .../identity/associations/association.pb.go | 648 ++++++++++++++---- pkg/proto/keystore_api/v1/keystore.pb.go | 497 +++++++------- .../conversation_reference.pb.go | 38 +- pkg/proto/mls/database/intents.pb.go | 98 +-- .../mls/message_contents/group_metadata.pb.go | 292 ++++---- .../group_mutable_metadata.pb.go | 72 +- pkg/proto/mls_validation/v1/service.pb.go | 439 ++++++++---- .../mls_validation/v1/service_grpc.pb.go | 39 ++ .../mls_validation/v1/service.swagger.json | 319 +++++++++ 15 files changed, 1761 insertions(+), 763 deletions(-) diff --git a/pkg/api/server.go b/pkg/api/server.go index 508dd31e..b356feb6 100644 --- a/pkg/api/server.go +++ b/pkg/api/server.go @@ -166,7 +166,7 @@ func (s *Server) startGRPC() error { } mlsv1pb.RegisterMlsApiServer(grpcServer, s.mlsv1) - s.identityv1, err = identityv1.NewService(s.Log, s.Config.MLSStore) + s.identityv1, err = identityv1.NewService(s.Log, s.Config.MLSStore, s.Config.MLSValidator) if err != nil { return errors.Wrap(err, "creating identity service") } diff --git a/pkg/identity/api/v1/identity_service.go b/pkg/identity/api/v1/identity_service.go index fd111865..7f36b31d 100644 --- a/pkg/identity/api/v1/identity_service.go +++ b/pkg/identity/api/v1/identity_service.go @@ -4,6 +4,7 @@ import ( "context" mlsstore "github.com/xmtp/xmtp-node-go/pkg/mls/store" + "github.com/xmtp/xmtp-node-go/pkg/mlsvalidate" api "github.com/xmtp/xmtp-node-go/pkg/proto/identity/api/v1" "go.uber.org/zap" "google.golang.org/grpc/codes" @@ -13,17 +14,19 @@ import ( type Service struct { api.UnimplementedIdentityApiServer - log *zap.Logger - store mlsstore.MlsStore + log *zap.Logger + store mlsstore.MlsStore + validationService mlsvalidate.MLSValidationService ctx context.Context ctxCancel func() } -func NewService(log *zap.Logger, store mlsstore.MlsStore) (s *Service, err error) { +func NewService(log *zap.Logger, store mlsstore.MlsStore, validationService mlsvalidate.MLSValidationService) (s *Service, err error) { s = &Service{ - log: log.Named("identity"), - store: store, + log: log.Named("identity"), + store: store, + validationService: validationService, } s.ctx, s.ctxCancel = context.WithCancel(context.Background()) diff --git a/pkg/identity/api/v1/identity_service_test.go b/pkg/identity/api/v1/identity_service_test.go index 522e9bdd..d0a7d2c4 100644 --- a/pkg/identity/api/v1/identity_service_test.go +++ b/pkg/identity/api/v1/identity_service_test.go @@ -3,17 +3,38 @@ package api import ( "context" "testing" - "time" - "github.com/nats-io/nats-server/v2/server" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/uptrace/bun" mlsstore "github.com/xmtp/xmtp-node-go/pkg/mls/store" + "github.com/xmtp/xmtp-node-go/pkg/mlsvalidate" identity "github.com/xmtp/xmtp-node-go/pkg/proto/identity/api/v1" associations "github.com/xmtp/xmtp-node-go/pkg/proto/identity/associations" + mlsv1 "github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1" test "github.com/xmtp/xmtp-node-go/pkg/testing" ) +type mockedMLSValidationService struct { + mock.Mock +} + +func (m *mockedMLSValidationService) GetAssociationState(ctx context.Context, oldUpdates []*associations.IdentityUpdate, newUpdates []*associations.IdentityUpdate) (*mlsvalidate.AssociationStateResult, error) { + return nil, nil +} + +func (m *mockedMLSValidationService) ValidateKeyPackages(ctx context.Context, keyPackages [][]byte) ([]mlsvalidate.IdentityValidationResult, error) { + return nil, nil +} + +func (m *mockedMLSValidationService) ValidateGroupMessages(ctx context.Context, groupMessages []*mlsv1.GroupMessageInput) ([]mlsvalidate.GroupMessageValidationResult, error) { + return nil, nil +} + +func newMockedValidationService() *mockedMLSValidationService { + return new(mockedMLSValidationService) +} + func newTestService(t *testing.T, ctx context.Context) (*Service, *bun.DB, func()) { log := test.NewLog(t) db, _, mlsDbCleanup := test.NewMLSDB(t) @@ -22,16 +43,9 @@ func newTestService(t *testing.T, ctx context.Context) (*Service, *bun.DB, func( 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() - } + mlsValidationService := newMockedValidationService() - svc, err := NewService(log, store) + svc, err := NewService(log, store, mlsValidationService) require.NoError(t, err) return svc, db, func() { diff --git a/pkg/mls/api/v1/service_test.go b/pkg/mls/api/v1/service_test.go index c4ecd94a..fc002047 100644 --- a/pkg/mls/api/v1/service_test.go +++ b/pkg/mls/api/v1/service_test.go @@ -15,6 +15,7 @@ import ( wakupb "github.com/waku-org/go-waku/waku/v2/protocol/pb" mlsstore "github.com/xmtp/xmtp-node-go/pkg/mls/store" "github.com/xmtp/xmtp-node-go/pkg/mlsvalidate" + "github.com/xmtp/xmtp-node-go/pkg/proto/identity/associations" mlsv1 "github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1" test "github.com/xmtp/xmtp-node-go/pkg/testing" "github.com/xmtp/xmtp-node-go/pkg/topic" @@ -26,6 +27,10 @@ type mockedMLSValidationService struct { mock.Mock } +func (m *mockedMLSValidationService) GetAssociationState(ctx context.Context, oldUpdates []*associations.IdentityUpdate, newUpdates []*associations.IdentityUpdate) (*mlsvalidate.AssociationStateResult, error) { + return nil, nil +} + func (m *mockedMLSValidationService) ValidateKeyPackages(ctx context.Context, keyPackages [][]byte) ([]mlsvalidate.IdentityValidationResult, error) { args := m.Called(ctx, keyPackages) diff --git a/pkg/mlsvalidate/service.go b/pkg/mlsvalidate/service.go index a950d159..3ec6d1ee 100644 --- a/pkg/mlsvalidate/service.go +++ b/pkg/mlsvalidate/service.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + associations "github.com/xmtp/xmtp-node-go/pkg/proto/identity/associations" mlsv1 "github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1" svc "github.com/xmtp/xmtp-node-go/pkg/proto/mls_validation/v1" "google.golang.org/grpc" @@ -21,6 +22,11 @@ type GroupMessageValidationResult struct { GroupId string } +type AssociationStateResult struct { + AssociationState *associations.AssociationState `protobuf:"bytes,1,opt,name=association_state,json=associationState,proto3" json:"association_state,omitempty"` + StateDiff *associations.AssociationStateDiff `protobuf:"bytes,2,opt,name=state_diff,json=stateDiff,proto3" json:"state_diff,omitempty"` +} + type IdentityInput struct { SigningPublicKey []byte Identity []byte @@ -29,6 +35,7 @@ type IdentityInput struct { type MLSValidationService interface { ValidateKeyPackages(ctx context.Context, keyPackages [][]byte) ([]IdentityValidationResult, error) ValidateGroupMessages(ctx context.Context, groupMessages []*mlsv1.GroupMessageInput) ([]GroupMessageValidationResult, error) + GetAssociationState(ctx context.Context, oldUpdates []*associations.IdentityUpdate, newUpdates []*associations.IdentityUpdate) (*AssociationStateResult, error) } type MLSValidationServiceImpl struct { @@ -45,6 +52,21 @@ func NewMlsValidationService(ctx context.Context, options MLSValidationOptions) }, nil } +func (s *MLSValidationServiceImpl) GetAssociationState(ctx context.Context, oldUpdates []*associations.IdentityUpdate, newUpdates []*associations.IdentityUpdate) (*AssociationStateResult, error) { + req := &svc.GetAssociationStateRequest{ + OldUpdates: oldUpdates, + NewUpdates: newUpdates, + } + response, err := s.grpcClient.GetAssociationState(ctx, req) + if err != nil { + return nil, err + } + return &AssociationStateResult{ + AssociationState: response.GetAssociationState(), + StateDiff: response.GetStateDiff(), + }, nil +} + func (s *MLSValidationServiceImpl) ValidateKeyPackages(ctx context.Context, keyPackages [][]byte) ([]IdentityValidationResult, error) { req := makeValidateKeyPackageRequest(keyPackages) response, err := s.grpcClient.ValidateKeyPackages(ctx, req) diff --git a/pkg/mlsvalidate/service_test.go b/pkg/mlsvalidate/service_test.go index 01857927..005b711b 100644 --- a/pkg/mlsvalidate/service_test.go +++ b/pkg/mlsvalidate/service_test.go @@ -14,6 +14,10 @@ type MockedGRPCService struct { mock.Mock } +func (m *MockedGRPCService) GetAssociationState(ctx context.Context, in *svc.GetAssociationStateRequest, opts ...grpc.CallOption) (*svc.GetAssociationStateResponse, error) { + return nil, nil +} + func (m *MockedGRPCService) ValidateKeyPackages(ctx context.Context, req *svc.ValidateKeyPackagesRequest, opts ...grpc.CallOption) (*svc.ValidateKeyPackagesResponse, error) { args := m.Called(ctx, req) diff --git a/pkg/proto/identity/associations/association.pb.go b/pkg/proto/identity/associations/association.pb.go index 0f048ecb..bd74cbd7 100644 --- a/pkg/proto/identity/associations/association.pb.go +++ b/pkg/proto/identity/associations/association.pb.go @@ -104,6 +104,62 @@ func (*MemberIdentifier_Address) isMemberIdentifier_Kind() {} func (*MemberIdentifier_InstallationPublicKey) isMemberIdentifier_Kind() {} +// single member that optionally indicates the member that added them +type Member struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Identifier *MemberIdentifier `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` + AddedByEntity *MemberIdentifier `protobuf:"bytes,2,opt,name=added_by_entity,json=addedByEntity,proto3,oneof" json:"added_by_entity,omitempty"` +} + +func (x *Member) Reset() { + *x = Member{} + if protoimpl.UnsafeEnabled { + mi := &file_identity_associations_association_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Member) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Member) ProtoMessage() {} + +func (x *Member) ProtoReflect() protoreflect.Message { + mi := &file_identity_associations_association_proto_msgTypes[1] + 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 Member.ProtoReflect.Descriptor instead. +func (*Member) Descriptor() ([]byte, []int) { + return file_identity_associations_association_proto_rawDescGZIP(), []int{1} +} + +func (x *Member) GetIdentifier() *MemberIdentifier { + if x != nil { + return x.Identifier + } + return nil +} + +func (x *Member) GetAddedByEntity() *MemberIdentifier { + if x != nil { + return x.AddedByEntity + } + return nil +} + // The first entry of any XID log. The XID must be deterministically derivable // from the address and nonce. // The recovery address defaults to the initial associated_address unless @@ -121,7 +177,7 @@ type CreateInbox struct { func (x *CreateInbox) Reset() { *x = CreateInbox{} if protoimpl.UnsafeEnabled { - mi := &file_identity_associations_association_proto_msgTypes[1] + mi := &file_identity_associations_association_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -134,7 +190,7 @@ func (x *CreateInbox) String() string { func (*CreateInbox) ProtoMessage() {} func (x *CreateInbox) ProtoReflect() protoreflect.Message { - mi := &file_identity_associations_association_proto_msgTypes[1] + mi := &file_identity_associations_association_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -147,7 +203,7 @@ func (x *CreateInbox) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateInbox.ProtoReflect.Descriptor instead. func (*CreateInbox) Descriptor() ([]byte, []int) { - return file_identity_associations_association_proto_rawDescGZIP(), []int{1} + return file_identity_associations_association_proto_rawDescGZIP(), []int{2} } func (x *CreateInbox) GetInitialAddress() string { @@ -188,7 +244,7 @@ type AddAssociation struct { func (x *AddAssociation) Reset() { *x = AddAssociation{} if protoimpl.UnsafeEnabled { - mi := &file_identity_associations_association_proto_msgTypes[2] + mi := &file_identity_associations_association_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -201,7 +257,7 @@ func (x *AddAssociation) String() string { func (*AddAssociation) ProtoMessage() {} func (x *AddAssociation) ProtoReflect() protoreflect.Message { - mi := &file_identity_associations_association_proto_msgTypes[2] + mi := &file_identity_associations_association_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -214,7 +270,7 @@ func (x *AddAssociation) ProtoReflect() protoreflect.Message { // Deprecated: Use AddAssociation.ProtoReflect.Descriptor instead. func (*AddAssociation) Descriptor() ([]byte, []int) { - return file_identity_associations_association_proto_rawDescGZIP(), []int{2} + return file_identity_associations_association_proto_rawDescGZIP(), []int{3} } func (x *AddAssociation) GetNewMemberIdentifier() *MemberIdentifier { @@ -251,7 +307,7 @@ type RevokeAssociation struct { func (x *RevokeAssociation) Reset() { *x = RevokeAssociation{} if protoimpl.UnsafeEnabled { - mi := &file_identity_associations_association_proto_msgTypes[3] + mi := &file_identity_associations_association_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -264,7 +320,7 @@ func (x *RevokeAssociation) String() string { func (*RevokeAssociation) ProtoMessage() {} func (x *RevokeAssociation) ProtoReflect() protoreflect.Message { - mi := &file_identity_associations_association_proto_msgTypes[3] + mi := &file_identity_associations_association_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -277,7 +333,7 @@ func (x *RevokeAssociation) ProtoReflect() protoreflect.Message { // Deprecated: Use RevokeAssociation.ProtoReflect.Descriptor instead. func (*RevokeAssociation) Descriptor() ([]byte, []int) { - return file_identity_associations_association_proto_rawDescGZIP(), []int{3} + return file_identity_associations_association_proto_rawDescGZIP(), []int{4} } func (x *RevokeAssociation) GetMemberToRevoke() *MemberIdentifier { @@ -309,7 +365,7 @@ type ChangeRecoveryAddress struct { func (x *ChangeRecoveryAddress) Reset() { *x = ChangeRecoveryAddress{} if protoimpl.UnsafeEnabled { - mi := &file_identity_associations_association_proto_msgTypes[4] + mi := &file_identity_associations_association_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -322,7 +378,7 @@ func (x *ChangeRecoveryAddress) String() string { func (*ChangeRecoveryAddress) ProtoMessage() {} func (x *ChangeRecoveryAddress) ProtoReflect() protoreflect.Message { - mi := &file_identity_associations_association_proto_msgTypes[4] + mi := &file_identity_associations_association_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -335,7 +391,7 @@ func (x *ChangeRecoveryAddress) ProtoReflect() protoreflect.Message { // Deprecated: Use ChangeRecoveryAddress.ProtoReflect.Descriptor instead. func (*ChangeRecoveryAddress) Descriptor() ([]byte, []int) { - return file_identity_associations_association_proto_rawDescGZIP(), []int{4} + return file_identity_associations_association_proto_rawDescGZIP(), []int{5} } func (x *ChangeRecoveryAddress) GetNewRecoveryAddress() string { @@ -370,7 +426,7 @@ type IdentityAction struct { func (x *IdentityAction) Reset() { *x = IdentityAction{} if protoimpl.UnsafeEnabled { - mi := &file_identity_associations_association_proto_msgTypes[5] + mi := &file_identity_associations_association_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -383,7 +439,7 @@ func (x *IdentityAction) String() string { func (*IdentityAction) ProtoMessage() {} func (x *IdentityAction) ProtoReflect() protoreflect.Message { - mi := &file_identity_associations_association_proto_msgTypes[5] + mi := &file_identity_associations_association_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -396,7 +452,7 @@ func (x *IdentityAction) ProtoReflect() protoreflect.Message { // Deprecated: Use IdentityAction.ProtoReflect.Descriptor instead. func (*IdentityAction) Descriptor() ([]byte, []int) { - return file_identity_associations_association_proto_rawDescGZIP(), []int{5} + return file_identity_associations_association_proto_rawDescGZIP(), []int{6} } func (m *IdentityAction) GetKind() isIdentityAction_Kind { @@ -482,7 +538,7 @@ type IdentityUpdate struct { func (x *IdentityUpdate) Reset() { *x = IdentityUpdate{} if protoimpl.UnsafeEnabled { - mi := &file_identity_associations_association_proto_msgTypes[6] + mi := &file_identity_associations_association_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -495,7 +551,7 @@ func (x *IdentityUpdate) String() string { func (*IdentityUpdate) ProtoMessage() {} func (x *IdentityUpdate) ProtoReflect() protoreflect.Message { - mi := &file_identity_associations_association_proto_msgTypes[6] + mi := &file_identity_associations_association_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -508,7 +564,7 @@ func (x *IdentityUpdate) ProtoReflect() protoreflect.Message { // Deprecated: Use IdentityUpdate.ProtoReflect.Descriptor instead. func (*IdentityUpdate) Descriptor() ([]byte, []int) { - return file_identity_associations_association_proto_rawDescGZIP(), []int{6} + return file_identity_associations_association_proto_rawDescGZIP(), []int{7} } func (x *IdentityUpdate) GetActions() []*IdentityAction { @@ -532,6 +588,190 @@ func (x *IdentityUpdate) GetInboxId() string { return "" } +// Map of members belonging to an inbox_id +type MemberMap struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *MemberIdentifier `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value *Member `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *MemberMap) Reset() { + *x = MemberMap{} + if protoimpl.UnsafeEnabled { + mi := &file_identity_associations_association_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MemberMap) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemberMap) ProtoMessage() {} + +func (x *MemberMap) ProtoReflect() protoreflect.Message { + mi := &file_identity_associations_association_proto_msgTypes[8] + 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 MemberMap.ProtoReflect.Descriptor instead. +func (*MemberMap) Descriptor() ([]byte, []int) { + return file_identity_associations_association_proto_rawDescGZIP(), []int{8} +} + +func (x *MemberMap) GetKey() *MemberIdentifier { + if x != nil { + return x.Key + } + return nil +} + +func (x *MemberMap) GetValue() *Member { + if x != nil { + return x.Value + } + return nil +} + +// A final association state resulting from multiple `IdentityUpdates` +type AssociationState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InboxId string `protobuf:"bytes,1,opt,name=inbox_id,json=inboxId,proto3" json:"inbox_id,omitempty"` + Members []*MemberMap `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"` + RecoveryAddress string `protobuf:"bytes,3,opt,name=recovery_address,json=recoveryAddress,proto3" json:"recovery_address,omitempty"` + SeenSignatures [][]byte `protobuf:"bytes,4,rep,name=seen_signatures,json=seenSignatures,proto3" json:"seen_signatures,omitempty"` +} + +func (x *AssociationState) Reset() { + *x = AssociationState{} + if protoimpl.UnsafeEnabled { + mi := &file_identity_associations_association_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AssociationState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AssociationState) ProtoMessage() {} + +func (x *AssociationState) ProtoReflect() protoreflect.Message { + mi := &file_identity_associations_association_proto_msgTypes[9] + 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 AssociationState.ProtoReflect.Descriptor instead. +func (*AssociationState) Descriptor() ([]byte, []int) { + return file_identity_associations_association_proto_rawDescGZIP(), []int{9} +} + +func (x *AssociationState) GetInboxId() string { + if x != nil { + return x.InboxId + } + return "" +} + +func (x *AssociationState) GetMembers() []*MemberMap { + if x != nil { + return x.Members + } + return nil +} + +func (x *AssociationState) GetRecoveryAddress() string { + if x != nil { + return x.RecoveryAddress + } + return "" +} + +func (x *AssociationState) GetSeenSignatures() [][]byte { + if x != nil { + return x.SeenSignatures + } + return nil +} + +// / state diff between two final AssociationStates +type AssociationStateDiff struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NewMembers []*MemberIdentifier `protobuf:"bytes,1,rep,name=new_members,json=newMembers,proto3" json:"new_members,omitempty"` + RemovedMembers []*MemberIdentifier `protobuf:"bytes,2,rep,name=removed_members,json=removedMembers,proto3" json:"removed_members,omitempty"` +} + +func (x *AssociationStateDiff) Reset() { + *x = AssociationStateDiff{} + if protoimpl.UnsafeEnabled { + mi := &file_identity_associations_association_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AssociationStateDiff) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AssociationStateDiff) ProtoMessage() {} + +func (x *AssociationStateDiff) ProtoReflect() protoreflect.Message { + mi := &file_identity_associations_association_proto_msgTypes[10] + 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 AssociationStateDiff.ProtoReflect.Descriptor instead. +func (*AssociationStateDiff) Descriptor() ([]byte, []int) { + return file_identity_associations_association_proto_rawDescGZIP(), []int{10} +} + +func (x *AssociationStateDiff) GetNewMembers() []*MemberIdentifier { + if x != nil { + return x.NewMembers + } + return nil +} + +func (x *AssociationStateDiff) GetRemovedMembers() []*MemberIdentifier { + if x != nil { + return x.RemovedMembers + } + return nil +} + var File_identity_associations_association_proto protoreflect.FileDescriptor var file_identity_associations_association_proto_rawDesc = []byte{ @@ -548,111 +788,157 @@ var file_identity_associations_association_proto_rawDesc = []byte{ 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x15, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0xaf, - 0x01, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x27, - 0x0a, 0x0f, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x61, 0x0a, - 0x19, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x25, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x17, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x22, 0xae, 0x02, 0x0a, 0x0e, 0x41, 0x64, 0x64, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x60, 0x0a, 0x15, 0x6e, 0x65, 0x77, 0x5f, 0x6d, 0x65, 0x6d, 0x62, 0x65, - 0x72, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, - 0x52, 0x13, 0x6e, 0x65, 0x77, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x61, 0x0a, 0x19, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, - 0x67, 0x5f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, + 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0xc5, + 0x01, 0x0a, 0x06, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x4c, 0x0a, 0x0a, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, + 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, + 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x0a, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x59, 0x0a, 0x0f, 0x61, 0x64, 0x64, 0x65, 0x64, + 0x5f, 0x62, 0x79, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2c, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x48, 0x00, + 0x52, 0x0d, 0x61, 0x64, 0x64, 0x65, 0x64, 0x42, 0x79, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x88, + 0x01, 0x01, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x61, 0x64, 0x64, 0x65, 0x64, 0x5f, 0x62, 0x79, 0x5f, + 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x22, 0xaf, 0x01, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, + 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, + 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, + 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x61, 0x0a, 0x19, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, - 0x17, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x57, 0x0a, 0x14, 0x6e, 0x65, 0x77, 0x5f, - 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x12, 0x6e, - 0x65, 0x77, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x22, 0xd0, 0x01, 0x0a, 0x11, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x41, 0x73, 0x73, 0x6f, - 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x56, 0x0a, 0x10, 0x6d, 0x65, 0x6d, 0x62, 0x65, - 0x72, 0x5f, 0x74, 0x6f, 0x5f, 0x72, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2c, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, - 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, - 0x0e, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x54, 0x6f, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x12, - 0x63, 0x0a, 0x1a, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x18, 0x72, 0x65, 0x63, 0x6f, - 0x76, 0x65, 0x72, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x22, 0xbf, 0x01, 0x0a, 0x15, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, - 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x30, - 0x0a, 0x14, 0x6e, 0x65, 0x77, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6e, 0x65, - 0x77, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x12, 0x74, 0x0a, 0x23, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x65, 0x63, - 0x6f, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, - 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, - 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x52, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, - 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xdc, 0x02, 0x0a, 0x0e, 0x49, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x74, 0x79, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4c, 0x0a, 0x0c, 0x63, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x5f, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x27, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, - 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x48, 0x00, 0x52, 0x0b, 0x63, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x3e, 0x0a, 0x03, 0x61, 0x64, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x41, 0x64, 0x64, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x48, 0x00, 0x52, 0x03, 0x61, 0x64, 0x64, 0x12, 0x47, 0x0a, 0x06, 0x72, 0x65, 0x76, 0x6f, 0x6b, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, + 0x17, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xae, 0x02, 0x0a, 0x0e, 0x41, 0x64, 0x64, + 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x60, 0x0a, 0x15, 0x6e, + 0x65, 0x77, 0x5f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x78, 0x6d, 0x74, + 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, + 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x13, 0x6e, 0x65, 0x77, 0x4d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x61, 0x0a, + 0x19, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, + 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x25, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x17, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, + 0x67, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x12, 0x57, 0x0a, 0x14, 0x6e, 0x65, 0x77, 0x5f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, + 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, + 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x12, 0x6e, 0x65, 0x77, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xd0, 0x01, 0x0a, 0x11, 0x52, 0x65, + 0x76, 0x6f, 0x6b, 0x65, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x56, 0x0a, 0x10, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x5f, 0x72, 0x65, 0x76, + 0x6f, 0x6b, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x78, 0x6d, 0x74, 0x70, + 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x0e, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x54, + 0x6f, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x12, 0x63, 0x0a, 0x1a, 0x72, 0x65, 0x63, 0x6f, 0x76, + 0x65, 0x72, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x78, 0x6d, + 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, + 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x52, 0x18, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xbf, 0x01, 0x0a, + 0x15, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x30, 0x0a, 0x14, 0x6e, 0x65, 0x77, 0x5f, 0x72, 0x65, + 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6e, 0x65, 0x77, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, + 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x74, 0x0a, 0x23, 0x65, 0x78, 0x69, 0x73, + 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x20, 0x65, 0x78, + 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xdc, + 0x02, 0x0a, 0x0e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x41, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x4c, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x69, 0x6e, 0x62, 0x6f, + 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x41, 0x73, 0x73, 0x6f, 0x63, - 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x76, 0x6f, 0x6b, 0x65, - 0x12, 0x6b, 0x0a, 0x17, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x76, - 0x65, 0x72, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x31, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, - 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x48, 0x00, 0x52, 0x15, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, - 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x06, 0x0a, - 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0xa1, 0x01, 0x0a, 0x0e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x74, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x44, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x78, 0x6d, 0x74, 0x70, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, + 0x48, 0x00, 0x52, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, + 0x3e, 0x0a, 0x03, 0x61, 0x64, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x78, + 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, + 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x41, 0x73, 0x73, + 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x03, 0x61, 0x64, 0x64, 0x12, + 0x47, 0x0a, 0x06, 0x72, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, + 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x76, + 0x6f, 0x6b, 0x65, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, + 0x52, 0x06, 0x72, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x12, 0x6b, 0x0a, 0x17, 0x63, 0x68, 0x61, 0x6e, + 0x67, 0x65, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x41, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2e, - 0x0a, 0x13, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x5f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x4e, 0x73, 0x12, 0x19, - 0x0a, 0x08, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x49, 0x64, 0x42, 0xfa, 0x01, 0x0a, 0x1e, 0x63, 0x6f, - 0x6d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, - 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x10, 0x41, 0x73, - 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x3c, 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, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x2f, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xa2, 0x02, - 0x03, 0x58, 0x49, 0x41, 0xaa, 0x02, 0x1a, 0x58, 0x6d, 0x74, 0x70, 0x2e, 0x49, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x74, 0x79, 0x2e, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0xca, 0x02, 0x1a, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x5c, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xe2, 0x02, - 0x26, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5c, 0x41, - 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1c, 0x58, 0x6d, 0x74, 0x70, 0x3a, 0x3a, - 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x3a, 0x3a, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x63, + 0x6f, 0x76, 0x65, 0x72, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x48, 0x00, 0x52, 0x15, + 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0xa1, 0x01, + 0x0a, 0x0e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x12, 0x44, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x2a, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x6e, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x11, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x4e, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x5f, + 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x49, + 0x64, 0x22, 0x85, 0x01, 0x0a, 0x09, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x61, 0x70, 0x12, + 0x3e, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x78, + 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, + 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x38, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, + 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xc2, 0x01, 0x0a, 0x10, 0x41, 0x73, + 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x19, + 0x0a, 0x08, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x49, 0x64, 0x12, 0x3f, 0x0a, 0x07, 0x6d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x78, 0x6d, 0x74, + 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, + 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x61, + 0x70, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, + 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x65, 0x65, 0x6e, 0x5f, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0e, + 0x73, 0x65, 0x65, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x22, 0xbc, + 0x01, 0x0a, 0x14, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x44, 0x69, 0x66, 0x66, 0x12, 0x4d, 0x0a, 0x0b, 0x6e, 0x65, 0x77, 0x5f, 0x6d, + 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x78, + 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, + 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x0a, 0x6e, 0x65, 0x77, 0x4d, + 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x12, 0x55, 0x0a, 0x0f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, + 0x64, 0x5f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2c, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, + 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x0e, 0x72, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x42, 0xfa, 0x01, + 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x42, 0x10, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3c, 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, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0xa2, 0x02, 0x03, 0x58, 0x49, 0x41, 0xaa, 0x02, 0x1a, 0x58, 0x6d, 0x74, 0x70, 0x2e, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xca, 0x02, 0x1a, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5c, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0xe2, 0x02, 0x26, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x5c, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1c, 0x58, 0x6d, + 0x74, 0x70, 0x3a, 0x3a, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x3a, 0x3a, 0x41, 0x73, + 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -667,35 +953,46 @@ func file_identity_associations_association_proto_rawDescGZIP() []byte { return file_identity_associations_association_proto_rawDescData } -var file_identity_associations_association_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_identity_associations_association_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_identity_associations_association_proto_goTypes = []interface{}{ (*MemberIdentifier)(nil), // 0: xmtp.identity.associations.MemberIdentifier - (*CreateInbox)(nil), // 1: xmtp.identity.associations.CreateInbox - (*AddAssociation)(nil), // 2: xmtp.identity.associations.AddAssociation - (*RevokeAssociation)(nil), // 3: xmtp.identity.associations.RevokeAssociation - (*ChangeRecoveryAddress)(nil), // 4: xmtp.identity.associations.ChangeRecoveryAddress - (*IdentityAction)(nil), // 5: xmtp.identity.associations.IdentityAction - (*IdentityUpdate)(nil), // 6: xmtp.identity.associations.IdentityUpdate - (*Signature)(nil), // 7: xmtp.identity.associations.Signature + (*Member)(nil), // 1: xmtp.identity.associations.Member + (*CreateInbox)(nil), // 2: xmtp.identity.associations.CreateInbox + (*AddAssociation)(nil), // 3: xmtp.identity.associations.AddAssociation + (*RevokeAssociation)(nil), // 4: xmtp.identity.associations.RevokeAssociation + (*ChangeRecoveryAddress)(nil), // 5: xmtp.identity.associations.ChangeRecoveryAddress + (*IdentityAction)(nil), // 6: xmtp.identity.associations.IdentityAction + (*IdentityUpdate)(nil), // 7: xmtp.identity.associations.IdentityUpdate + (*MemberMap)(nil), // 8: xmtp.identity.associations.MemberMap + (*AssociationState)(nil), // 9: xmtp.identity.associations.AssociationState + (*AssociationStateDiff)(nil), // 10: xmtp.identity.associations.AssociationStateDiff + (*Signature)(nil), // 11: xmtp.identity.associations.Signature } var file_identity_associations_association_proto_depIdxs = []int32{ - 7, // 0: xmtp.identity.associations.CreateInbox.initial_address_signature:type_name -> xmtp.identity.associations.Signature - 0, // 1: xmtp.identity.associations.AddAssociation.new_member_identifier:type_name -> xmtp.identity.associations.MemberIdentifier - 7, // 2: xmtp.identity.associations.AddAssociation.existing_member_signature:type_name -> xmtp.identity.associations.Signature - 7, // 3: xmtp.identity.associations.AddAssociation.new_member_signature:type_name -> xmtp.identity.associations.Signature - 0, // 4: xmtp.identity.associations.RevokeAssociation.member_to_revoke:type_name -> xmtp.identity.associations.MemberIdentifier - 7, // 5: xmtp.identity.associations.RevokeAssociation.recovery_address_signature:type_name -> xmtp.identity.associations.Signature - 7, // 6: xmtp.identity.associations.ChangeRecoveryAddress.existing_recovery_address_signature:type_name -> xmtp.identity.associations.Signature - 1, // 7: xmtp.identity.associations.IdentityAction.create_inbox:type_name -> xmtp.identity.associations.CreateInbox - 2, // 8: xmtp.identity.associations.IdentityAction.add:type_name -> xmtp.identity.associations.AddAssociation - 3, // 9: xmtp.identity.associations.IdentityAction.revoke:type_name -> xmtp.identity.associations.RevokeAssociation - 4, // 10: xmtp.identity.associations.IdentityAction.change_recovery_address:type_name -> xmtp.identity.associations.ChangeRecoveryAddress - 5, // 11: xmtp.identity.associations.IdentityUpdate.actions:type_name -> xmtp.identity.associations.IdentityAction - 12, // [12:12] is the sub-list for method output_type - 12, // [12:12] is the sub-list for method input_type - 12, // [12:12] is the sub-list for extension type_name - 12, // [12:12] is the sub-list for extension extendee - 0, // [0:12] is the sub-list for field type_name + 0, // 0: xmtp.identity.associations.Member.identifier:type_name -> xmtp.identity.associations.MemberIdentifier + 0, // 1: xmtp.identity.associations.Member.added_by_entity:type_name -> xmtp.identity.associations.MemberIdentifier + 11, // 2: xmtp.identity.associations.CreateInbox.initial_address_signature:type_name -> xmtp.identity.associations.Signature + 0, // 3: xmtp.identity.associations.AddAssociation.new_member_identifier:type_name -> xmtp.identity.associations.MemberIdentifier + 11, // 4: xmtp.identity.associations.AddAssociation.existing_member_signature:type_name -> xmtp.identity.associations.Signature + 11, // 5: xmtp.identity.associations.AddAssociation.new_member_signature:type_name -> xmtp.identity.associations.Signature + 0, // 6: xmtp.identity.associations.RevokeAssociation.member_to_revoke:type_name -> xmtp.identity.associations.MemberIdentifier + 11, // 7: xmtp.identity.associations.RevokeAssociation.recovery_address_signature:type_name -> xmtp.identity.associations.Signature + 11, // 8: xmtp.identity.associations.ChangeRecoveryAddress.existing_recovery_address_signature:type_name -> xmtp.identity.associations.Signature + 2, // 9: xmtp.identity.associations.IdentityAction.create_inbox:type_name -> xmtp.identity.associations.CreateInbox + 3, // 10: xmtp.identity.associations.IdentityAction.add:type_name -> xmtp.identity.associations.AddAssociation + 4, // 11: xmtp.identity.associations.IdentityAction.revoke:type_name -> xmtp.identity.associations.RevokeAssociation + 5, // 12: xmtp.identity.associations.IdentityAction.change_recovery_address:type_name -> xmtp.identity.associations.ChangeRecoveryAddress + 6, // 13: xmtp.identity.associations.IdentityUpdate.actions:type_name -> xmtp.identity.associations.IdentityAction + 0, // 14: xmtp.identity.associations.MemberMap.key:type_name -> xmtp.identity.associations.MemberIdentifier + 1, // 15: xmtp.identity.associations.MemberMap.value:type_name -> xmtp.identity.associations.Member + 8, // 16: xmtp.identity.associations.AssociationState.members:type_name -> xmtp.identity.associations.MemberMap + 0, // 17: xmtp.identity.associations.AssociationStateDiff.new_members:type_name -> xmtp.identity.associations.MemberIdentifier + 0, // 18: xmtp.identity.associations.AssociationStateDiff.removed_members:type_name -> xmtp.identity.associations.MemberIdentifier + 19, // [19:19] is the sub-list for method output_type + 19, // [19:19] is the sub-list for method input_type + 19, // [19:19] is the sub-list for extension type_name + 19, // [19:19] is the sub-list for extension extendee + 0, // [0:19] is the sub-list for field type_name } func init() { file_identity_associations_association_proto_init() } @@ -718,7 +1015,7 @@ func file_identity_associations_association_proto_init() { } } file_identity_associations_association_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateInbox); i { + switch v := v.(*Member); i { case 0: return &v.state case 1: @@ -730,7 +1027,7 @@ func file_identity_associations_association_proto_init() { } } file_identity_associations_association_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddAssociation); i { + switch v := v.(*CreateInbox); i { case 0: return &v.state case 1: @@ -742,7 +1039,7 @@ func file_identity_associations_association_proto_init() { } } file_identity_associations_association_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RevokeAssociation); i { + switch v := v.(*AddAssociation); i { case 0: return &v.state case 1: @@ -754,7 +1051,7 @@ func file_identity_associations_association_proto_init() { } } file_identity_associations_association_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChangeRecoveryAddress); i { + switch v := v.(*RevokeAssociation); i { case 0: return &v.state case 1: @@ -766,7 +1063,7 @@ func file_identity_associations_association_proto_init() { } } file_identity_associations_association_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IdentityAction); i { + switch v := v.(*ChangeRecoveryAddress); i { case 0: return &v.state case 1: @@ -778,6 +1075,18 @@ func file_identity_associations_association_proto_init() { } } file_identity_associations_association_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdentityAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_identity_associations_association_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IdentityUpdate); i { case 0: return &v.state @@ -789,12 +1098,49 @@ func file_identity_associations_association_proto_init() { return nil } } + file_identity_associations_association_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MemberMap); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_identity_associations_association_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AssociationState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_identity_associations_association_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AssociationStateDiff); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_identity_associations_association_proto_msgTypes[0].OneofWrappers = []interface{}{ (*MemberIdentifier_Address)(nil), (*MemberIdentifier_InstallationPublicKey)(nil), } - file_identity_associations_association_proto_msgTypes[5].OneofWrappers = []interface{}{ + file_identity_associations_association_proto_msgTypes[1].OneofWrappers = []interface{}{} + file_identity_associations_association_proto_msgTypes[6].OneofWrappers = []interface{}{ (*IdentityAction_CreateInbox)(nil), (*IdentityAction_Add)(nil), (*IdentityAction_Revoke)(nil), @@ -806,7 +1152,7 @@ func file_identity_associations_association_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_identity_associations_association_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 11, NumExtensions: 0, NumServices: 0, }, diff --git a/pkg/proto/keystore_api/v1/keystore.pb.go b/pkg/proto/keystore_api/v1/keystore.pb.go index 155e836c..3aa3a2ee 100644 --- a/pkg/proto/keystore_api/v1/keystore.pb.go +++ b/pkg/proto/keystore_api/v1/keystore.pb.go @@ -718,9 +718,10 @@ type CreateInviteRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Context *message_contents.InvitationV1_Context `protobuf:"bytes,1,opt,name=context,proto3" json:"context,omitempty"` - Recipient *message_contents.SignedPublicKeyBundle `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"` - CreatedNs uint64 `protobuf:"varint,3,opt,name=created_ns,json=createdNs,proto3" json:"created_ns,omitempty"` + Context *message_contents.InvitationV1_Context `protobuf:"bytes,1,opt,name=context,proto3" json:"context,omitempty"` + Recipient *message_contents.SignedPublicKeyBundle `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"` + CreatedNs uint64 `protobuf:"varint,3,opt,name=created_ns,json=createdNs,proto3" json:"created_ns,omitempty"` + ConsentProof *message_contents.ConsentProofPayload `protobuf:"bytes,4,opt,name=consent_proof,json=consentProof,proto3" json:"consent_proof,omitempty"` } func (x *CreateInviteRequest) Reset() { @@ -776,6 +777,13 @@ func (x *CreateInviteRequest) GetCreatedNs() uint64 { return 0 } +func (x *CreateInviteRequest) GetConsentProof() *message_contents.ConsentProofPayload { + if x != nil { + return x.ConsentProof + } + return nil +} + // Response to a CreateInviteRequest type CreateInviteResponse struct { state protoimpl.MessageState @@ -3042,8 +3050,8 @@ var file_keystore_api_v1_keystore_proto_rawDesc = []byte{ 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0xc7, - 0x01, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x52, + 0x28, 0x09, 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x98, + 0x02, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x45, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, @@ -3055,210 +3063,215 @@ var file_keystore_api_v1_keystore_proto_rawDesc = []byte{ 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, 0x82, 0x01, 0x0a, 0x14, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x50, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 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, - 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0xcf, 0x01, - 0x0a, 0x12, 0x53, 0x61, 0x76, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x4c, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, 0x65, - 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x61, - 0x76, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x73, 0x1a, 0x6b, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, - 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x6f, 0x70, - 0x69, 0x63, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, - 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x4e, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, - 0xf0, 0x02, 0x0a, 0x13, 0x53, 0x61, 0x76, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x78, 0x6d, 0x74, - 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x09, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x1a, 0x86, 0x02, 0x0a, 0x08, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, 0x65, - 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x61, - 0x76, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x75, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x3b, 0x0a, 0x05, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x78, 0x6d, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x73, 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, 0x22, 0x82, 0x01, 0x0a, 0x14, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x50, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 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, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x66, + 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0xcf, + 0x01, 0x0a, 0x12, 0x53, 0x61, 0x76, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4c, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, + 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, + 0x61, 0x76, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x73, 0x1a, 0x6b, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, + 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x6f, + 0x70, 0x69, 0x63, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x5f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x4e, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x22, 0xf0, 0x02, 0x0a, 0x13, 0x53, 0x61, 0x76, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, - 0x48, 0x00, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x1a, 0x5b, 0x0a, 0x07, 0x53, 0x75, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x12, 0x50, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 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, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, - 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x51, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x0c, - 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x04, 0x48, 0x00, 0x52, 0x0b, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x4e, - 0x73, 0x88, 0x01, 0x01, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x5f, 0x6e, 0x73, 0x22, 0x70, 0x0a, 0x1a, 0x53, 0x61, 0x76, 0x65, 0x56, 0x31, 0x43, - 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x52, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, + 0x76, 0x31, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, + 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x1a, 0x86, 0x02, 0x0a, 0x08, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, + 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, + 0x61, 0x76, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x75, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x3b, 0x0a, + 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x78, + 0x6d, 0x74, 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x48, 0x00, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x1a, 0x5b, 0x0a, 0x07, 0x53, 0x75, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x50, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x76, 0x65, + 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x51, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, + 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, + 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x6e, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x0b, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x4e, 0x73, 0x88, 0x01, 0x01, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x5f, 0x6e, 0x73, 0x22, 0x70, 0x0a, 0x1a, 0x53, 0x61, 0x76, 0x65, 0x56, 0x31, + 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x52, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 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, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, + 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x1d, 0x0a, 0x1b, 0x53, 0x61, 0x76, 0x65, + 0x56, 0x31, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x6e, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x43, 0x6f, + 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 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, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, - 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x1d, 0x0a, 0x1b, 0x53, 0x61, 0x76, 0x65, 0x56, - 0x31, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x6e, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, - 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x52, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 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, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x41, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x5f, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x77, 0x61, 0x6c, 0x6c, - 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xea, 0x01, 0x0a, 0x19, 0x47, 0x65, - 0x74, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3e, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, - 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, + 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x41, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x4b, 0x65, + 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x5f, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x77, 0x61, 0x6c, + 0x6c, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xea, 0x01, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, - 0x75, 0x0a, 0x0e, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x1f, 0x0a, 0x1b, 0x4b, 0x45, 0x59, 0x53, 0x54, 0x4f, 0x52, 0x45, 0x5f, 0x53, 0x54, - 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, - 0x10, 0x00, 0x12, 0x21, 0x0a, 0x1d, 0x4b, 0x45, 0x59, 0x53, 0x54, 0x4f, 0x52, 0x45, 0x5f, 0x53, - 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x4c, 0x49, - 0x5a, 0x45, 0x44, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x4b, 0x45, 0x59, 0x53, 0x54, 0x4f, 0x52, - 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x4c, - 0x49, 0x5a, 0x45, 0x44, 0x10, 0x02, 0x22, 0x5c, 0x0a, 0x13, 0x49, 0x6e, 0x69, 0x74, 0x4b, 0x65, - 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x42, 0x75, 0x6e, 0x64, - 0x6c, 0x65, 0x56, 0x31, 0x48, 0x00, 0x52, 0x02, 0x76, 0x31, 0x42, 0x08, 0x0a, 0x06, 0x62, 0x75, - 0x6e, 0x64, 0x6c, 0x65, 0x22, 0x51, 0x0a, 0x14, 0x49, 0x6e, 0x69, 0x74, 0x4b, 0x65, 0x79, 0x73, - 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x05, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x78, 0x6d, - 0x74, 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, - 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x7f, 0x0a, 0x11, 0x53, 0x69, 0x67, 0x6e, 0x44, - 0x69, 0x67, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, - 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x64, 0x69, - 0x67, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0c, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x0b, 0x69, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0c, 0x70, 0x72, 0x65, - 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x00, 0x52, 0x0b, 0x70, 0x72, 0x65, 0x6b, 0x65, 0x79, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x42, 0x08, - 0x0a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x22, 0x50, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x52, - 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x38, 0x0a, 0x08, 0x6a, 0x6f, 0x62, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, - 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4a, 0x6f, 0x62, 0x54, 0x79, 0x70, - 0x65, 0x52, 0x07, 0x6a, 0x6f, 0x62, 0x54, 0x79, 0x70, 0x65, 0x22, 0x37, 0x0a, 0x15, 0x47, 0x65, - 0x74, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x72, 0x75, 0x6e, 0x5f, - 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x52, 0x75, - 0x6e, 0x4e, 0x73, 0x22, 0x6f, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x52, 0x65, 0x66, 0x65, 0x73, 0x68, - 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x08, 0x6a, 0x6f, - 0x62, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x78, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3e, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, + 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, + 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x22, 0x75, 0x0a, 0x0e, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x1b, 0x4b, 0x45, 0x59, 0x53, 0x54, 0x4f, 0x52, 0x45, 0x5f, 0x53, + 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x21, 0x0a, 0x1d, 0x4b, 0x45, 0x59, 0x53, 0x54, 0x4f, 0x52, 0x45, 0x5f, + 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x4c, + 0x49, 0x5a, 0x45, 0x44, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x4b, 0x45, 0x59, 0x53, 0x54, 0x4f, + 0x52, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, + 0x4c, 0x49, 0x5a, 0x45, 0x44, 0x10, 0x02, 0x22, 0x5c, 0x0a, 0x13, 0x49, 0x6e, 0x69, 0x74, 0x4b, + 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x42, 0x75, 0x6e, + 0x64, 0x6c, 0x65, 0x56, 0x31, 0x48, 0x00, 0x52, 0x02, 0x76, 0x31, 0x42, 0x08, 0x0a, 0x06, 0x62, + 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x22, 0x51, 0x0a, 0x14, 0x49, 0x6e, 0x69, 0x74, 0x4b, 0x65, 0x79, + 0x73, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, + 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x31, 0x2e, 0x4a, 0x6f, 0x62, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x6a, 0x6f, 0x62, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x72, 0x75, 0x6e, - 0x5f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x52, - 0x75, 0x6e, 0x4e, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x52, 0x65, 0x66, 0x72, 0x65, - 0x73, 0x68, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xc8, 0x02, - 0x0a, 0x08, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x4d, 0x61, 0x70, 0x12, 0x42, 0x0a, 0x06, 0x74, 0x6f, - 0x70, 0x69, 0x63, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x78, 0x6d, 0x74, + 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x7f, 0x0a, 0x11, 0x53, 0x69, 0x67, 0x6e, + 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, + 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x64, + 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0c, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x0b, 0x69, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0c, 0x70, 0x72, + 0x65, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x00, 0x52, 0x0b, 0x70, 0x72, 0x65, 0x6b, 0x65, 0x79, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x42, + 0x08, 0x0a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x22, 0x50, 0x0a, 0x14, 0x47, 0x65, 0x74, + 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x38, 0x0a, 0x08, 0x6a, 0x6f, 0x62, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4a, 0x6f, 0x62, 0x54, 0x79, + 0x70, 0x65, 0x52, 0x07, 0x6a, 0x6f, 0x62, 0x54, 0x79, 0x70, 0x65, 0x22, 0x37, 0x0a, 0x15, 0x47, + 0x65, 0x74, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x72, 0x75, 0x6e, + 0x5f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x52, + 0x75, 0x6e, 0x4e, 0x73, 0x22, 0x6f, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x52, 0x65, 0x66, 0x65, 0x73, + 0x68, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x08, 0x6a, + 0x6f, 0x62, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, + 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4a, 0x6f, 0x62, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x6a, 0x6f, + 0x62, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x72, 0x75, + 0x6e, 0x5f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6c, 0x61, 0x73, 0x74, + 0x52, 0x75, 0x6e, 0x4e, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x52, 0x65, 0x66, 0x72, + 0x65, 0x73, 0x68, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xc8, + 0x02, 0x0a, 0x08, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x4d, 0x61, 0x70, 0x12, 0x42, 0x0a, 0x06, 0x74, + 0x6f, 0x70, 0x69, 0x63, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x78, 0x6d, + 0x74, 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x4d, 0x61, 0x70, 0x2e, 0x54, 0x6f, 0x70, 0x69, + 0x63, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x1a, + 0x92, 0x01, 0x0a, 0x09, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1d, 0x0a, + 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x73, 0x12, 0x21, 0x0a, 0x0c, + 0x70, 0x65, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x70, 0x65, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, + 0x43, 0x0a, 0x0a, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x23, 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, 0x52, 0x0a, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x63, 0x0a, 0x0b, 0x54, 0x6f, 0x70, 0x69, 0x63, 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, 0x3e, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x6f, 0x70, 0x69, + 0x63, 0x4d, 0x61, 0x70, 0x2e, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x38, 0x0a, 0x1e, 0x47, 0x65, 0x74, + 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x6d, 0x61, 0x63, + 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, + 0x6f, 0x70, 0x69, 0x63, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x74, 0x6f, 0x70, + 0x69, 0x63, 0x73, 0x22, 0xd5, 0x03, 0x0a, 0x1f, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, + 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x60, 0x0a, 0x09, 0x68, 0x6d, 0x61, 0x63, 0x5f, + 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x4d, 0x61, 0x70, 0x2e, 0x54, 0x6f, 0x70, 0x69, 0x63, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x1a, 0x92, - 0x01, 0x0a, 0x09, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1d, 0x0a, 0x0a, - 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x70, - 0x65, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x70, 0x65, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x43, - 0x0a, 0x0a, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x23, 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, 0x52, 0x0a, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x1a, 0x63, 0x0a, 0x0b, 0x54, 0x6f, 0x70, 0x69, 0x63, 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, 0x3e, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, - 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x6f, 0x70, 0x69, 0x63, - 0x4d, 0x61, 0x70, 0x2e, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x38, 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x43, - 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x6d, 0x61, 0x63, 0x4b, - 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x6f, - 0x70, 0x69, 0x63, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x74, 0x6f, 0x70, 0x69, - 0x63, 0x73, 0x22, 0xd5, 0x03, 0x0a, 0x1f, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, - 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x60, 0x0a, 0x09, 0x68, 0x6d, 0x61, 0x63, 0x5f, 0x6b, - 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x78, 0x6d, 0x74, 0x70, - 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x48, 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x2e, 0x48, 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, - 0x68, 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x1a, 0x6c, 0x0a, 0x0b, 0x48, 0x6d, 0x61, 0x63, - 0x4b, 0x65, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x42, 0x0a, 0x1e, 0x74, 0x68, 0x69, 0x72, 0x74, - 0x79, 0x5f, 0x64, 0x61, 0x79, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x73, 0x5f, 0x73, 0x69, - 0x6e, 0x63, 0x65, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x1a, 0x74, 0x68, 0x69, 0x72, 0x74, 0x79, 0x44, 0x61, 0x79, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, - 0x73, 0x53, 0x69, 0x6e, 0x63, 0x65, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x19, 0x0a, 0x08, 0x68, - 0x6d, 0x61, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x68, - 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 0x1a, 0x65, 0x0a, 0x08, 0x48, 0x6d, 0x61, 0x63, 0x4b, 0x65, - 0x79, 0x73, 0x12, 0x59, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, - 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, - 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x48, 0x6d, 0x61, 0x63, 0x4b, 0x65, - 0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x1a, 0x7b, 0x0a, - 0x0d, 0x48, 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 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, 0x54, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x3e, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, - 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x48, 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x68, 0x0a, 0x09, 0x45, 0x72, - 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x45, 0x52, 0x52, 0x4f, 0x52, - 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x43, 0x4f, 0x44, - 0x45, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x49, 0x4e, 0x50, 0x55, 0x54, 0x10, - 0x01, 0x12, 0x21, 0x0a, 0x1d, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, - 0x4e, 0x4f, 0x5f, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x52, 0x45, 0x4b, - 0x45, 0x59, 0x10, 0x02, 0x2a, 0x70, 0x0a, 0x07, 0x4a, 0x6f, 0x62, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x18, 0x0a, 0x14, 0x4a, 0x4f, 0x42, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x4a, 0x4f, 0x42, - 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x46, 0x52, 0x45, 0x53, 0x48, 0x5f, 0x56, 0x31, - 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x4a, 0x4f, 0x42, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, - 0x45, 0x46, 0x52, 0x45, 0x53, 0x48, 0x5f, 0x56, 0x32, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x4a, - 0x4f, 0x42, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x46, 0x52, 0x45, 0x53, 0x48, 0x5f, - 0x50, 0x50, 0x50, 0x50, 0x10, 0x03, 0x42, 0xde, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x78, - 0x6d, 0x74, 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x31, 0x42, 0x0d, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x45, 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, 0x6b, 0x65, 0x79, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x6b, 0x65, 0x79, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x58, 0x4b, - 0x58, 0xaa, 0x02, 0x13, 0x58, 0x6d, 0x74, 0x70, 0x2e, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4b, - 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, - 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x41, 0x70, 0x69, - 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x15, 0x58, 0x6d, 0x74, 0x70, 0x3a, 0x3a, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x48, 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x2e, 0x48, 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x08, 0x68, 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x1a, 0x6c, 0x0a, 0x0b, 0x48, 0x6d, 0x61, + 0x63, 0x4b, 0x65, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x42, 0x0a, 0x1e, 0x74, 0x68, 0x69, 0x72, + 0x74, 0x79, 0x5f, 0x64, 0x61, 0x79, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x73, 0x5f, 0x73, + 0x69, 0x6e, 0x63, 0x65, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x1a, 0x74, 0x68, 0x69, 0x72, 0x74, 0x79, 0x44, 0x61, 0x79, 0x50, 0x65, 0x72, 0x69, 0x6f, + 0x64, 0x73, 0x53, 0x69, 0x6e, 0x63, 0x65, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x19, 0x0a, 0x08, + 0x68, 0x6d, 0x61, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, + 0x68, 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 0x1a, 0x65, 0x0a, 0x08, 0x48, 0x6d, 0x61, 0x63, 0x4b, + 0x65, 0x79, 0x73, 0x12, 0x59, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, + 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x6d, 0x61, 0x63, 0x4b, 0x65, + 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x48, 0x6d, 0x61, 0x63, 0x4b, + 0x65, 0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x1a, 0x7b, + 0x0a, 0x0d, 0x48, 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 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, 0x54, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x3e, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, + 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, + 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x48, 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 0x73, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x68, 0x0a, 0x09, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x45, 0x52, 0x52, 0x4f, + 0x52, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x43, 0x4f, + 0x44, 0x45, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x49, 0x4e, 0x50, 0x55, 0x54, + 0x10, 0x01, 0x12, 0x21, 0x0a, 0x1d, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x43, 0x4f, 0x44, 0x45, + 0x5f, 0x4e, 0x4f, 0x5f, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x52, 0x45, + 0x4b, 0x45, 0x59, 0x10, 0x02, 0x2a, 0x70, 0x0a, 0x07, 0x4a, 0x6f, 0x62, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x18, 0x0a, 0x14, 0x4a, 0x4f, 0x42, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, + 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x4a, 0x4f, + 0x42, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x46, 0x52, 0x45, 0x53, 0x48, 0x5f, 0x56, + 0x31, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x4a, 0x4f, 0x42, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x52, 0x45, 0x46, 0x52, 0x45, 0x53, 0x48, 0x5f, 0x56, 0x32, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, + 0x4a, 0x4f, 0x42, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x46, 0x52, 0x45, 0x53, 0x48, + 0x5f, 0x50, 0x50, 0x50, 0x50, 0x10, 0x03, 0x42, 0xde, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, + 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x31, 0x42, 0x0d, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x45, 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, 0x6b, 0x65, + 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x6b, 0x65, + 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x58, + 0x4b, 0x58, 0xaa, 0x02, 0x13, 0x58, 0x6d, 0x74, 0x70, 0x2e, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, + 0x72, 0x65, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x58, 0x6d, 0x74, 0x70, 0x5c, + 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, + 0x1f, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x41, 0x70, + 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x15, 0x58, 0x6d, 0x74, 0x70, 0x3a, 0x3a, 0x4b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, + 0x65, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3332,11 +3345,12 @@ var file_keystore_api_v1_keystore_proto_goTypes = []interface{}{ nil, // 53: xmtp.keystore_api.v1.GetConversationHmacKeysResponse.HmacKeysEntry (*message_contents.InvitationV1_Context)(nil), // 54: xmtp.message_contents.InvitationV1.Context (*message_contents.SignedPublicKeyBundle)(nil), // 55: xmtp.message_contents.SignedPublicKeyBundle - (*message_contents.ConversationReference)(nil), // 56: xmtp.message_contents.ConversationReference - (*message_contents.PrivateKeyBundleV1)(nil), // 57: xmtp.message_contents.PrivateKeyBundleV1 - (*message_contents.Ciphertext)(nil), // 58: xmtp.message_contents.Ciphertext - (*message_contents.PublicKeyBundle)(nil), // 59: xmtp.message_contents.PublicKeyBundle - (*message_contents.InvitationV1)(nil), // 60: xmtp.message_contents.InvitationV1 + (*message_contents.ConsentProofPayload)(nil), // 56: xmtp.message_contents.ConsentProofPayload + (*message_contents.ConversationReference)(nil), // 57: xmtp.message_contents.ConversationReference + (*message_contents.PrivateKeyBundleV1)(nil), // 58: xmtp.message_contents.PrivateKeyBundleV1 + (*message_contents.Ciphertext)(nil), // 59: xmtp.message_contents.Ciphertext + (*message_contents.PublicKeyBundle)(nil), // 60: xmtp.message_contents.PublicKeyBundle + (*message_contents.InvitationV1)(nil), // 61: xmtp.message_contents.InvitationV1 } var file_keystore_api_v1_keystore_proto_depIdxs = []int32{ 0, // 0: xmtp.keystore_api.v1.KeystoreError.code:type_name -> xmtp.keystore_api.v1.ErrorCode @@ -3351,41 +3365,42 @@ var file_keystore_api_v1_keystore_proto_depIdxs = []int32{ 45, // 9: xmtp.keystore_api.v1.SelfDecryptRequest.requests:type_name -> xmtp.keystore_api.v1.SelfDecryptRequest.Request 54, // 10: xmtp.keystore_api.v1.CreateInviteRequest.context:type_name -> xmtp.message_contents.InvitationV1.Context 55, // 11: xmtp.keystore_api.v1.CreateInviteRequest.recipient:type_name -> xmtp.message_contents.SignedPublicKeyBundle - 56, // 12: xmtp.keystore_api.v1.CreateInviteResponse.conversation:type_name -> xmtp.message_contents.ConversationReference - 46, // 13: xmtp.keystore_api.v1.SaveInvitesRequest.requests:type_name -> xmtp.keystore_api.v1.SaveInvitesRequest.Request - 47, // 14: xmtp.keystore_api.v1.SaveInvitesResponse.responses:type_name -> xmtp.keystore_api.v1.SaveInvitesResponse.Response - 56, // 15: xmtp.keystore_api.v1.SaveV1ConversationsRequest.conversations:type_name -> xmtp.message_contents.ConversationReference - 56, // 16: xmtp.keystore_api.v1.GetConversationsResponse.conversations:type_name -> xmtp.message_contents.ConversationReference - 2, // 17: xmtp.keystore_api.v1.GetKeystoreStatusResponse.status:type_name -> xmtp.keystore_api.v1.GetKeystoreStatusResponse.KeystoreStatus - 57, // 18: xmtp.keystore_api.v1.InitKeystoreRequest.v1:type_name -> xmtp.message_contents.PrivateKeyBundleV1 - 3, // 19: xmtp.keystore_api.v1.InitKeystoreResponse.error:type_name -> xmtp.keystore_api.v1.KeystoreError - 1, // 20: xmtp.keystore_api.v1.GetRefreshJobRequest.job_type:type_name -> xmtp.keystore_api.v1.JobType - 1, // 21: xmtp.keystore_api.v1.SetRefeshJobRequest.job_type:type_name -> xmtp.keystore_api.v1.JobType - 50, // 22: xmtp.keystore_api.v1.TopicMap.topics:type_name -> xmtp.keystore_api.v1.TopicMap.TopicsEntry - 53, // 23: xmtp.keystore_api.v1.GetConversationHmacKeysResponse.hmac_keys:type_name -> xmtp.keystore_api.v1.GetConversationHmacKeysResponse.HmacKeysEntry - 58, // 24: xmtp.keystore_api.v1.DecryptV1Request.Request.payload:type_name -> xmtp.message_contents.Ciphertext - 59, // 25: xmtp.keystore_api.v1.DecryptV1Request.Request.peer_keys:type_name -> xmtp.message_contents.PublicKeyBundle - 36, // 26: xmtp.keystore_api.v1.DecryptResponse.Response.result:type_name -> xmtp.keystore_api.v1.DecryptResponse.Response.Success - 3, // 27: xmtp.keystore_api.v1.DecryptResponse.Response.error:type_name -> xmtp.keystore_api.v1.KeystoreError - 58, // 28: xmtp.keystore_api.v1.DecryptV2Request.Request.payload:type_name -> xmtp.message_contents.Ciphertext - 59, // 29: xmtp.keystore_api.v1.EncryptV1Request.Request.recipient:type_name -> xmtp.message_contents.PublicKeyBundle - 40, // 30: xmtp.keystore_api.v1.EncryptResponse.Response.result:type_name -> xmtp.keystore_api.v1.EncryptResponse.Response.Success - 3, // 31: xmtp.keystore_api.v1.EncryptResponse.Response.error:type_name -> xmtp.keystore_api.v1.KeystoreError - 58, // 32: xmtp.keystore_api.v1.EncryptResponse.Response.Success.encrypted:type_name -> xmtp.message_contents.Ciphertext - 44, // 33: xmtp.keystore_api.v1.SelfEncryptResponse.Response.result:type_name -> xmtp.keystore_api.v1.SelfEncryptResponse.Response.Success - 3, // 34: xmtp.keystore_api.v1.SelfEncryptResponse.Response.error:type_name -> xmtp.keystore_api.v1.KeystoreError - 48, // 35: xmtp.keystore_api.v1.SaveInvitesResponse.Response.result:type_name -> xmtp.keystore_api.v1.SaveInvitesResponse.Response.Success - 3, // 36: xmtp.keystore_api.v1.SaveInvitesResponse.Response.error:type_name -> xmtp.keystore_api.v1.KeystoreError - 56, // 37: xmtp.keystore_api.v1.SaveInvitesResponse.Response.Success.conversation:type_name -> xmtp.message_contents.ConversationReference - 60, // 38: xmtp.keystore_api.v1.TopicMap.TopicData.invitation:type_name -> xmtp.message_contents.InvitationV1 - 49, // 39: xmtp.keystore_api.v1.TopicMap.TopicsEntry.value:type_name -> xmtp.keystore_api.v1.TopicMap.TopicData - 51, // 40: xmtp.keystore_api.v1.GetConversationHmacKeysResponse.HmacKeys.values:type_name -> xmtp.keystore_api.v1.GetConversationHmacKeysResponse.HmacKeyData - 52, // 41: xmtp.keystore_api.v1.GetConversationHmacKeysResponse.HmacKeysEntry.value:type_name -> xmtp.keystore_api.v1.GetConversationHmacKeysResponse.HmacKeys - 42, // [42:42] is the sub-list for method output_type - 42, // [42:42] is the sub-list for method input_type - 42, // [42:42] is the sub-list for extension type_name - 42, // [42:42] is the sub-list for extension extendee - 0, // [0:42] is the sub-list for field type_name + 56, // 12: xmtp.keystore_api.v1.CreateInviteRequest.consent_proof:type_name -> xmtp.message_contents.ConsentProofPayload + 57, // 13: xmtp.keystore_api.v1.CreateInviteResponse.conversation:type_name -> xmtp.message_contents.ConversationReference + 46, // 14: xmtp.keystore_api.v1.SaveInvitesRequest.requests:type_name -> xmtp.keystore_api.v1.SaveInvitesRequest.Request + 47, // 15: xmtp.keystore_api.v1.SaveInvitesResponse.responses:type_name -> xmtp.keystore_api.v1.SaveInvitesResponse.Response + 57, // 16: xmtp.keystore_api.v1.SaveV1ConversationsRequest.conversations:type_name -> xmtp.message_contents.ConversationReference + 57, // 17: xmtp.keystore_api.v1.GetConversationsResponse.conversations:type_name -> xmtp.message_contents.ConversationReference + 2, // 18: xmtp.keystore_api.v1.GetKeystoreStatusResponse.status:type_name -> xmtp.keystore_api.v1.GetKeystoreStatusResponse.KeystoreStatus + 58, // 19: xmtp.keystore_api.v1.InitKeystoreRequest.v1:type_name -> xmtp.message_contents.PrivateKeyBundleV1 + 3, // 20: xmtp.keystore_api.v1.InitKeystoreResponse.error:type_name -> xmtp.keystore_api.v1.KeystoreError + 1, // 21: xmtp.keystore_api.v1.GetRefreshJobRequest.job_type:type_name -> xmtp.keystore_api.v1.JobType + 1, // 22: xmtp.keystore_api.v1.SetRefeshJobRequest.job_type:type_name -> xmtp.keystore_api.v1.JobType + 50, // 23: xmtp.keystore_api.v1.TopicMap.topics:type_name -> xmtp.keystore_api.v1.TopicMap.TopicsEntry + 53, // 24: xmtp.keystore_api.v1.GetConversationHmacKeysResponse.hmac_keys:type_name -> xmtp.keystore_api.v1.GetConversationHmacKeysResponse.HmacKeysEntry + 59, // 25: xmtp.keystore_api.v1.DecryptV1Request.Request.payload:type_name -> xmtp.message_contents.Ciphertext + 60, // 26: xmtp.keystore_api.v1.DecryptV1Request.Request.peer_keys:type_name -> xmtp.message_contents.PublicKeyBundle + 36, // 27: xmtp.keystore_api.v1.DecryptResponse.Response.result:type_name -> xmtp.keystore_api.v1.DecryptResponse.Response.Success + 3, // 28: xmtp.keystore_api.v1.DecryptResponse.Response.error:type_name -> xmtp.keystore_api.v1.KeystoreError + 59, // 29: xmtp.keystore_api.v1.DecryptV2Request.Request.payload:type_name -> xmtp.message_contents.Ciphertext + 60, // 30: xmtp.keystore_api.v1.EncryptV1Request.Request.recipient:type_name -> xmtp.message_contents.PublicKeyBundle + 40, // 31: xmtp.keystore_api.v1.EncryptResponse.Response.result:type_name -> xmtp.keystore_api.v1.EncryptResponse.Response.Success + 3, // 32: xmtp.keystore_api.v1.EncryptResponse.Response.error:type_name -> xmtp.keystore_api.v1.KeystoreError + 59, // 33: xmtp.keystore_api.v1.EncryptResponse.Response.Success.encrypted:type_name -> xmtp.message_contents.Ciphertext + 44, // 34: xmtp.keystore_api.v1.SelfEncryptResponse.Response.result:type_name -> xmtp.keystore_api.v1.SelfEncryptResponse.Response.Success + 3, // 35: xmtp.keystore_api.v1.SelfEncryptResponse.Response.error:type_name -> xmtp.keystore_api.v1.KeystoreError + 48, // 36: xmtp.keystore_api.v1.SaveInvitesResponse.Response.result:type_name -> xmtp.keystore_api.v1.SaveInvitesResponse.Response.Success + 3, // 37: xmtp.keystore_api.v1.SaveInvitesResponse.Response.error:type_name -> xmtp.keystore_api.v1.KeystoreError + 57, // 38: xmtp.keystore_api.v1.SaveInvitesResponse.Response.Success.conversation:type_name -> xmtp.message_contents.ConversationReference + 61, // 39: xmtp.keystore_api.v1.TopicMap.TopicData.invitation:type_name -> xmtp.message_contents.InvitationV1 + 49, // 40: xmtp.keystore_api.v1.TopicMap.TopicsEntry.value:type_name -> xmtp.keystore_api.v1.TopicMap.TopicData + 51, // 41: xmtp.keystore_api.v1.GetConversationHmacKeysResponse.HmacKeys.values:type_name -> xmtp.keystore_api.v1.GetConversationHmacKeysResponse.HmacKeyData + 52, // 42: xmtp.keystore_api.v1.GetConversationHmacKeysResponse.HmacKeysEntry.value:type_name -> xmtp.keystore_api.v1.GetConversationHmacKeysResponse.HmacKeys + 43, // [43:43] is the sub-list for method output_type + 43, // [43:43] is the sub-list for method input_type + 43, // [43:43] is the sub-list for extension type_name + 43, // [43:43] is the sub-list for extension extendee + 0, // [0:43] is the sub-list for field type_name } func init() { file_keystore_api_v1_keystore_proto_init() } diff --git a/pkg/proto/message_contents/conversation_reference.pb.go b/pkg/proto/message_contents/conversation_reference.pb.go index 85143c82..1aadc264 100644 --- a/pkg/proto/message_contents/conversation_reference.pb.go +++ b/pkg/proto/message_contents/conversation_reference.pb.go @@ -28,10 +28,11 @@ type ConversationReference struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"` - PeerAddress string `protobuf:"bytes,2,opt,name=peer_address,json=peerAddress,proto3" json:"peer_address,omitempty"` - CreatedNs uint64 `protobuf:"varint,3,opt,name=created_ns,json=createdNs,proto3" json:"created_ns,omitempty"` - Context *InvitationV1_Context `protobuf:"bytes,4,opt,name=context,proto3" json:"context,omitempty"` + Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"` + PeerAddress string `protobuf:"bytes,2,opt,name=peer_address,json=peerAddress,proto3" json:"peer_address,omitempty"` + CreatedNs uint64 `protobuf:"varint,3,opt,name=created_ns,json=createdNs,proto3" json:"created_ns,omitempty"` + Context *InvitationV1_Context `protobuf:"bytes,4,opt,name=context,proto3" json:"context,omitempty"` + ConsentProofPayload *ConsentProofPayload `protobuf:"bytes,5,opt,name=consent_proof_payload,json=consentProofPayload,proto3" json:"consent_proof_payload,omitempty"` } func (x *ConversationReference) Reset() { @@ -94,6 +95,13 @@ func (x *ConversationReference) GetContext() *InvitationV1_Context { return nil } +func (x *ConversationReference) GetConsentProofPayload() *ConsentProofPayload { + if x != nil { + return x.ConsentProofPayload + } + return nil +} + var File_message_contents_conversation_reference_proto protoreflect.FileDescriptor var file_message_contents_conversation_reference_proto_rawDesc = []byte{ @@ -103,7 +111,7 @@ var file_message_contents_conversation_reference_proto_rawDesc = []byte{ 0x15, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x1a, 0x21, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb6, 0x01, 0x0a, 0x15, 0x43, 0x6f, + 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x96, 0x02, 0x0a, 0x15, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x65, 0x65, @@ -115,7 +123,13 @@ var file_message_contents_conversation_reference_proto_rawDesc = []byte{ 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, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x78, 0x74, 0x42, 0xe1, 0x01, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, + 0x78, 0x74, 0x12, 0x5e, 0x0a, 0x15, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x05, 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, 0x13, 0x63, + 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x50, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x42, 0xe1, 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, 0x1a, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x37, @@ -148,14 +162,16 @@ var file_message_contents_conversation_reference_proto_msgTypes = make([]protoim var file_message_contents_conversation_reference_proto_goTypes = []interface{}{ (*ConversationReference)(nil), // 0: xmtp.message_contents.ConversationReference (*InvitationV1_Context)(nil), // 1: xmtp.message_contents.InvitationV1.Context + (*ConsentProofPayload)(nil), // 2: xmtp.message_contents.ConsentProofPayload } var file_message_contents_conversation_reference_proto_depIdxs = []int32{ 1, // 0: xmtp.message_contents.ConversationReference.context:type_name -> xmtp.message_contents.InvitationV1.Context - 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 + 2, // 1: xmtp.message_contents.ConversationReference.consent_proof_payload:type_name -> xmtp.message_contents.ConsentProofPayload + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_message_contents_conversation_reference_proto_init() } diff --git a/pkg/proto/mls/database/intents.pb.go b/pkg/proto/mls/database/intents.pb.go index f1b0f9cf..43cbe452 100644 --- a/pkg/proto/mls/database/intents.pb.go +++ b/pkg/proto/mls/database/intents.pb.go @@ -692,7 +692,8 @@ type UpdateMetadataData_V1 struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GroupName string `protobuf:"bytes,1,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` + FieldName string `protobuf:"bytes,1,opt,name=field_name,json=fieldName,proto3" json:"field_name,omitempty"` + FieldValue string `protobuf:"bytes,2,opt,name=field_value,json=fieldValue,proto3" json:"field_value,omitempty"` } func (x *UpdateMetadataData_V1) Reset() { @@ -727,9 +728,16 @@ func (*UpdateMetadataData_V1) Descriptor() ([]byte, []int) { return file_mls_database_intents_proto_rawDescGZIP(), []int{6, 0} } -func (x *UpdateMetadataData_V1) GetGroupName() string { +func (x *UpdateMetadataData_V1) GetFieldName() string { if x != nil { - return x.GroupName + return x.FieldName + } + return "" +} + +func (x *UpdateMetadataData_V1) GetFieldValue() string { + if x != nil { + return x.FieldValue } return "" } @@ -908,51 +916,53 @@ var file_mls_database_intents_proto_rawDesc = []byte{ 0x4f, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x73, 0x52, 0x1a, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x4f, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x73, 0x42, 0x09, 0x0a, - 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x80, 0x01, 0x0a, 0x12, 0x55, 0x70, 0x64, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xa1, 0x01, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x3a, 0x0a, 0x02, 0x76, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x44, 0x61, - 0x74, 0x61, 0x2e, 0x56, 0x31, 0x48, 0x00, 0x52, 0x02, 0x76, 0x31, 0x1a, 0x23, 0x0a, 0x02, 0x56, - 0x31, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, - 0x42, 0x09, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xe8, 0x02, 0x0a, 0x10, - 0x50, 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x57, 0x0a, 0x0d, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x77, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, - 0x6c, 0x73, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x50, 0x6f, 0x73, 0x74, - 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, - 0x64, 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x73, 0x48, 0x00, 0x52, 0x0c, 0x73, 0x65, 0x6e, - 0x64, 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x73, 0x1a, 0x61, 0x0a, 0x0c, 0x49, 0x6e, 0x73, - 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x6e, 0x73, - 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x0f, 0x68, 0x70, 0x6b, 0x65, 0x5f, 0x70, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x68, - 0x70, 0x6b, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x1a, 0x8f, 0x01, 0x0a, - 0x0c, 0x53, 0x65, 0x6e, 0x64, 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x73, 0x12, 0x56, 0x0a, - 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, - 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x6d, - 0x6d, 0x69, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, - 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x77, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, - 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, - 0x77, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x06, - 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x42, 0xc0, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x78, - 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, - 0x42, 0x0c, 0x49, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x33, 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, 0x64, 0x61, 0x74, - 0x61, 0x62, 0x61, 0x73, 0x65, 0xa2, 0x02, 0x03, 0x58, 0x4d, 0x44, 0xaa, 0x02, 0x11, 0x58, 0x6d, - 0x74, 0x70, 0x2e, 0x4d, 0x6c, 0x73, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0xca, - 0x02, 0x11, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x6c, 0x73, 0x5c, 0x44, 0x61, 0x74, 0x61, 0x62, - 0x61, 0x73, 0x65, 0xe2, 0x02, 0x1d, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x6c, 0x73, 0x5c, 0x44, - 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x58, 0x6d, 0x74, 0x70, 0x3a, 0x3a, 0x4d, 0x6c, 0x73, 0x3a, - 0x3a, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x74, 0x61, 0x2e, 0x56, 0x31, 0x48, 0x00, 0x52, 0x02, 0x76, 0x31, 0x1a, 0x44, 0x0a, 0x02, 0x56, + 0x31, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x1f, 0x0a, 0x0b, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x42, 0x09, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xe8, 0x02, 0x0a, + 0x10, 0x50, 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x57, 0x0a, 0x0d, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x77, 0x65, 0x6c, 0x63, 0x6f, 0x6d, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, + 0x6d, 0x6c, 0x73, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x50, 0x6f, 0x73, + 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, + 0x6e, 0x64, 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x73, 0x48, 0x00, 0x52, 0x0c, 0x73, 0x65, + 0x6e, 0x64, 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x73, 0x1a, 0x61, 0x0a, 0x0c, 0x49, 0x6e, + 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x6e, + 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x0f, 0x68, 0x70, 0x6b, 0x65, 0x5f, 0x70, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, + 0x68, 0x70, 0x6b, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x1a, 0x8f, 0x01, + 0x0a, 0x0c, 0x53, 0x65, 0x6e, 0x64, 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x73, 0x12, 0x56, + 0x0a, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, + 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x43, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x77, 0x65, 0x6c, 0x63, 0x6f, 0x6d, + 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x0e, 0x77, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, + 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x42, 0xc0, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, + 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, + 0x65, 0x42, 0x0c, 0x49, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x33, 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, 0x64, 0x61, + 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0xa2, 0x02, 0x03, 0x58, 0x4d, 0x44, 0xaa, 0x02, 0x11, 0x58, + 0x6d, 0x74, 0x70, 0x2e, 0x4d, 0x6c, 0x73, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, + 0xca, 0x02, 0x11, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x6c, 0x73, 0x5c, 0x44, 0x61, 0x74, 0x61, + 0x62, 0x61, 0x73, 0x65, 0xe2, 0x02, 0x1d, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x6c, 0x73, 0x5c, + 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x58, 0x6d, 0x74, 0x70, 0x3a, 0x3a, 0x4d, 0x6c, 0x73, + 0x3a, 0x3a, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/pkg/proto/mls/message_contents/group_metadata.pb.go b/pkg/proto/mls/message_contents/group_metadata.pb.go index a16d667f..833c3bc0 100644 --- a/pkg/proto/mls/message_contents/group_metadata.pb.go +++ b/pkg/proto/mls/message_contents/group_metadata.pb.go @@ -248,9 +248,9 @@ type PolicySet struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - 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 *MetadataPolicy `protobuf:"bytes,3,opt,name=update_group_name_policy,json=updateGroupNamePolicy,proto3" json:"update_group_name_policy,omitempty"` + 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"` + UpdateMetadataPolicy map[string]*MetadataPolicy `protobuf:"bytes,3,rep,name=update_metadata_policy,json=updateMetadataPolicy,proto3" json:"update_metadata_policy,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *PolicySet) Reset() { @@ -299,9 +299,9 @@ func (x *PolicySet) GetRemoveMemberPolicy() *MembershipPolicy { return nil } -func (x *PolicySet) GetUpdateGroupNamePolicy() *MetadataPolicy { +func (x *PolicySet) GetUpdateMetadataPolicy() map[string]*MetadataPolicy { if x != nil { - return x.UpdateGroupNamePolicy + return x.UpdateMetadataPolicy } return nil } @@ -510,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[4] + mi := &file_mls_message_contents_group_metadata_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -523,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[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 { @@ -558,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[5] + mi := &file_mls_message_contents_group_metadata_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -571,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[5] + 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 { @@ -606,7 +606,7 @@ type MetadataPolicy_AndCondition struct { func (x *MetadataPolicy_AndCondition) Reset() { *x = MetadataPolicy_AndCondition{} if protoimpl.UnsafeEnabled { - mi := &file_mls_message_contents_group_metadata_proto_msgTypes[6] + mi := &file_mls_message_contents_group_metadata_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -619,7 +619,7 @@ func (x *MetadataPolicy_AndCondition) String() string { func (*MetadataPolicy_AndCondition) ProtoMessage() {} func (x *MetadataPolicy_AndCondition) ProtoReflect() protoreflect.Message { - mi := &file_mls_message_contents_group_metadata_proto_msgTypes[6] + 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 { @@ -654,7 +654,7 @@ type MetadataPolicy_AnyCondition struct { func (x *MetadataPolicy_AnyCondition) Reset() { *x = MetadataPolicy_AnyCondition{} if protoimpl.UnsafeEnabled { - mi := &file_mls_message_contents_group_metadata_proto_msgTypes[7] + mi := &file_mls_message_contents_group_metadata_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -667,7 +667,7 @@ func (x *MetadataPolicy_AnyCondition) String() string { func (*MetadataPolicy_AnyCondition) ProtoMessage() {} func (x *MetadataPolicy_AnyCondition) ProtoReflect() protoreflect.Message { - mi := &file_mls_message_contents_group_metadata_proto_msgTypes[7] + mi := &file_mls_message_contents_group_metadata_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -711,8 +711,8 @@ 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, 0xa7, - 0x02, 0x0a, 0x09, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x53, 0x65, 0x74, 0x12, 0x57, 0x0a, 0x11, + 0x79, 0x53, 0x65, 0x74, 0x52, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x22, 0xad, + 0x03, 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, 0x6c, 0x73, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, @@ -724,114 +724,122 @@ 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, 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, 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, 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, + 0x6c, 0x69, 0x63, 0x79, 0x12, 0x74, 0x0a, 0x16, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 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, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x14, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x1a, 0x72, 0x0a, 0x19, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x50, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x3f, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 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, 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, + 0x69, 0x63, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 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, 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, 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, + 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, 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, 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, + 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, 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, 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, - 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, + 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 ( @@ -847,7 +855,7 @@ func file_mls_message_contents_group_metadata_proto_rawDescGZIP() []byte { } 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_msgTypes = make([]protoimpl.MessageInfo, 9) 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 @@ -856,32 +864,34 @@ var file_mls_message_contents_group_metadata_proto_goTypes = []interface{}{ (*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 + nil, // 7: xmtp.mls.message_contents.PolicySet.UpdateMetadataPolicyEntry + (*MembershipPolicy_AndCondition)(nil), // 8: xmtp.mls.message_contents.MembershipPolicy.AndCondition + (*MembershipPolicy_AnyCondition)(nil), // 9: xmtp.mls.message_contents.MembershipPolicy.AnyCondition + (*MetadataPolicy_AndCondition)(nil), // 10: xmtp.mls.message_contents.MetadataPolicy.AndCondition + (*MetadataPolicy_AnyCondition)(nil), // 11: 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 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 + 7, // 4: xmtp.mls.message_contents.PolicySet.update_metadata_policy:type_name -> xmtp.mls.message_contents.PolicySet.UpdateMetadataPolicyEntry 1, // 5: xmtp.mls.message_contents.MembershipPolicy.base:type_name -> xmtp.mls.message_contents.MembershipPolicy.BasePolicy - 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 + 8, // 6: xmtp.mls.message_contents.MembershipPolicy.and_condition:type_name -> xmtp.mls.message_contents.MembershipPolicy.AndCondition + 9, // 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 + 10, // 9: xmtp.mls.message_contents.MetadataPolicy.and_condition:type_name -> xmtp.mls.message_contents.MetadataPolicy.AndCondition + 11, // 10: xmtp.mls.message_contents.MetadataPolicy.any_condition:type_name -> xmtp.mls.message_contents.MetadataPolicy.AnyCondition + 6, // 11: xmtp.mls.message_contents.PolicySet.UpdateMetadataPolicyEntry.value:type_name -> xmtp.mls.message_contents.MetadataPolicy + 5, // 12: xmtp.mls.message_contents.MembershipPolicy.AndCondition.policies:type_name -> xmtp.mls.message_contents.MembershipPolicy + 5, // 13: xmtp.mls.message_contents.MembershipPolicy.AnyCondition.policies:type_name -> xmtp.mls.message_contents.MembershipPolicy + 6, // 14: xmtp.mls.message_contents.MetadataPolicy.AndCondition.policies:type_name -> xmtp.mls.message_contents.MetadataPolicy + 6, // 15: xmtp.mls.message_contents.MetadataPolicy.AnyCondition.policies:type_name -> xmtp.mls.message_contents.MetadataPolicy + 16, // [16:16] is the sub-list for method output_type + 16, // [16:16] is the sub-list for method input_type + 16, // [16:16] is the sub-list for extension type_name + 16, // [16:16] is the sub-list for extension extendee + 0, // [0:16] is the sub-list for field type_name } func init() { file_mls_message_contents_group_metadata_proto_init() } @@ -938,7 +948,7 @@ func file_mls_message_contents_group_metadata_proto_init() { return nil } } - file_mls_message_contents_group_metadata_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_mls_message_contents_group_metadata_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MembershipPolicy_AndCondition); i { case 0: return &v.state @@ -950,7 +960,7 @@ func file_mls_message_contents_group_metadata_proto_init() { return nil } } - file_mls_message_contents_group_metadata_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_mls_message_contents_group_metadata_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MembershipPolicy_AnyCondition); i { case 0: return &v.state @@ -962,7 +972,7 @@ 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{} { + file_mls_message_contents_group_metadata_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MetadataPolicy_AndCondition); i { case 0: return &v.state @@ -974,7 +984,7 @@ func file_mls_message_contents_group_metadata_proto_init() { return nil } } - file_mls_message_contents_group_metadata_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_mls_message_contents_group_metadata_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MetadataPolicy_AnyCondition); i { case 0: return &v.state @@ -1003,7 +1013,7 @@ func file_mls_message_contents_group_metadata_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_mls_message_contents_group_metadata_proto_rawDesc, NumEnums: 3, - NumMessages: 8, + NumMessages: 9, NumExtensions: 0, NumServices: 0, }, diff --git a/pkg/proto/mls/message_contents/group_mutable_metadata.pb.go b/pkg/proto/mls/message_contents/group_mutable_metadata.pb.go index 5076345c..4000efcc 100644 --- a/pkg/proto/mls/message_contents/group_mutable_metadata.pb.go +++ b/pkg/proto/mls/message_contents/group_mutable_metadata.pb.go @@ -28,7 +28,7 @@ type GroupMutableMetadataV1 struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GroupName string `protobuf:"bytes,1,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` + Attributes map[string]string `protobuf:"bytes,1,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // Map to store various metadata attributes } func (x *GroupMutableMetadataV1) Reset() { @@ -63,11 +63,11 @@ func (*GroupMutableMetadataV1) Descriptor() ([]byte, []int) { return file_mls_message_contents_group_mutable_metadata_proto_rawDescGZIP(), []int{0} } -func (x *GroupMutableMetadataV1) GetGroupName() string { +func (x *GroupMutableMetadataV1) GetAttributes() map[string]string { if x != nil { - return x.GroupName + return x.Attributes } - return "" + return nil } var File_mls_message_contents_group_mutable_metadata_proto protoreflect.FileDescriptor @@ -77,27 +77,35 @@ var file_mls_message_contents_group_mutable_metadata_proto_rawDesc = []byte{ 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x6d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 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, 0x37, - 0x0a, 0x16, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x56, 0x31, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x72, 0x6f, 0x75, - 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x72, - 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0xf9, 0x01, 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xba, + 0x01, 0x0a, 0x16, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x56, 0x31, 0x12, 0x61, 0x0a, 0x0a, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, 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, 0x19, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 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, + 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, + 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x56, 0x31, + 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x1a, 0x3d, 0x0a, 0x0f, + 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 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, 0x09, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0xf9, 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, 0x19, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 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 ( @@ -112,16 +120,18 @@ func file_mls_message_contents_group_mutable_metadata_proto_rawDescGZIP() []byte return file_mls_message_contents_group_mutable_metadata_proto_rawDescData } -var file_mls_message_contents_group_mutable_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_mls_message_contents_group_mutable_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_mls_message_contents_group_mutable_metadata_proto_goTypes = []interface{}{ (*GroupMutableMetadataV1)(nil), // 0: xmtp.mls.message_contents.GroupMutableMetadataV1 + nil, // 1: xmtp.mls.message_contents.GroupMutableMetadataV1.AttributesEntry } var file_mls_message_contents_group_mutable_metadata_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 1, // 0: xmtp.mls.message_contents.GroupMutableMetadataV1.attributes:type_name -> xmtp.mls.message_contents.GroupMutableMetadataV1.AttributesEntry + 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_mutable_metadata_proto_init() } @@ -149,7 +159,7 @@ func file_mls_message_contents_group_mutable_metadata_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_mls_message_contents_group_mutable_metadata_proto_rawDesc, NumEnums: 0, - NumMessages: 1, + NumMessages: 2, NumExtensions: 0, NumServices: 0, }, diff --git a/pkg/proto/mls_validation/v1/service.pb.go b/pkg/proto/mls_validation/v1/service.pb.go index ddde5af9..bd495198 100644 --- a/pkg/proto/mls_validation/v1/service.pb.go +++ b/pkg/proto/mls_validation/v1/service.pb.go @@ -9,6 +9,7 @@ package mls_validationv1 import ( + associations "github.com/xmtp/xmtp-node-go/pkg/proto/identity/associations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -214,6 +215,120 @@ func (x *ValidateGroupMessagesResponse) GetResponses() []*ValidateGroupMessagesR return nil } +// Request to get a final association state for identity updates +type GetAssociationStateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // List of identity updates + OldUpdates []*associations.IdentityUpdate `protobuf:"bytes,1,rep,name=old_updates,json=oldUpdates,proto3" json:"old_updates,omitempty"` + NewUpdates []*associations.IdentityUpdate `protobuf:"bytes,2,rep,name=new_updates,json=newUpdates,proto3" json:"new_updates,omitempty"` +} + +func (x *GetAssociationStateRequest) Reset() { + *x = GetAssociationStateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_mls_validation_v1_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAssociationStateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAssociationStateRequest) ProtoMessage() {} + +func (x *GetAssociationStateRequest) ProtoReflect() protoreflect.Message { + mi := &file_mls_validation_v1_service_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 GetAssociationStateRequest.ProtoReflect.Descriptor instead. +func (*GetAssociationStateRequest) Descriptor() ([]byte, []int) { + return file_mls_validation_v1_service_proto_rawDescGZIP(), []int{4} +} + +func (x *GetAssociationStateRequest) GetOldUpdates() []*associations.IdentityUpdate { + if x != nil { + return x.OldUpdates + } + return nil +} + +func (x *GetAssociationStateRequest) GetNewUpdates() []*associations.IdentityUpdate { + if x != nil { + return x.NewUpdates + } + return nil +} + +// Response to GetAssociationStateRequest, containing the final association state +// for an InboxID +type GetAssociationStateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AssociationState *associations.AssociationState `protobuf:"bytes,1,opt,name=association_state,json=associationState,proto3" json:"association_state,omitempty"` + StateDiff *associations.AssociationStateDiff `protobuf:"bytes,2,opt,name=state_diff,json=stateDiff,proto3" json:"state_diff,omitempty"` +} + +func (x *GetAssociationStateResponse) Reset() { + *x = GetAssociationStateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_mls_validation_v1_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAssociationStateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAssociationStateResponse) ProtoMessage() {} + +func (x *GetAssociationStateResponse) ProtoReflect() protoreflect.Message { + mi := &file_mls_validation_v1_service_proto_msgTypes[5] + 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 GetAssociationStateResponse.ProtoReflect.Descriptor instead. +func (*GetAssociationStateResponse) Descriptor() ([]byte, []int) { + return file_mls_validation_v1_service_proto_rawDescGZIP(), []int{5} +} + +func (x *GetAssociationStateResponse) GetAssociationState() *associations.AssociationState { + if x != nil { + return x.AssociationState + } + return nil +} + +func (x *GetAssociationStateResponse) GetStateDiff() *associations.AssociationStateDiff { + if x != nil { + return x.StateDiff + } + return nil +} + // Wrapper for each key package type ValidateKeyPackagesRequest_KeyPackage struct { state protoimpl.MessageState @@ -226,7 +341,7 @@ type ValidateKeyPackagesRequest_KeyPackage struct { func (x *ValidateKeyPackagesRequest_KeyPackage) Reset() { *x = ValidateKeyPackagesRequest_KeyPackage{} if protoimpl.UnsafeEnabled { - mi := &file_mls_validation_v1_service_proto_msgTypes[4] + mi := &file_mls_validation_v1_service_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -239,7 +354,7 @@ func (x *ValidateKeyPackagesRequest_KeyPackage) String() string { func (*ValidateKeyPackagesRequest_KeyPackage) ProtoMessage() {} func (x *ValidateKeyPackagesRequest_KeyPackage) ProtoReflect() protoreflect.Message { - mi := &file_mls_validation_v1_service_proto_msgTypes[4] + mi := &file_mls_validation_v1_service_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -279,7 +394,7 @@ type ValidateKeyPackagesResponse_ValidationResponse struct { func (x *ValidateKeyPackagesResponse_ValidationResponse) Reset() { *x = ValidateKeyPackagesResponse_ValidationResponse{} if protoimpl.UnsafeEnabled { - mi := &file_mls_validation_v1_service_proto_msgTypes[5] + mi := &file_mls_validation_v1_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -292,7 +407,7 @@ func (x *ValidateKeyPackagesResponse_ValidationResponse) String() string { func (*ValidateKeyPackagesResponse_ValidationResponse) ProtoMessage() {} func (x *ValidateKeyPackagesResponse_ValidationResponse) ProtoReflect() protoreflect.Message { - mi := &file_mls_validation_v1_service_proto_msgTypes[5] + mi := &file_mls_validation_v1_service_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -362,7 +477,7 @@ type ValidateGroupMessagesRequest_GroupMessage struct { func (x *ValidateGroupMessagesRequest_GroupMessage) Reset() { *x = ValidateGroupMessagesRequest_GroupMessage{} if protoimpl.UnsafeEnabled { - mi := &file_mls_validation_v1_service_proto_msgTypes[6] + mi := &file_mls_validation_v1_service_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -375,7 +490,7 @@ func (x *ValidateGroupMessagesRequest_GroupMessage) String() string { func (*ValidateGroupMessagesRequest_GroupMessage) ProtoMessage() {} func (x *ValidateGroupMessagesRequest_GroupMessage) ProtoReflect() protoreflect.Message { - mi := &file_mls_validation_v1_service_proto_msgTypes[6] + mi := &file_mls_validation_v1_service_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -412,7 +527,7 @@ type ValidateGroupMessagesResponse_ValidationResponse struct { func (x *ValidateGroupMessagesResponse_ValidationResponse) Reset() { *x = ValidateGroupMessagesResponse_ValidationResponse{} if protoimpl.UnsafeEnabled { - mi := &file_mls_validation_v1_service_proto_msgTypes[7] + mi := &file_mls_validation_v1_service_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -425,7 +540,7 @@ func (x *ValidateGroupMessagesResponse_ValidationResponse) String() string { func (*ValidateGroupMessagesResponse_ValidationResponse) ProtoMessage() {} func (x *ValidateGroupMessagesResponse_ValidationResponse) ProtoReflect() protoreflect.Message { - mi := &file_mls_validation_v1_service_proto_msgTypes[7] + mi := &file_mls_validation_v1_service_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -468,108 +583,143 @@ var file_mls_validation_v1_service_proto_rawDesc = []byte{ 0x0a, 0x1f, 0x6d, 0x6c, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x22, 0xd4, 0x01, 0x0a, 0x1a, 0x56, 0x61, + 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x27, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x2f, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2f, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xd4, 0x01, 0x0a, 0x1a, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x4b, + 0x65, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x60, 0x0a, 0x0c, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, + 0x6c, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, + 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x50, 0x61, 0x63, 0x6b, + 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x4b, 0x65, 0x79, 0x50, + 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x0b, 0x6b, 0x65, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x73, 0x1a, 0x54, 0x0a, 0x0a, 0x4b, 0x65, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, + 0x65, 0x12, 0x46, 0x0a, 0x20, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, + 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x69, 0x61, + 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x1c, 0x6b, 0x65, 0x79, + 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x54, 0x6c, 0x73, 0x53, + 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x22, 0x82, 0x03, 0x0a, 0x1b, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x60, 0x0a, 0x0c, 0x6b, 0x65, 0x79, 0x5f, - 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3d, - 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x4b, 0x65, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x2e, 0x4b, 0x65, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x0b, 0x6b, - 0x65, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x1a, 0x54, 0x0a, 0x0a, 0x4b, 0x65, - 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x46, 0x0a, 0x20, 0x6b, 0x65, 0x79, 0x5f, - 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x74, 0x6c, - 0x73, 0x5f, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x1c, 0x6b, 0x65, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x42, 0x79, - 0x74, 0x65, 0x73, 0x54, 0x6c, 0x73, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, - 0x22, 0x82, 0x03, 0x0a, 0x1b, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, - 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x64, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x5f, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x1a, 0xfc, 0x01, 0x0a, 0x12, 0x56, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x13, 0x0a, - 0x05, 0x69, 0x73, 0x5f, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, - 0x4f, 0x6b, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x6e, 0x73, 0x74, 0x61, - 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x0e, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, - 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x63, 0x72, 0x65, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x17, 0x63, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xe4, 0x01, 0x0a, 0x1c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, 0x09, 0x72, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x78, + 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x4b, 0x65, + 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x1a, + 0xfc, 0x01, 0x0a, 0x12, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x13, 0x0a, 0x05, 0x69, 0x73, 0x5f, 0x6f, 0x6b, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x12, 0x23, 0x0a, 0x0d, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x69, 0x6e, 0x73, 0x74, 0x61, + 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x17, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1e, + 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xe4, + 0x01, 0x0a, 0x1c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x68, 0x0a, 0x0e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, + 0x6c, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, + 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0d, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x1a, 0x5a, 0x0a, 0x0c, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x4a, 0x0a, 0x22, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, + 0x5f, 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x1e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x54, 0x6c, 0x73, 0x53, 0x65, 0x72, 0x69, 0x61, + 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x22, 0xf2, 0x01, 0x0a, 0x1d, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x68, 0x0a, 0x0e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x48, 0x2e, 0x78, 0x6d, 0x74, + 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x1a, + 0x69, 0x0a, 0x12, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x13, 0x0a, 0x05, 0x69, 0x73, 0x5f, 0x6f, 0x6b, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, + 0x19, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, 0xb6, 0x01, 0x0a, 0x1a, 0x47, + 0x65, 0x74, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4b, 0x0a, 0x0b, 0x6f, 0x6c, 0x64, + 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, + 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, + 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x6f, 0x6c, 0x64, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x4b, 0x0a, 0x0b, 0x6e, 0x65, 0x77, 0x5f, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x78, 0x6d, + 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, + 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x6e, 0x65, 0x77, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x73, 0x22, 0xc9, 0x01, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x41, 0x73, 0x73, 0x6f, 0x63, + 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x11, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, + 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, + 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x41, 0x73, 0x73, 0x6f, + 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x10, 0x61, 0x73, + 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x4f, + 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x44, 0x69, 0x66, 0x66, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x44, 0x69, 0x66, 0x66, 0x32, + 0x9e, 0x03, 0x0a, 0x0d, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x70, + 0x69, 0x12, 0x80, 0x01, 0x0a, 0x13, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x4b, 0x65, + 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x12, 0x32, 0x2e, 0x78, 0x6d, 0x74, 0x70, + 0x2e, 0x6d, 0x6c, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x50, 0x61, + 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, + 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x4b, + 0x65, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x86, 0x01, 0x0a, 0x15, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x34, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x52, 0x0d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, - 0x1a, 0x5a, 0x0a, 0x0c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x12, 0x4a, 0x0a, 0x22, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x69, - 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x1e, 0x67, 0x72, - 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x54, - 0x6c, 0x73, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x22, 0xf2, 0x01, 0x0a, - 0x1d, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, - 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x48, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x5f, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x1a, 0x69, 0x0a, 0x12, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x13, 0x0a, 0x05, - 0x69, 0x73, 0x5f, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, - 0x6b, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, - 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, - 0x64, 0x32, 0x9b, 0x02, 0x0a, 0x0d, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x41, 0x70, 0x69, 0x12, 0x80, 0x01, 0x0a, 0x13, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x4b, 0x65, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x12, 0x32, 0x2e, 0x78, 0x6d, - 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, - 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x33, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x65, 0x4b, 0x65, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x86, 0x01, 0x0a, 0x15, 0x56, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, - 0x12, 0x34, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, - 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, - 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, - 0xeb, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, - 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0c, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x49, - 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, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6c, 0x73, 0x5f, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x58, 0x4d, 0x58, 0xaa, - 0x02, 0x15, 0x58, 0x6d, 0x74, 0x70, 0x2e, 0x4d, 0x6c, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x15, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, - 0x6c, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2, - 0x02, 0x21, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x6c, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x17, 0x58, 0x6d, 0x74, 0x70, 0x3a, 0x3a, 0x4d, 0x6c, 0x73, 0x56, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, 0x5f, + 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x80, 0x01, + 0x0a, 0x13, 0x47, 0x65, 0x74, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x32, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, 0x73, + 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x47, + 0x65, 0x74, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x78, 0x6d, 0x74, 0x70, + 0x2e, 0x6d, 0x6c, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x42, 0xeb, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x6d, 0x6c, + 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, + 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x49, 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, 0x5f, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6c, 0x73, 0x5f, 0x76, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x58, 0x4d, 0x58, + 0xaa, 0x02, 0x15, 0x58, 0x6d, 0x74, 0x70, 0x2e, 0x4d, 0x6c, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x15, 0x58, 0x6d, 0x74, 0x70, 0x5c, + 0x4d, 0x6c, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, + 0xe2, 0x02, 0x21, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x4d, 0x6c, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x17, 0x58, 0x6d, 0x74, 0x70, 0x3a, 0x3a, 0x4d, 0x6c, 0x73, + 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -584,31 +734,42 @@ func file_mls_validation_v1_service_proto_rawDescGZIP() []byte { return file_mls_validation_v1_service_proto_rawDescData } -var file_mls_validation_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_mls_validation_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_mls_validation_v1_service_proto_goTypes = []interface{}{ (*ValidateKeyPackagesRequest)(nil), // 0: xmtp.mls_validation.v1.ValidateKeyPackagesRequest (*ValidateKeyPackagesResponse)(nil), // 1: xmtp.mls_validation.v1.ValidateKeyPackagesResponse (*ValidateGroupMessagesRequest)(nil), // 2: xmtp.mls_validation.v1.ValidateGroupMessagesRequest (*ValidateGroupMessagesResponse)(nil), // 3: xmtp.mls_validation.v1.ValidateGroupMessagesResponse - (*ValidateKeyPackagesRequest_KeyPackage)(nil), // 4: xmtp.mls_validation.v1.ValidateKeyPackagesRequest.KeyPackage - (*ValidateKeyPackagesResponse_ValidationResponse)(nil), // 5: xmtp.mls_validation.v1.ValidateKeyPackagesResponse.ValidationResponse - (*ValidateGroupMessagesRequest_GroupMessage)(nil), // 6: xmtp.mls_validation.v1.ValidateGroupMessagesRequest.GroupMessage - (*ValidateGroupMessagesResponse_ValidationResponse)(nil), // 7: xmtp.mls_validation.v1.ValidateGroupMessagesResponse.ValidationResponse + (*GetAssociationStateRequest)(nil), // 4: xmtp.mls_validation.v1.GetAssociationStateRequest + (*GetAssociationStateResponse)(nil), // 5: xmtp.mls_validation.v1.GetAssociationStateResponse + (*ValidateKeyPackagesRequest_KeyPackage)(nil), // 6: xmtp.mls_validation.v1.ValidateKeyPackagesRequest.KeyPackage + (*ValidateKeyPackagesResponse_ValidationResponse)(nil), // 7: xmtp.mls_validation.v1.ValidateKeyPackagesResponse.ValidationResponse + (*ValidateGroupMessagesRequest_GroupMessage)(nil), // 8: xmtp.mls_validation.v1.ValidateGroupMessagesRequest.GroupMessage + (*ValidateGroupMessagesResponse_ValidationResponse)(nil), // 9: xmtp.mls_validation.v1.ValidateGroupMessagesResponse.ValidationResponse + (*associations.IdentityUpdate)(nil), // 10: xmtp.identity.associations.IdentityUpdate + (*associations.AssociationState)(nil), // 11: xmtp.identity.associations.AssociationState + (*associations.AssociationStateDiff)(nil), // 12: xmtp.identity.associations.AssociationStateDiff } var file_mls_validation_v1_service_proto_depIdxs = []int32{ - 4, // 0: xmtp.mls_validation.v1.ValidateKeyPackagesRequest.key_packages:type_name -> xmtp.mls_validation.v1.ValidateKeyPackagesRequest.KeyPackage - 5, // 1: xmtp.mls_validation.v1.ValidateKeyPackagesResponse.responses:type_name -> xmtp.mls_validation.v1.ValidateKeyPackagesResponse.ValidationResponse - 6, // 2: xmtp.mls_validation.v1.ValidateGroupMessagesRequest.group_messages:type_name -> xmtp.mls_validation.v1.ValidateGroupMessagesRequest.GroupMessage - 7, // 3: xmtp.mls_validation.v1.ValidateGroupMessagesResponse.responses:type_name -> xmtp.mls_validation.v1.ValidateGroupMessagesResponse.ValidationResponse - 0, // 4: xmtp.mls_validation.v1.ValidationApi.ValidateKeyPackages:input_type -> xmtp.mls_validation.v1.ValidateKeyPackagesRequest - 2, // 5: xmtp.mls_validation.v1.ValidationApi.ValidateGroupMessages:input_type -> xmtp.mls_validation.v1.ValidateGroupMessagesRequest - 1, // 6: xmtp.mls_validation.v1.ValidationApi.ValidateKeyPackages:output_type -> xmtp.mls_validation.v1.ValidateKeyPackagesResponse - 3, // 7: xmtp.mls_validation.v1.ValidationApi.ValidateGroupMessages:output_type -> xmtp.mls_validation.v1.ValidateGroupMessagesResponse - 6, // [6:8] is the sub-list for method output_type - 4, // [4:6] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 6, // 0: xmtp.mls_validation.v1.ValidateKeyPackagesRequest.key_packages:type_name -> xmtp.mls_validation.v1.ValidateKeyPackagesRequest.KeyPackage + 7, // 1: xmtp.mls_validation.v1.ValidateKeyPackagesResponse.responses:type_name -> xmtp.mls_validation.v1.ValidateKeyPackagesResponse.ValidationResponse + 8, // 2: xmtp.mls_validation.v1.ValidateGroupMessagesRequest.group_messages:type_name -> xmtp.mls_validation.v1.ValidateGroupMessagesRequest.GroupMessage + 9, // 3: xmtp.mls_validation.v1.ValidateGroupMessagesResponse.responses:type_name -> xmtp.mls_validation.v1.ValidateGroupMessagesResponse.ValidationResponse + 10, // 4: xmtp.mls_validation.v1.GetAssociationStateRequest.old_updates:type_name -> xmtp.identity.associations.IdentityUpdate + 10, // 5: xmtp.mls_validation.v1.GetAssociationStateRequest.new_updates:type_name -> xmtp.identity.associations.IdentityUpdate + 11, // 6: xmtp.mls_validation.v1.GetAssociationStateResponse.association_state:type_name -> xmtp.identity.associations.AssociationState + 12, // 7: xmtp.mls_validation.v1.GetAssociationStateResponse.state_diff:type_name -> xmtp.identity.associations.AssociationStateDiff + 0, // 8: xmtp.mls_validation.v1.ValidationApi.ValidateKeyPackages:input_type -> xmtp.mls_validation.v1.ValidateKeyPackagesRequest + 2, // 9: xmtp.mls_validation.v1.ValidationApi.ValidateGroupMessages:input_type -> xmtp.mls_validation.v1.ValidateGroupMessagesRequest + 4, // 10: xmtp.mls_validation.v1.ValidationApi.GetAssociationState:input_type -> xmtp.mls_validation.v1.GetAssociationStateRequest + 1, // 11: xmtp.mls_validation.v1.ValidationApi.ValidateKeyPackages:output_type -> xmtp.mls_validation.v1.ValidateKeyPackagesResponse + 3, // 12: xmtp.mls_validation.v1.ValidationApi.ValidateGroupMessages:output_type -> xmtp.mls_validation.v1.ValidateGroupMessagesResponse + 5, // 13: xmtp.mls_validation.v1.ValidationApi.GetAssociationState:output_type -> xmtp.mls_validation.v1.GetAssociationStateResponse + 11, // [11:14] is the sub-list for method output_type + 8, // [8:11] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_mls_validation_v1_service_proto_init() } @@ -666,7 +827,7 @@ func file_mls_validation_v1_service_proto_init() { } } file_mls_validation_v1_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ValidateKeyPackagesRequest_KeyPackage); i { + switch v := v.(*GetAssociationStateRequest); i { case 0: return &v.state case 1: @@ -678,7 +839,7 @@ func file_mls_validation_v1_service_proto_init() { } } file_mls_validation_v1_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ValidateKeyPackagesResponse_ValidationResponse); i { + switch v := v.(*GetAssociationStateResponse); i { case 0: return &v.state case 1: @@ -690,7 +851,7 @@ func file_mls_validation_v1_service_proto_init() { } } file_mls_validation_v1_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ValidateGroupMessagesRequest_GroupMessage); i { + switch v := v.(*ValidateKeyPackagesRequest_KeyPackage); i { case 0: return &v.state case 1: @@ -702,6 +863,30 @@ func file_mls_validation_v1_service_proto_init() { } } file_mls_validation_v1_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ValidateKeyPackagesResponse_ValidationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mls_validation_v1_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ValidateGroupMessagesRequest_GroupMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mls_validation_v1_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ValidateGroupMessagesResponse_ValidationResponse); i { case 0: return &v.state @@ -720,7 +905,7 @@ func file_mls_validation_v1_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_mls_validation_v1_service_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/proto/mls_validation/v1/service_grpc.pb.go b/pkg/proto/mls_validation/v1/service_grpc.pb.go index a0e21c24..80a4724c 100644 --- a/pkg/proto/mls_validation/v1/service_grpc.pb.go +++ b/pkg/proto/mls_validation/v1/service_grpc.pb.go @@ -23,6 +23,7 @@ const _ = grpc.SupportPackageIsVersion7 const ( ValidationApi_ValidateKeyPackages_FullMethodName = "/xmtp.mls_validation.v1.ValidationApi/ValidateKeyPackages" ValidationApi_ValidateGroupMessages_FullMethodName = "/xmtp.mls_validation.v1.ValidationApi/ValidateGroupMessages" + ValidationApi_GetAssociationState_FullMethodName = "/xmtp.mls_validation.v1.ValidationApi/GetAssociationState" ) // ValidationApiClient is the client API for ValidationApi service. @@ -33,6 +34,8 @@ type ValidationApiClient interface { ValidateKeyPackages(ctx context.Context, in *ValidateKeyPackagesRequest, opts ...grpc.CallOption) (*ValidateKeyPackagesResponse, error) // Validates and parses a group message and returns relevant details ValidateGroupMessages(ctx context.Context, in *ValidateGroupMessagesRequest, opts ...grpc.CallOption) (*ValidateGroupMessagesResponse, error) + // Gets the final association state for a batch of identity updates + GetAssociationState(ctx context.Context, in *GetAssociationStateRequest, opts ...grpc.CallOption) (*GetAssociationStateResponse, error) } type validationApiClient struct { @@ -61,6 +64,15 @@ func (c *validationApiClient) ValidateGroupMessages(ctx context.Context, in *Val return out, nil } +func (c *validationApiClient) GetAssociationState(ctx context.Context, in *GetAssociationStateRequest, opts ...grpc.CallOption) (*GetAssociationStateResponse, error) { + out := new(GetAssociationStateResponse) + err := c.cc.Invoke(ctx, ValidationApi_GetAssociationState_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ValidationApiServer is the server API for ValidationApi service. // All implementations must embed UnimplementedValidationApiServer // for forward compatibility @@ -69,6 +81,8 @@ type ValidationApiServer interface { ValidateKeyPackages(context.Context, *ValidateKeyPackagesRequest) (*ValidateKeyPackagesResponse, error) // Validates and parses a group message and returns relevant details ValidateGroupMessages(context.Context, *ValidateGroupMessagesRequest) (*ValidateGroupMessagesResponse, error) + // Gets the final association state for a batch of identity updates + GetAssociationState(context.Context, *GetAssociationStateRequest) (*GetAssociationStateResponse, error) mustEmbedUnimplementedValidationApiServer() } @@ -82,6 +96,9 @@ func (UnimplementedValidationApiServer) ValidateKeyPackages(context.Context, *Va func (UnimplementedValidationApiServer) ValidateGroupMessages(context.Context, *ValidateGroupMessagesRequest) (*ValidateGroupMessagesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ValidateGroupMessages not implemented") } +func (UnimplementedValidationApiServer) GetAssociationState(context.Context, *GetAssociationStateRequest) (*GetAssociationStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAssociationState not implemented") +} func (UnimplementedValidationApiServer) mustEmbedUnimplementedValidationApiServer() {} // UnsafeValidationApiServer may be embedded to opt out of forward compatibility for this service. @@ -131,6 +148,24 @@ func _ValidationApi_ValidateGroupMessages_Handler(srv interface{}, ctx context.C return interceptor(ctx, in, info, handler) } +func _ValidationApi_GetAssociationState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAssociationStateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ValidationApiServer).GetAssociationState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ValidationApi_GetAssociationState_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ValidationApiServer).GetAssociationState(ctx, req.(*GetAssociationStateRequest)) + } + return interceptor(ctx, in, info, handler) +} + // ValidationApi_ServiceDesc is the grpc.ServiceDesc for ValidationApi service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -146,6 +181,10 @@ var ValidationApi_ServiceDesc = grpc.ServiceDesc{ MethodName: "ValidateGroupMessages", Handler: _ValidationApi_ValidateGroupMessages_Handler, }, + { + MethodName: "GetAssociationState", + Handler: _ValidationApi_GetAssociationState_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "mls_validation/v1/service.proto", diff --git a/pkg/proto/openapi/mls_validation/v1/service.swagger.json b/pkg/proto/openapi/mls_validation/v1/service.swagger.json index 9a0048c7..736ffc92 100644 --- a/pkg/proto/openapi/mls_validation/v1/service.swagger.json +++ b/pkg/proto/openapi/mls_validation/v1/service.swagger.json @@ -17,6 +17,301 @@ ], "paths": {}, "definitions": { + "SignatureECDSACompact": { + "type": "object", + "properties": { + "bytes": { + "type": "string", + "format": "byte", + "title": "compact representation [ R || S ], 64 bytes" + }, + "recovery": { + "type": "integer", + "format": "int64", + "title": "recovery bit" + } + }, + "title": "ECDSA signature bytes and the recovery bit" + }, + "SignatureWalletECDSACompact": { + "type": "object", + "properties": { + "bytes": { + "type": "string", + "format": "byte", + "title": "compact representation [ R || S ], 64 bytes" + }, + "recovery": { + "type": "integer", + "format": "int64", + "title": "recovery bit" + } + }, + "description": "ECDSA signature bytes and the recovery bit\nproduced by xmtp-js::PublicKey.signWithWallet function, i.e.\nEIP-191 signature of a \"Create Identity\" message with the key embedded.\nUsed to sign identity keys." + }, + "associationsAddAssociation": { + "type": "object", + "properties": { + "newMemberIdentifier": { + "$ref": "#/definitions/associationsMemberIdentifier" + }, + "existingMemberSignature": { + "$ref": "#/definitions/identityassociationsSignature" + }, + "newMemberSignature": { + "$ref": "#/definitions/identityassociationsSignature" + } + }, + "description": "Adds a new member for an XID - either an addressable member such as a\nwallet, or an installation acting on behalf of an address.\nA key-pair that has been associated with one role MUST not be permitted to be\nassociated with a different role." + }, + "associationsAssociationState": { + "type": "object", + "properties": { + "inboxId": { + "type": "string" + }, + "members": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/associationsMemberMap" + } + }, + "recoveryAddress": { + "type": "string" + }, + "seenSignatures": { + "type": "array", + "items": { + "type": "string", + "format": "byte" + } + } + }, + "title": "A final association state resulting from multiple `IdentityUpdates`" + }, + "associationsAssociationStateDiff": { + "type": "object", + "properties": { + "newMembers": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/associationsMemberIdentifier" + } + }, + "removedMembers": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/associationsMemberIdentifier" + } + } + }, + "title": "/ state diff between two final AssociationStates" + }, + "associationsChangeRecoveryAddress": { + "type": "object", + "properties": { + "newRecoveryAddress": { + "type": "string" + }, + "existingRecoveryAddressSignature": { + "$ref": "#/definitions/identityassociationsSignature" + } + }, + "description": "Changes the recovery address for an XID. The recovery address is not required\nto be a member of the XID. In addition to being able to add members, the\nrecovery address can also revoke members." + }, + "associationsCreateInbox": { + "type": "object", + "properties": { + "initialAddress": { + "type": "string" + }, + "nonce": { + "type": "string", + "format": "uint64" + }, + "initialAddressSignature": { + "$ref": "#/definitions/identityassociationsSignature", + "title": "Must be an addressable member" + } + }, + "description": "The first entry of any XID log. The XID must be deterministically derivable\nfrom the address and nonce.\nThe recovery address defaults to the initial associated_address unless\nthere is a subsequent ChangeRecoveryAddress in the log." + }, + "associationsErc1271Signature": { + "type": "object", + "properties": { + "contractAddress": { + "type": "string", + "title": "CAIP-10 contract address\nhttps://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-10.md" + }, + "blockNumber": { + "type": "string", + "format": "uint64", + "title": "Specify the block number to verify the signature against" + }, + "signature": { + "type": "string", + "format": "byte", + "title": "The actual signature bytes" + } + }, + "title": "Smart wallet signature" + }, + "associationsIdentityAction": { + "type": "object", + "properties": { + "createInbox": { + "$ref": "#/definitions/associationsCreateInbox" + }, + "add": { + "$ref": "#/definitions/associationsAddAssociation" + }, + "revoke": { + "$ref": "#/definitions/associationsRevokeAssociation" + }, + "changeRecoveryAddress": { + "$ref": "#/definitions/associationsChangeRecoveryAddress" + } + }, + "title": "A single identity operation" + }, + "associationsIdentityUpdate": { + "type": "object", + "properties": { + "actions": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/associationsIdentityAction" + } + }, + "clientTimestampNs": { + "type": "string", + "format": "uint64" + }, + "inboxId": { + "type": "string" + } + }, + "description": "One or more identity actions that were signed together.\nExample: [CreateXid, AddAssociation, ChangeRecoveryAddress]\n1. The batched signature text is created by concatenating the signature text\n of each association together with a separator, '\\n\\n\\n'.\n2. The user signs this concatenated result.\n3. The resulting signature is added to each association proto where relevant.\n The same signature may be used for multiple associations in the array." + }, + "associationsLegacyDelegatedSignature": { + "type": "object", + "properties": { + "delegatedKey": { + "$ref": "#/definitions/message_contentsSignedPublicKey" + }, + "signature": { + "$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." + }, + "associationsMember": { + "type": "object", + "properties": { + "identifier": { + "$ref": "#/definitions/associationsMemberIdentifier" + }, + "addedByEntity": { + "$ref": "#/definitions/associationsMemberIdentifier" + } + }, + "title": "single member that optionally indicates the member that added them" + }, + "associationsMemberIdentifier": { + "type": "object", + "properties": { + "address": { + "type": "string" + }, + "installationPublicKey": { + "type": "string", + "format": "byte" + } + }, + "title": "The identifier for a member of an XID" + }, + "associationsMemberMap": { + "type": "object", + "properties": { + "key": { + "$ref": "#/definitions/associationsMemberIdentifier" + }, + "value": { + "$ref": "#/definitions/associationsMember" + } + }, + "title": "Map of members belonging to an inbox_id" + }, + "associationsRecoverableEd25519Signature": { + "type": "object", + "properties": { + "bytes": { + "type": "string", + "format": "byte" + } + }, + "title": "EdDSA signature for 25519" + }, + "associationsRevokeAssociation": { + "type": "object", + "properties": { + "memberToRevoke": { + "$ref": "#/definitions/associationsMemberIdentifier" + }, + "recoveryAddressSignature": { + "$ref": "#/definitions/identityassociationsSignature" + } + }, + "description": "Revokes a member from an XID. The recovery address must sign the revocation." + }, + "identityassociationsRecoverableEcdsaSignature": { + "type": "object", + "properties": { + "bytes": { + "type": "string", + "format": "byte", + "title": "65-bytes [ R || S || V ], with recovery id as the last byte" + } + }, + "title": "RecoverableEcdsaSignature for EIP-191 and V2 signatures" + }, + "identityassociationsSignature": { + "type": "object", + "properties": { + "erc191": { + "$ref": "#/definitions/identityassociationsRecoverableEcdsaSignature" + }, + "erc1271": { + "$ref": "#/definitions/associationsErc1271Signature" + }, + "installationKey": { + "$ref": "#/definitions/associationsRecoverableEd25519Signature" + }, + "delegatedErc191": { + "$ref": "#/definitions/associationsLegacyDelegatedSignature" + } + }, + "title": "A wrapper for all possible signature types" + }, + "message_contentsSignedPublicKey": { + "type": "object", + "properties": { + "keyBytes": { + "type": "string", + "format": "byte", + "title": "embeds an UnsignedPublicKey" + }, + "signature": { + "$ref": "#/definitions/xmtpmessage_contentsSignature", + "title": "signs key_bytes" + } + }, + "title": "SignedPublicKey" + }, "protobufAny": { "type": "object", "properties": { @@ -45,6 +340,18 @@ } } }, + "v1GetAssociationStateResponse": { + "type": "object", + "properties": { + "associationState": { + "$ref": "#/definitions/associationsAssociationState" + }, + "stateDiff": { + "$ref": "#/definitions/associationsAssociationStateDiff" + } + }, + "title": "Response to GetAssociationStateRequest, containing the final association state\nfor an InboxID" + }, "v1ValidateGroupMessagesRequestGroupMessage": { "type": "object", "properties": { @@ -132,6 +439,18 @@ } }, "title": "An individual response to one key package" + }, + "xmtpmessage_contentsSignature": { + "type": "object", + "properties": { + "ecdsaCompact": { + "$ref": "#/definitions/SignatureECDSACompact" + }, + "walletEcdsaCompact": { + "$ref": "#/definitions/SignatureWalletECDSACompact" + } + }, + "description": "Signature represents a generalized public key signature,\ndefined as a union to support cryptographic algorithm agility." } } } From ab5ea92df26da6af0dfe2ae09a665bf7fd91c96b Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 25 Apr 2024 12:28:09 -0700 Subject: [PATCH 3/7] Migrate MLS DB To SQLC (#380) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## tl;dr Bun has been bothering me for a while, so I've been working on a migration that will get rid of our ORM altogether and just use boring SQL queries for everything. [`sqlc`](https://sqlc.dev/) is a very slick tool to generate code based on plain SQL queries using placeholders for arguments. It's not perfect...I had to do some gymnastics to make a few of the query types work. But the fact that there is no runtime other than the standard SQL driver and some generated code outweighs its limitations IMO. There's no fancy ORM library to worry about mangling your queries, and the learning curve is basically just "how well do you know SQL". ## What's wrong with Bun? - No support for serializable transactions - The SQL driver is not as well maintained as PGX - High learning curve to build complex queries, even if you know SQL well - Relations system is not very powerful and ends up doing N+1 queries a lot of the time. - Configuring the database with struct tags is errorprone, and there aren't great checks to make sure the struct tags actually match the schema. ## Things that suck right now with sqlc - I can't find a good way to have dynamic ORDER BY expressions. So I literally have separate queries for ASC and DESC versions. It's not the end of the world, but it's very frustrating. There's an [issue to fix it](https://github.com/sqlc-dev/sqlc/issues/2061), and some hacky workarounds using CASE statements, but it's not great. - Making the filters play nice with `json_populate_recordset` is a bit of a pain. Switching to the `pgx` driver helped, since I think there was a bug in Bun's pgdriver. ## Migration plan We use Bun in a lot of places and for a lot of things today. - It powers the `authz` database and all the migrations there - It powers the migrations for the `message` database (but not the queries) - It powers the `mls` database and all the queries in the `mlsstore`. The priority right now is to remove it from the `mlsstore`. We will still use it for migrations (`sqlc` can read Bun migrations just fine). This involves replacing the bun `pgdriver` with `pgx` (done in this PR) and replacing all the Bun ORM queries with `sqlc` queries. I have most of the queries written, but I'll split up the actual migration over several PRs. This can be done incrementally, but once the process is complete we can delete the Bun models. We aren't using any of the fancy `sqlc` cloud features and have no plans to. ## What knucklehead brought Bun into our codebase? Ummmm. 😬. That was me. --- README.md | 4 + dev/run | 5 +- dev/sqlc | 4 + go.mod | 13 +- go.sum | 22 +- .../mls/20240411200242_init-identity.up.sql | 2 +- .../20240425021053_add-inbox-filters.down.sql | 5 + .../20240425021053_add-inbox-filters.up.sql | 8 + pkg/mls/store/queries.sql | 78 +++ pkg/mls/store/queries/db.go | 31 ++ pkg/mls/store/queries/models.go | 52 ++ pkg/mls/store/queries/queries.sql.go | 472 ++++++++++++++++++ .../identity/associations/signature.pb.go | 139 +++--- .../identity/api/v1/identity.swagger.json | 12 +- .../mls_validation/v1/service.swagger.json | 12 +- pkg/server/pgxdb.go | 49 ++ pkg/server/server.go | 2 +- pkg/testing/store.go | 25 +- sqlc.yaml | 9 + 19 files changed, 859 insertions(+), 85 deletions(-) create mode 100755 dev/sqlc create mode 100644 pkg/migrations/mls/20240425021053_add-inbox-filters.down.sql create mode 100644 pkg/migrations/mls/20240425021053_add-inbox-filters.up.sql create mode 100644 pkg/mls/store/queries.sql create mode 100644 pkg/mls/store/queries/db.go create mode 100644 pkg/mls/store/queries/models.go create mode 100644 pkg/mls/store/queries/queries.sql.go create mode 100644 pkg/server/pgxdb.go create mode 100644 sqlc.yaml diff --git a/README.md b/README.md index 6e4919bd..e6217db1 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,10 @@ You must have the _exact_ go version listed in `go.mod` - you can verify this by 1. `dev/migrate-authz $MIGRATION_NAME` +### Updating the SQLC Queries for the MLSStore + +If you modify `pkg/mls/store/queries.sql` you need to run `./dev/sqlc` from the root of this package to regenerate any generated code. + ### Debugging metrics 1. `dev/run --metrics` diff --git a/dev/run b/dev/run index a995db08..a160bc5b 100755 --- a/dev/run +++ b/dev/run @@ -2,8 +2,8 @@ set -e MESSAGE_DB_DSN="postgres://postgres:xmtp@localhost:15432/postgres?sslmode=disable" -MLS_DB_DSN="postgres://postgres:xmtp@localhost:15432/postgres?sslmode=disable" -AUTHZ_DB_DSN="postgres://postgres:xmtp@localhost:15432/postgres?sslmode=disable" +MLS_DB_DSN="postgres://postgres:xmtp@localhost:7654/postgres?sslmode=disable" +AUTHZ_DB_DSN="postgres://postgres:xmtp@localhost:6543/postgres?sslmode=disable" NODE_KEY="8a30dcb604b0b53627a5adc054dbf434b446628d4bd1eccc681d223f0550ce67" go run cmd/xmtpd/main.go \ @@ -15,6 +15,7 @@ go run cmd/xmtpd/main.go \ --store.reader-db-connection-string "${MESSAGE_DB_DSN}" \ --store.metrics-period 5s \ --mls-store.db-connection-string "${MLS_DB_DSN}" \ + --mls-validation.grpc-address=validation:50051 \ --authz-db-connection-string "${AUTHZ_DB_DSN}" \ --go-profiling \ "$@" diff --git a/dev/sqlc b/dev/sqlc new file mode 100755 index 00000000..73d3557c --- /dev/null +++ b/dev/sqlc @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +docker run --rm -v $(pwd):/src -w /src sqlc/sqlc generate \ No newline at end of file diff --git a/go.mod b/go.mod index 83044d23..28fef3cf 100644 --- a/go.mod +++ b/go.mod @@ -12,6 +12,7 @@ require ( github.com/hashicorp/go-retryablehttp v0.7.0 github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d github.com/huandu/go-sqlbuilder v1.13.0 + github.com/jackc/pgx/v5 v5.5.5 github.com/jarcoal/httpmock v1.2.0 github.com/jessevdk/go-flags v1.4.0 github.com/libp2p/go-libp2p v0.29.2 @@ -39,6 +40,12 @@ require ( gopkg.in/DataDog/dd-trace-go.v1 v1.40.1 ) +require ( + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect + github.com/jackc/puddle/v2 v2.2.1 // indirect +) + require ( github.com/DataDog/datadog-agent/pkg/obfuscate v0.0.0-20211129110424-6491aa3bf583 // indirect github.com/DataDog/datadog-go v4.8.2+incompatible // indirect @@ -170,12 +177,12 @@ require ( go.uber.org/dig v1.17.0 // indirect go.uber.org/fx v1.20.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.13.0 // indirect + golang.org/x/crypto v0.17.0 // indirect golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.14.0 // indirect - golang.org/x/sys v0.12.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect golang.org/x/tools v0.12.1-0.20230818130535-1517d1a3ba60 // indirect golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect diff --git a/go.sum b/go.sum index c40fd15d..d3e17389 100644 --- a/go.sum +++ b/go.sum @@ -571,6 +571,7 @@ github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bY github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= @@ -584,6 +585,8 @@ github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwX github.com/jackc/pgproto3/v2 v2.2.0/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= @@ -602,12 +605,16 @@ github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904/go.mod h1:ZDaNWkt9s github.com/jackc/pgx/v4 v4.8.1/go.mod h1:4HOLxrl8wToZJReD04/yB20GDwf4KBYETvlHciCnwW0= github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= github.com/jackc/pgx/v4 v4.14.0/go.mod h1:jT3ibf/A0ZVCp89rtCIN0zCJxcE74ypROmHEZYsG/j8= +github.com/jackc/pgx/v5 v5.5.5 h1:amBjrZVmksIdNjxGW/IiIMzxMKZFelXbUoPNb+8sjQw= +github.com/jackc/pgx/v5 v5.5.5/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.2.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= +github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jarcoal/httpmock v1.2.0 h1:gSvTxxFR/MEMfsGrvRbdfpRUMBStovlSRLw0Ep1bwwc= @@ -668,8 +675,8 @@ github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0= github.com/koron/go-ssdp v0.0.4/go.mod h1:oDXq+E5IL5q0U8uSBcoAXzTzInwy5lEgC91HoKtbmZk= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= @@ -970,6 +977,7 @@ github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRr github.com/rjeczalik/notify v0.9.3 h1:6rJAzHTGKXGj76sbRgDiDcYj/HniypXmSJo1SWakZeY= github.com/rjeczalik/notify v0.9.3/go.mod h1:gF3zSOrafR9DQEWSE8TjfI9NkooDxbyT4UgRGKZA0lc= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= @@ -1239,8 +1247,8 @@ golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1442,8 +1450,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1457,8 +1465,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/pkg/migrations/mls/20240411200242_init-identity.up.sql b/pkg/migrations/mls/20240411200242_init-identity.up.sql index 4fdeef44..cc56762e 100644 --- a/pkg/migrations/mls/20240411200242_init-identity.up.sql +++ b/pkg/migrations/mls/20240411200242_init-identity.up.sql @@ -24,4 +24,4 @@ CREATE TABLE address_log ( --bun:split -CREATE INDEX idx_address_log_address_inbox_id ON address_log(address, inbox_id); +CREATE INDEX idx_address_log_address_inbox_id ON address_log(address, inbox_id); \ No newline at end of file diff --git a/pkg/migrations/mls/20240425021053_add-inbox-filters.down.sql b/pkg/migrations/mls/20240425021053_add-inbox-filters.down.sql new file mode 100644 index 00000000..f5b5f1c0 --- /dev/null +++ b/pkg/migrations/mls/20240425021053_add-inbox-filters.down.sql @@ -0,0 +1,5 @@ +SET statement_timeout = 0; + +--bun:split + +DROP TYPE IF EXISTS inbox_filter; \ No newline at end of file diff --git a/pkg/migrations/mls/20240425021053_add-inbox-filters.up.sql b/pkg/migrations/mls/20240425021053_add-inbox-filters.up.sql new file mode 100644 index 00000000..edd4b911 --- /dev/null +++ b/pkg/migrations/mls/20240425021053_add-inbox-filters.up.sql @@ -0,0 +1,8 @@ +SET statement_timeout = 0; + +--bun:split + +CREATE TYPE inbox_filter AS ( + inbox_id TEXT, + sequence_id BIGINT +); diff --git a/pkg/mls/store/queries.sql b/pkg/mls/store/queries.sql new file mode 100644 index 00000000..6436fd3b --- /dev/null +++ b/pkg/mls/store/queries.sql @@ -0,0 +1,78 @@ +-- name: GetAllInboxLogs :many +SELECT * FROM inbox_log +WHERE inbox_id = $1 +ORDER BY sequence_id ASC FOR UPDATE; + +-- name: GetInboxLogFiltered :many +SELECT a.* FROM inbox_log AS a +JOIN ( + SELECT * FROM json_populate_recordset(null::inbox_filter, sqlc.arg(filters)) as b(inbox_id, sequence_id) +) as b on b.inbox_id = a.inbox_id AND a.sequence_id > b.sequence_id +ORDER BY a.sequence_id ASC; + +-- name: InsertInboxLog :one +INSERT INTO inbox_log (inbox_id, server_timestamp_ns, identity_update_proto) +VALUES ($1, $2, $3) +RETURNING sequence_id; + +-- name: CreateInstallation :exec +INSERT INTO installations (id, wallet_address, created_at, updated_at, credential_identity, key_package, expiration) +VALUES ($1, $2, $3, $3, $4, $5, $6); + +-- name: UpdateKeyPackage :execrows +UPDATE installations +SET key_package = @key_package, updated_at = @updated_at, expiration = @expiration +WHERE id = @id; + +-- name: FetchKeyPackages :many +SELECT id, key_package FROM installations +WHERE ID IN (@ids); + +-- name: GetIdentityUpdates :many +SELECT * FROM installations +WHERE wallet_address IN (@wallet_addresses) +AND (created_at > @start_time OR revoked_at > @start_time) +ORDER BY created_at ASC; + +-- name: RevokeInstallation :exec +UPDATE installations +SET revoked_at = @revoked_at +WHERE id = @installation_id +AND revoked_at IS NULL; + +-- name: InsertGroupMessage :one +INSERT INTO group_messages (group_id, data, group_id_data_hash) +VALUES ($1, $2, $3) +RETURNING *; + +-- name: InsertWelcomeMessage :one +INSERT INTO welcome_messages (installation_key, data, installation_key_data_hash, hpke_public_key) +VALUES ($1, $2, $3, $4) +RETURNING *; + +-- name: QueryGroupMessagesAsc :many +SELECT * FROM group_messages +WHERE group_id = @group_id +ORDER BY id ASC +LIMIT @numrows; + +-- name: QueryGroupMessagesDesc :many +SELECT * FROM group_messages +WHERE group_id = @group_id +ORDER BY id DESC +LIMIT @numrows; + +-- name: QueryGroupMessagesWithCursorAsc :many +SELECT * FROM group_messages +WHERE group_id = $1 +AND id > $2 +ORDER BY id ASC +LIMIT $3; + +-- name: QueryGroupMessagesWithCursorDesc :many +SELECT * FROM group_messages +WHERE group_id = $1 +AND id < $2 +ORDER BY id DESC +LIMIT $3; + diff --git a/pkg/mls/store/queries/db.go b/pkg/mls/store/queries/db.go new file mode 100644 index 00000000..fa785733 --- /dev/null +++ b/pkg/mls/store/queries/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.26.0 + +package queries + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/pkg/mls/store/queries/models.go b/pkg/mls/store/queries/models.go new file mode 100644 index 00000000..cc2ae9d3 --- /dev/null +++ b/pkg/mls/store/queries/models.go @@ -0,0 +1,52 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.26.0 + +package queries + +import ( + "database/sql" + "time" +) + +type AddressLog struct { + Address string + InboxID string + AssociationSequenceID sql.NullInt64 + RevocationSequenceID sql.NullInt64 +} + +type GroupMessage struct { + ID int64 + CreatedAt time.Time + GroupID []byte + Data []byte + GroupIDDataHash []byte +} + +type InboxLog struct { + SequenceID int64 + InboxID string + ServerTimestampNs int64 + IdentityUpdateProto []byte +} + +type Installation struct { + ID []byte + WalletAddress string + CreatedAt int64 + UpdatedAt int64 + CredentialIdentity []byte + RevokedAt sql.NullInt64 + KeyPackage []byte + Expiration int64 +} + +type WelcomeMessage struct { + ID int64 + CreatedAt time.Time + InstallationKey []byte + Data []byte + InstallationKeyDataHash []byte + HpkePublicKey []byte +} diff --git a/pkg/mls/store/queries/queries.sql.go b/pkg/mls/store/queries/queries.sql.go new file mode 100644 index 00000000..337eebd8 --- /dev/null +++ b/pkg/mls/store/queries/queries.sql.go @@ -0,0 +1,472 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.26.0 +// source: queries.sql + +package queries + +import ( + "context" + "database/sql" + "encoding/json" +) + +const createInstallation = `-- name: CreateInstallation :exec +INSERT INTO installations (id, wallet_address, created_at, updated_at, credential_identity, key_package, expiration) +VALUES ($1, $2, $3, $3, $4, $5, $6) +` + +type CreateInstallationParams struct { + ID []byte + WalletAddress string + CreatedAt int64 + CredentialIdentity []byte + KeyPackage []byte + Expiration int64 +} + +func (q *Queries) CreateInstallation(ctx context.Context, arg CreateInstallationParams) error { + _, err := q.db.ExecContext(ctx, createInstallation, + arg.ID, + arg.WalletAddress, + arg.CreatedAt, + arg.CredentialIdentity, + arg.KeyPackage, + arg.Expiration, + ) + return err +} + +const fetchKeyPackages = `-- name: FetchKeyPackages :many +SELECT id, key_package FROM installations +WHERE ID IN ($1) +` + +type FetchKeyPackagesRow struct { + ID []byte + KeyPackage []byte +} + +func (q *Queries) FetchKeyPackages(ctx context.Context, ids []byte) ([]FetchKeyPackagesRow, error) { + rows, err := q.db.QueryContext(ctx, fetchKeyPackages, ids) + if err != nil { + return nil, err + } + defer rows.Close() + var items []FetchKeyPackagesRow + for rows.Next() { + var i FetchKeyPackagesRow + if err := rows.Scan(&i.ID, &i.KeyPackage); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getAllInboxLogs = `-- name: GetAllInboxLogs :many +SELECT sequence_id, inbox_id, server_timestamp_ns, identity_update_proto FROM inbox_log +WHERE inbox_id = $1 +ORDER BY sequence_id ASC FOR UPDATE +` + +func (q *Queries) GetAllInboxLogs(ctx context.Context, inboxID string) ([]InboxLog, error) { + rows, err := q.db.QueryContext(ctx, getAllInboxLogs, inboxID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []InboxLog + for rows.Next() { + var i InboxLog + if err := rows.Scan( + &i.SequenceID, + &i.InboxID, + &i.ServerTimestampNs, + &i.IdentityUpdateProto, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getIdentityUpdates = `-- name: GetIdentityUpdates :many +SELECT id, wallet_address, created_at, updated_at, credential_identity, revoked_at, key_package, expiration FROM installations +WHERE wallet_address IN ($1) +AND (created_at > $2 OR revoked_at > $2) +ORDER BY created_at ASC +` + +type GetIdentityUpdatesParams struct { + WalletAddresses string + StartTime int64 +} + +func (q *Queries) GetIdentityUpdates(ctx context.Context, arg GetIdentityUpdatesParams) ([]Installation, error) { + rows, err := q.db.QueryContext(ctx, getIdentityUpdates, arg.WalletAddresses, arg.StartTime) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Installation + for rows.Next() { + var i Installation + if err := rows.Scan( + &i.ID, + &i.WalletAddress, + &i.CreatedAt, + &i.UpdatedAt, + &i.CredentialIdentity, + &i.RevokedAt, + &i.KeyPackage, + &i.Expiration, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getInboxLogFiltered = `-- name: GetInboxLogFiltered :many +SELECT a.sequence_id, a.inbox_id, a.server_timestamp_ns, a.identity_update_proto FROM inbox_log AS a +JOIN ( + SELECT inbox_id, sequence_id FROM json_populate_recordset(null::inbox_filter, $1) as b(inbox_id, sequence_id) +) as b on b.inbox_id = a.inbox_id AND a.sequence_id > b.sequence_id +ORDER BY a.sequence_id ASC +` + +func (q *Queries) GetInboxLogFiltered(ctx context.Context, filters json.RawMessage) ([]InboxLog, error) { + rows, err := q.db.QueryContext(ctx, getInboxLogFiltered, filters) + if err != nil { + return nil, err + } + defer rows.Close() + var items []InboxLog + for rows.Next() { + var i InboxLog + if err := rows.Scan( + &i.SequenceID, + &i.InboxID, + &i.ServerTimestampNs, + &i.IdentityUpdateProto, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const insertGroupMessage = `-- name: InsertGroupMessage :one +INSERT INTO group_messages (group_id, data, group_id_data_hash) +VALUES ($1, $2, $3) +RETURNING id, created_at, group_id, data, group_id_data_hash +` + +type InsertGroupMessageParams struct { + GroupID []byte + Data []byte + GroupIDDataHash []byte +} + +func (q *Queries) InsertGroupMessage(ctx context.Context, arg InsertGroupMessageParams) (GroupMessage, error) { + row := q.db.QueryRowContext(ctx, insertGroupMessage, arg.GroupID, arg.Data, arg.GroupIDDataHash) + var i GroupMessage + err := row.Scan( + &i.ID, + &i.CreatedAt, + &i.GroupID, + &i.Data, + &i.GroupIDDataHash, + ) + return i, err +} + +const insertInboxLog = `-- name: InsertInboxLog :one +INSERT INTO inbox_log (inbox_id, server_timestamp_ns, identity_update_proto) +VALUES ($1, $2, $3) +RETURNING sequence_id +` + +type InsertInboxLogParams struct { + InboxID string + ServerTimestampNs int64 + IdentityUpdateProto []byte +} + +func (q *Queries) InsertInboxLog(ctx context.Context, arg InsertInboxLogParams) (int64, error) { + row := q.db.QueryRowContext(ctx, insertInboxLog, arg.InboxID, arg.ServerTimestampNs, arg.IdentityUpdateProto) + var sequence_id int64 + err := row.Scan(&sequence_id) + return sequence_id, err +} + +const insertWelcomeMessage = `-- name: InsertWelcomeMessage :one +INSERT INTO welcome_messages (installation_key, data, installation_key_data_hash, hpke_public_key) +VALUES ($1, $2, $3, $4) +RETURNING id, created_at, installation_key, data, installation_key_data_hash, hpke_public_key +` + +type InsertWelcomeMessageParams struct { + InstallationKey []byte + Data []byte + InstallationKeyDataHash []byte + HpkePublicKey []byte +} + +func (q *Queries) InsertWelcomeMessage(ctx context.Context, arg InsertWelcomeMessageParams) (WelcomeMessage, error) { + row := q.db.QueryRowContext(ctx, insertWelcomeMessage, + arg.InstallationKey, + arg.Data, + arg.InstallationKeyDataHash, + arg.HpkePublicKey, + ) + var i WelcomeMessage + err := row.Scan( + &i.ID, + &i.CreatedAt, + &i.InstallationKey, + &i.Data, + &i.InstallationKeyDataHash, + &i.HpkePublicKey, + ) + return i, err +} + +const queryGroupMessagesAsc = `-- name: QueryGroupMessagesAsc :many +SELECT id, created_at, group_id, data, group_id_data_hash FROM group_messages +WHERE group_id = $1 +ORDER BY id ASC +LIMIT $2 +` + +type QueryGroupMessagesAscParams struct { + GroupID []byte + Numrows int32 +} + +func (q *Queries) QueryGroupMessagesAsc(ctx context.Context, arg QueryGroupMessagesAscParams) ([]GroupMessage, error) { + rows, err := q.db.QueryContext(ctx, queryGroupMessagesAsc, arg.GroupID, arg.Numrows) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GroupMessage + for rows.Next() { + var i GroupMessage + if err := rows.Scan( + &i.ID, + &i.CreatedAt, + &i.GroupID, + &i.Data, + &i.GroupIDDataHash, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const queryGroupMessagesDesc = `-- name: QueryGroupMessagesDesc :many +SELECT id, created_at, group_id, data, group_id_data_hash FROM group_messages +WHERE group_id = $1 +ORDER BY id DESC +LIMIT $2 +` + +type QueryGroupMessagesDescParams struct { + GroupID []byte + Numrows int32 +} + +func (q *Queries) QueryGroupMessagesDesc(ctx context.Context, arg QueryGroupMessagesDescParams) ([]GroupMessage, error) { + rows, err := q.db.QueryContext(ctx, queryGroupMessagesDesc, arg.GroupID, arg.Numrows) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GroupMessage + for rows.Next() { + var i GroupMessage + if err := rows.Scan( + &i.ID, + &i.CreatedAt, + &i.GroupID, + &i.Data, + &i.GroupIDDataHash, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const queryGroupMessagesWithCursorAsc = `-- name: QueryGroupMessagesWithCursorAsc :many +SELECT id, created_at, group_id, data, group_id_data_hash FROM group_messages +WHERE group_id = $1 +AND id > $2 +ORDER BY id ASC +LIMIT $3 +` + +type QueryGroupMessagesWithCursorAscParams struct { + GroupID []byte + ID int64 + Limit int32 +} + +func (q *Queries) QueryGroupMessagesWithCursorAsc(ctx context.Context, arg QueryGroupMessagesWithCursorAscParams) ([]GroupMessage, error) { + rows, err := q.db.QueryContext(ctx, queryGroupMessagesWithCursorAsc, arg.GroupID, arg.ID, arg.Limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GroupMessage + for rows.Next() { + var i GroupMessage + if err := rows.Scan( + &i.ID, + &i.CreatedAt, + &i.GroupID, + &i.Data, + &i.GroupIDDataHash, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const queryGroupMessagesWithCursorDesc = `-- name: QueryGroupMessagesWithCursorDesc :many +SELECT id, created_at, group_id, data, group_id_data_hash FROM group_messages +WHERE group_id = $1 +AND id < $2 +ORDER BY id DESC +LIMIT $3 +` + +type QueryGroupMessagesWithCursorDescParams struct { + GroupID []byte + ID int64 + Limit int32 +} + +func (q *Queries) QueryGroupMessagesWithCursorDesc(ctx context.Context, arg QueryGroupMessagesWithCursorDescParams) ([]GroupMessage, error) { + rows, err := q.db.QueryContext(ctx, queryGroupMessagesWithCursorDesc, arg.GroupID, arg.ID, arg.Limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GroupMessage + for rows.Next() { + var i GroupMessage + if err := rows.Scan( + &i.ID, + &i.CreatedAt, + &i.GroupID, + &i.Data, + &i.GroupIDDataHash, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const revokeInstallation = `-- name: RevokeInstallation :exec +UPDATE installations +SET revoked_at = $1 +WHERE id = $2 +AND revoked_at IS NULL +` + +type RevokeInstallationParams struct { + RevokedAt sql.NullInt64 + InstallationID []byte +} + +func (q *Queries) RevokeInstallation(ctx context.Context, arg RevokeInstallationParams) error { + _, err := q.db.ExecContext(ctx, revokeInstallation, arg.RevokedAt, arg.InstallationID) + return err +} + +const updateKeyPackage = `-- name: UpdateKeyPackage :execrows +UPDATE installations +SET key_package = $1, updated_at = $2, expiration = $3 +WHERE id = $4 +` + +type UpdateKeyPackageParams struct { + KeyPackage []byte + UpdatedAt int64 + Expiration int64 + ID []byte +} + +func (q *Queries) UpdateKeyPackage(ctx context.Context, arg UpdateKeyPackageParams) (int64, error) { + result, err := q.db.ExecContext(ctx, updateKeyPackage, + arg.KeyPackage, + arg.UpdatedAt, + arg.Expiration, + arg.ID, + ) + if err != nil { + return 0, err + } + return result.RowsAffected() +} diff --git a/pkg/proto/identity/associations/signature.pb.go b/pkg/proto/identity/associations/signature.pb.go index 9a49794b..8f9824dc 100644 --- a/pkg/proto/identity/associations/signature.pb.go +++ b/pkg/proto/identity/associations/signature.pb.go @@ -78,7 +78,10 @@ type RecoverableEd25519Signature struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // 64 bytes [R(32 bytes) || S(32 bytes)] Bytes []byte `protobuf:"bytes,1,opt,name=bytes,proto3" json:"bytes,omitempty"` + // 32 bytes + PublicKey []byte `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` } func (x *RecoverableEd25519Signature) Reset() { @@ -120,15 +123,22 @@ func (x *RecoverableEd25519Signature) GetBytes() []byte { return nil } +func (x *RecoverableEd25519Signature) GetPublicKey() []byte { + if x != nil { + return x.PublicKey + } + return nil +} + // Smart wallet signature type Erc1271Signature struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // CAIP-10 contract address + // CAIP-10 // 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"` + AccountId string `protobuf:"bytes,1,opt,name=account_id,json=accountId,proto3" json:"account_id,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 @@ -167,9 +177,9 @@ func (*Erc1271Signature) Descriptor() ([]byte, []int) { return file_identity_associations_signature_proto_rawDescGZIP(), []int{2} } -func (x *Erc1271Signature) GetContractAddress() string { +func (x *Erc1271Signature) GetAccountId() string { if x != nil { - return x.ContractAddress + return x.AccountId } return "" } @@ -377,71 +387,72 @@ var file_identity_associations_signature_proto_rawDesc = []byte{ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x31, 0x0a, 0x19, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x45, 0x63, 0x64, 0x73, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x22, 0x33, 0x0a, 0x1b, 0x52, 0x65, 0x63, + 0x28, 0x0c, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x22, 0x52, 0x0a, 0x1b, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x45, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x22, 0x7e, - 0x0a, 0x10, 0x45, 0x72, 0x63, 0x31, 0x32, 0x37, 0x31, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 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, 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, - 0x65, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x4b, 0x0a, 0x0d, 0x64, - 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x26, 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, 0x52, 0x0c, 0x64, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x53, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x78, 0x6d, - 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, - 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, - 0x61, 0x62, 0x6c, 0x65, 0x45, 0x63, 0x64, 0x73, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xff, 0x02, - 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x50, 0x0a, 0x07, 0x65, - 0x72, 0x63, 0x5f, 0x31, 0x39, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x78, - 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, - 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, - 0x72, 0x61, 0x62, 0x6c, 0x65, 0x45, 0x63, 0x64, 0x73, 0x61, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x06, 0x65, 0x72, 0x63, 0x31, 0x39, 0x31, 0x12, 0x49, 0x0a, - 0x08, 0x65, 0x72, 0x63, 0x5f, 0x31, 0x32, 0x37, 0x31, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2c, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, - 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x45, 0x72, 0x63, - 0x31, 0x32, 0x37, 0x31, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, - 0x07, 0x65, 0x72, 0x63, 0x31, 0x32, 0x37, 0x31, 0x12, 0x64, 0x0a, 0x10, 0x69, 0x6e, 0x73, 0x74, - 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1d, + 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x22, 0x72, 0x0a, + 0x10, 0x45, 0x72, 0x63, 0x31, 0x32, 0x37, 0x31, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, + 0x12, 0x21, 0x0a, 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, 0x65, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x4b, + 0x0a, 0x0d, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 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, 0x52, 0x0c, 0x64, + 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x53, 0x0a, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, + 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, + 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x63, 0x6f, + 0x76, 0x65, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x45, 0x63, 0x64, 0x73, 0x61, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x22, 0xff, 0x02, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x50, + 0x0a, 0x07, 0x65, 0x72, 0x63, 0x5f, 0x31, 0x39, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x35, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, + 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x63, + 0x6f, 0x76, 0x65, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x45, 0x63, 0x64, 0x73, 0x61, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x06, 0x65, 0x72, 0x63, 0x31, 0x39, 0x31, + 0x12, 0x49, 0x0a, 0x08, 0x65, 0x72, 0x63, 0x5f, 0x31, 0x32, 0x37, 0x31, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x45, 0x64, 0x32, 0x35, 0x35, - 0x31, 0x39, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x0f, 0x69, - 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x62, - 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x65, 0x72, 0x63, 0x5f, - 0x31, 0x39, 0x31, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x78, 0x6d, 0x74, 0x70, - 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x6c, - 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x48, - 0x00, 0x52, 0x0f, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x45, 0x72, 0x63, 0x31, - 0x39, 0x31, 0x42, 0x0b, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x42, - 0xf8, 0x01, 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, + 0x45, 0x72, 0x63, 0x31, 0x32, 0x37, 0x31, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x48, 0x00, 0x52, 0x07, 0x65, 0x72, 0x63, 0x31, 0x32, 0x37, 0x31, 0x12, 0x64, 0x0a, 0x10, 0x69, + 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x42, 0x0e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3c, 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, 0x69, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0xa2, 0x02, 0x03, 0x58, 0x49, 0x41, 0xaa, 0x02, 0x1a, 0x58, 0x6d, 0x74, 0x70, 0x2e, - 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xca, 0x02, 0x1a, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x49, 0x64, 0x65, + 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x45, 0x64, + 0x32, 0x35, 0x35, 0x31, 0x39, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, + 0x52, 0x0f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, + 0x79, 0x12, 0x62, 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x65, + 0x72, 0x63, 0x5f, 0x31, 0x39, 0x31, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x78, + 0x6d, 0x74, 0x70, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, + 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, + 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x48, 0x00, 0x52, 0x0f, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x45, + 0x72, 0x63, 0x31, 0x39, 0x31, 0x42, 0x0b, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x42, 0xf8, 0x01, 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x6d, 0x74, 0x70, 0x2e, + 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x0e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3c, 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, + 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xa2, 0x02, 0x03, 0x58, 0x49, 0x41, 0xaa, 0x02, 0x1a, 0x58, 0x6d, + 0x74, 0x70, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2e, 0x41, 0x73, 0x73, 0x6f, + 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xca, 0x02, 0x1a, 0x58, 0x6d, 0x74, 0x70, 0x5c, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5c, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xe2, 0x02, 0x26, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5c, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0xe2, 0x02, 0x26, 0x58, 0x6d, 0x74, 0x70, 0x5c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x74, 0x79, 0x5c, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1c, 0x58, 0x6d, - 0x74, 0x70, 0x3a, 0x3a, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x3a, 0x3a, 0x41, 0x73, - 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x6e, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x1c, 0x58, 0x6d, 0x74, 0x70, 0x3a, 0x3a, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x3a, + 0x3a, 0x41, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/proto/openapi/identity/api/v1/identity.swagger.json b/pkg/proto/openapi/identity/api/v1/identity.swagger.json index c0e1850b..ce2bc819 100644 --- a/pkg/proto/openapi/identity/api/v1/identity.swagger.json +++ b/pkg/proto/openapi/identity/api/v1/identity.swagger.json @@ -213,9 +213,9 @@ "associationsErc1271Signature": { "type": "object", "properties": { - "contractAddress": { + "accountId": { "type": "string", - "title": "CAIP-10 contract address\nhttps://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-10.md" + "title": "CAIP-10\nhttps://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-10.md" }, "blockNumber": { "type": "string", @@ -298,7 +298,13 @@ "properties": { "bytes": { "type": "string", - "format": "byte" + "format": "byte", + "title": "64 bytes [R(32 bytes) || S(32 bytes)]" + }, + "publicKey": { + "type": "string", + "format": "byte", + "title": "32 bytes" } }, "title": "EdDSA signature for 25519" diff --git a/pkg/proto/openapi/mls_validation/v1/service.swagger.json b/pkg/proto/openapi/mls_validation/v1/service.swagger.json index 736ffc92..e581e909 100644 --- a/pkg/proto/openapi/mls_validation/v1/service.swagger.json +++ b/pkg/proto/openapi/mls_validation/v1/service.swagger.json @@ -142,9 +142,9 @@ "associationsErc1271Signature": { "type": "object", "properties": { - "contractAddress": { + "accountId": { "type": "string", - "title": "CAIP-10 contract address\nhttps://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-10.md" + "title": "CAIP-10\nhttps://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-10.md" }, "blockNumber": { "type": "string", @@ -251,7 +251,13 @@ "properties": { "bytes": { "type": "string", - "format": "byte" + "format": "byte", + "title": "64 bytes [R(32 bytes) || S(32 bytes)]" + }, + "publicKey": { + "type": "string", + "format": "byte", + "title": "32 bytes" } }, "title": "EdDSA signature for 25519" diff --git a/pkg/server/pgxdb.go b/pkg/server/pgxdb.go new file mode 100644 index 00000000..2c33c905 --- /dev/null +++ b/pkg/server/pgxdb.go @@ -0,0 +1,49 @@ +package server + +import ( + "context" + "database/sql" + "fmt" + "time" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgxpool" + "github.com/jackc/pgx/v5/stdlib" + _ "github.com/jackc/pgx/v5/stdlib" + "github.com/uptrace/bun" + "github.com/uptrace/bun/dialect/pgdialect" +) + +func newPGXDB(dsn string, waitForDB, statementTimeout time.Duration) (*sql.DB, error) { + config, err := pgxpool.ParseConfig(dsn) + if err != nil { + return nil, err + } + config.ConnConfig.DefaultQueryExecMode = pgx.QueryExecModeSimpleProtocol + config.ConnConfig.RuntimeParams["statement_timeout"] = fmt.Sprint(statementTimeout.Milliseconds()) + + dbpool, err := pgxpool.NewWithConfig(context.Background(), config) + if err != nil { + return nil, err + } + db := stdlib.OpenDBFromPool(dbpool) + + waitUntil := time.Now().Add(waitForDB) + + err = db.Ping() + for err != nil && time.Now().Before(waitUntil) { + time.Sleep(3 * time.Second) + err = db.Ping() + } + + return db, nil +} + +func newBunPGXDb(dsn string, waitForDB, statementTimeout time.Duration) (*bun.DB, error) { + pgxDb, err := newPGXDB(dsn, waitForDB, statementTimeout) + if err != nil { + return nil, err + } + + return bun.NewDB(pgxDb, pgdialect.New()), nil +} diff --git a/pkg/server/server.go b/pkg/server/server.go index 13d3e1b9..6dc0e4af 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -231,7 +231,7 @@ func New(ctx context.Context, log *zap.Logger, options Options) (*Server, error) var MLSStore *mlsstore.Store if options.MLSStore.DbConnectionString != "" { - if s.mlsDB, err = createBunDB(options.MLSStore.DbConnectionString, options.WaitForDB, options.MLSStore.ReadTimeout, options.MLSStore.WriteTimeout, options.MLSStore.MaxOpenConns); err != nil { + if s.mlsDB, err = newBunPGXDb(options.MLSStore.DbConnectionString, options.WaitForDB, options.MLSStore.ReadTimeout); err != nil { return nil, errors.Wrap(err, "creating mls db") } diff --git a/pkg/testing/store.go b/pkg/testing/store.go index bb4c4aff..cb30a27a 100644 --- a/pkg/testing/store.go +++ b/pkg/testing/store.go @@ -5,6 +5,8 @@ import ( "database/sql" "testing" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/stdlib" "github.com/stretchr/testify/require" "github.com/uptrace/bun" "github.com/uptrace/bun/dialect/pgdialect" @@ -36,6 +38,27 @@ func NewDB(t testing.TB) (*sql.DB, string, func()) { } } +func NewPGXDB(t testing.TB) (*sql.DB, string, func()) { + dsn := localTestDBDSNPrefix + localTestDBDSNSuffix + config, err := pgx.ParseConfig(dsn) + require.NoError(t, err) + ctlDB := stdlib.OpenDB(*config) + dbName := "test_" + RandomStringLower(12) + _, err = ctlDB.Exec("CREATE DATABASE " + dbName) + require.NoError(t, err) + + dsn = localTestDBDSNPrefix + "/" + dbName + localTestDBDSNSuffix + config2, err := pgx.ParseConfig(dsn) + require.NoError(t, err) + db := stdlib.OpenDB(*config2) + return db, dsn, func() { + db.Close() + _, err = ctlDB.Exec("DROP DATABASE " + dbName) + require.NoError(t, err) + ctlDB.Close() + } +} + func NewAuthzDB(t testing.TB) (*bun.DB, string, func()) { db, dsn, cleanup := NewDB(t) bunDB := bun.NewDB(db, pgdialect.New()) @@ -51,7 +74,7 @@ func NewAuthzDB(t testing.TB) (*bun.DB, string, func()) { } func NewMLSDB(t *testing.T) (*bun.DB, string, func()) { - db, dsn, cleanup := NewDB(t) + db, dsn, cleanup := NewPGXDB(t) bunDB := bun.NewDB(db, pgdialect.New()) ctx := context.Background() diff --git a/sqlc.yaml b/sqlc.yaml new file mode 100644 index 00000000..30575b4c --- /dev/null +++ b/sqlc.yaml @@ -0,0 +1,9 @@ +version: "2" +sql: + - engine: "postgresql" + queries: "pkg/mls/store/queries.sql" + schema: "pkg/migrations/mls" + gen: + go: + package: "queries" + out: "pkg/mls/store/queries" From 711545a06c037cc7e6f8ff99b2dd40059b345de2 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 25 Apr 2024 13:11:22 -0700 Subject: [PATCH 4/7] Migrate first store methods to sqlc (#381) --- go.mod | 1 + go.sum | 10 ++ pkg/mls/store/queries.sql | 81 ++++++++--- pkg/mls/store/queries/filters.go | 18 +++ pkg/mls/store/queries/queries.sql.go | 88 +++++++---- pkg/mls/store/store.go | 209 +++++++++++++-------------- 6 files changed, 247 insertions(+), 160 deletions(-) create mode 100644 pkg/mls/store/queries/filters.go diff --git a/go.mod b/go.mod index 28fef3cf..a3633504 100644 --- a/go.mod +++ b/go.mod @@ -44,6 +44,7 @@ require ( github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect github.com/jackc/puddle/v2 v2.2.1 // indirect + github.com/lib/pq v1.10.9 // indirect ) require ( diff --git a/go.sum b/go.sum index d3e17389..b74abd65 100644 --- a/go.sum +++ b/go.sum @@ -94,6 +94,7 @@ github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= @@ -298,6 +299,7 @@ github.com/go-ldap/ldap/v3 v3.1.3/go.mod h1:3rbOH3jRS2u6jg2rJnKAMLE/xQyCKIveG2Sa github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= @@ -640,16 +642,19 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfC github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= @@ -697,6 +702,8 @@ github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= +github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38yPW7c= @@ -812,6 +819,7 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= @@ -843,6 +851,7 @@ github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/n github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= @@ -976,6 +985,7 @@ github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1 github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rjeczalik/notify v0.9.3 h1:6rJAzHTGKXGj76sbRgDiDcYj/HniypXmSJo1SWakZeY= github.com/rjeczalik/notify v0.9.3/go.mod h1:gF3zSOrafR9DQEWSE8TjfI9NkooDxbyT4UgRGKZA0lc= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= diff --git a/pkg/mls/store/queries.sql b/pkg/mls/store/queries.sql index 6436fd3b..7bd43e35 100644 --- a/pkg/mls/store/queries.sql +++ b/pkg/mls/store/queries.sql @@ -1,44 +1,69 @@ -- name: GetAllInboxLogs :many -SELECT * FROM inbox_log +SELECT * +FROM inbox_log WHERE inbox_id = $1 -ORDER BY sequence_id ASC FOR UPDATE; +ORDER BY sequence_id ASC FOR +UPDATE; -- name: GetInboxLogFiltered :many -SELECT a.* FROM inbox_log AS a -JOIN ( - SELECT * FROM json_populate_recordset(null::inbox_filter, sqlc.arg(filters)) as b(inbox_id, sequence_id) -) as b on b.inbox_id = a.inbox_id AND a.sequence_id > b.sequence_id +SELECT a.* +FROM inbox_log AS a + JOIN ( + SELECT * + FROM json_populate_recordset(null::inbox_filter, sqlc.arg(filters)) as b(inbox_id, sequence_id) + ) as b on b.inbox_id = a.inbox_id + AND a.sequence_id > b.sequence_id ORDER BY a.sequence_id ASC; -- name: InsertInboxLog :one -INSERT INTO inbox_log (inbox_id, server_timestamp_ns, identity_update_proto) +INSERT INTO inbox_log ( + inbox_id, + server_timestamp_ns, + identity_update_proto + ) VALUES ($1, $2, $3) RETURNING sequence_id; -- name: CreateInstallation :exec -INSERT INTO installations (id, wallet_address, created_at, updated_at, credential_identity, key_package, expiration) +INSERT INTO installations ( + id, + wallet_address, + created_at, + updated_at, + credential_identity, + key_package, + expiration + ) VALUES ($1, $2, $3, $3, $4, $5, $6); -- name: UpdateKeyPackage :execrows UPDATE installations -SET key_package = @key_package, updated_at = @updated_at, expiration = @expiration +SET key_package = @key_package, + updated_at = @updated_at, + expiration = @expiration WHERE id = @id; -- name: FetchKeyPackages :many -SELECT id, key_package FROM installations -WHERE ID IN (@ids); +SELECT id, + key_package +FROM installations +WHERE id = ANY (sqlc.arg(installation_ids)::bytea []); -- name: GetIdentityUpdates :many -SELECT * FROM installations -WHERE wallet_address IN (@wallet_addresses) -AND (created_at > @start_time OR revoked_at > @start_time) +SELECT * +FROM installations +WHERE wallet_address = ANY (@wallet_addresses::text []) + AND ( + created_at > @start_time + OR revoked_at > @start_time + ) ORDER BY created_at ASC; -- name: RevokeInstallation :exec UPDATE installations SET revoked_at = @revoked_at WHERE id = @installation_id -AND revoked_at IS NULL; + AND revoked_at IS NULL; -- name: InsertGroupMessage :one INSERT INTO group_messages (group_id, data, group_id_data_hash) @@ -46,33 +71,41 @@ VALUES ($1, $2, $3) RETURNING *; -- name: InsertWelcomeMessage :one -INSERT INTO welcome_messages (installation_key, data, installation_key_data_hash, hpke_public_key) +INSERT INTO welcome_messages ( + installation_key, + data, + installation_key_data_hash, + hpke_public_key + ) VALUES ($1, $2, $3, $4) RETURNING *; -- name: QueryGroupMessagesAsc :many -SELECT * FROM group_messages +SELECT * +FROM group_messages WHERE group_id = @group_id ORDER BY id ASC LIMIT @numrows; -- name: QueryGroupMessagesDesc :many -SELECT * FROM group_messages +SELECT * +FROM group_messages WHERE group_id = @group_id ORDER BY id DESC LIMIT @numrows; -- name: QueryGroupMessagesWithCursorAsc :many -SELECT * FROM group_messages +SELECT * +FROM group_messages WHERE group_id = $1 -AND id > $2 + AND id > $2 ORDER BY id ASC LIMIT $3; -- name: QueryGroupMessagesWithCursorDesc :many -SELECT * FROM group_messages +SELECT * +FROM group_messages WHERE group_id = $1 -AND id < $2 + AND id < $2 ORDER BY id DESC -LIMIT $3; - +LIMIT $3; \ No newline at end of file diff --git a/pkg/mls/store/queries/filters.go b/pkg/mls/store/queries/filters.go new file mode 100644 index 00000000..38ed8dd6 --- /dev/null +++ b/pkg/mls/store/queries/filters.go @@ -0,0 +1,18 @@ +package queries + +import "encoding/json" + +type InboxLogFilter struct { + InboxId string `json:"inbox_id"` + SequenceId int64 `json:"sequence_id"` +} + +type InboxLogFilterList []InboxLogFilter + +func (f *InboxLogFilterList) ToSql() (json.RawMessage, error) { + jsonBytes, err := json.Marshal(f) + if err != nil { + return nil, err + } + return jsonBytes, nil +} diff --git a/pkg/mls/store/queries/queries.sql.go b/pkg/mls/store/queries/queries.sql.go index 337eebd8..8a2d795d 100644 --- a/pkg/mls/store/queries/queries.sql.go +++ b/pkg/mls/store/queries/queries.sql.go @@ -9,10 +9,20 @@ import ( "context" "database/sql" "encoding/json" + + "github.com/lib/pq" ) const createInstallation = `-- name: CreateInstallation :exec -INSERT INTO installations (id, wallet_address, created_at, updated_at, credential_identity, key_package, expiration) +INSERT INTO installations ( + id, + wallet_address, + created_at, + updated_at, + credential_identity, + key_package, + expiration + ) VALUES ($1, $2, $3, $3, $4, $5, $6) ` @@ -38,8 +48,10 @@ func (q *Queries) CreateInstallation(ctx context.Context, arg CreateInstallation } const fetchKeyPackages = `-- name: FetchKeyPackages :many -SELECT id, key_package FROM installations -WHERE ID IN ($1) +SELECT id, + key_package +FROM installations +WHERE id = ANY ($1::bytea []) ` type FetchKeyPackagesRow struct { @@ -47,8 +59,8 @@ type FetchKeyPackagesRow struct { KeyPackage []byte } -func (q *Queries) FetchKeyPackages(ctx context.Context, ids []byte) ([]FetchKeyPackagesRow, error) { - rows, err := q.db.QueryContext(ctx, fetchKeyPackages, ids) +func (q *Queries) FetchKeyPackages(ctx context.Context, installationIds [][]byte) ([]FetchKeyPackagesRow, error) { + rows, err := q.db.QueryContext(ctx, fetchKeyPackages, pq.Array(installationIds)) if err != nil { return nil, err } @@ -71,9 +83,11 @@ func (q *Queries) FetchKeyPackages(ctx context.Context, ids []byte) ([]FetchKeyP } const getAllInboxLogs = `-- name: GetAllInboxLogs :many -SELECT sequence_id, inbox_id, server_timestamp_ns, identity_update_proto FROM inbox_log +SELECT sequence_id, inbox_id, server_timestamp_ns, identity_update_proto +FROM inbox_log WHERE inbox_id = $1 -ORDER BY sequence_id ASC FOR UPDATE +ORDER BY sequence_id ASC FOR +UPDATE ` func (q *Queries) GetAllInboxLogs(ctx context.Context, inboxID string) ([]InboxLog, error) { @@ -105,19 +119,23 @@ func (q *Queries) GetAllInboxLogs(ctx context.Context, inboxID string) ([]InboxL } const getIdentityUpdates = `-- name: GetIdentityUpdates :many -SELECT id, wallet_address, created_at, updated_at, credential_identity, revoked_at, key_package, expiration FROM installations -WHERE wallet_address IN ($1) -AND (created_at > $2 OR revoked_at > $2) +SELECT id, wallet_address, created_at, updated_at, credential_identity, revoked_at, key_package, expiration +FROM installations +WHERE wallet_address = ANY ($1::text []) + AND ( + created_at > $2 + OR revoked_at > $2 + ) ORDER BY created_at ASC ` type GetIdentityUpdatesParams struct { - WalletAddresses string + WalletAddresses []string StartTime int64 } func (q *Queries) GetIdentityUpdates(ctx context.Context, arg GetIdentityUpdatesParams) ([]Installation, error) { - rows, err := q.db.QueryContext(ctx, getIdentityUpdates, arg.WalletAddresses, arg.StartTime) + rows, err := q.db.QueryContext(ctx, getIdentityUpdates, pq.Array(arg.WalletAddresses), arg.StartTime) if err != nil { return nil, err } @@ -149,10 +167,13 @@ func (q *Queries) GetIdentityUpdates(ctx context.Context, arg GetIdentityUpdates } const getInboxLogFiltered = `-- name: GetInboxLogFiltered :many -SELECT a.sequence_id, a.inbox_id, a.server_timestamp_ns, a.identity_update_proto FROM inbox_log AS a -JOIN ( - SELECT inbox_id, sequence_id FROM json_populate_recordset(null::inbox_filter, $1) as b(inbox_id, sequence_id) -) as b on b.inbox_id = a.inbox_id AND a.sequence_id > b.sequence_id +SELECT a.sequence_id, a.inbox_id, a.server_timestamp_ns, a.identity_update_proto +FROM inbox_log AS a + JOIN ( + SELECT inbox_id, sequence_id + FROM json_populate_recordset(null::inbox_filter, $1) as b(inbox_id, sequence_id) + ) as b on b.inbox_id = a.inbox_id + AND a.sequence_id > b.sequence_id ORDER BY a.sequence_id ASC ` @@ -210,7 +231,11 @@ func (q *Queries) InsertGroupMessage(ctx context.Context, arg InsertGroupMessage } const insertInboxLog = `-- name: InsertInboxLog :one -INSERT INTO inbox_log (inbox_id, server_timestamp_ns, identity_update_proto) +INSERT INTO inbox_log ( + inbox_id, + server_timestamp_ns, + identity_update_proto + ) VALUES ($1, $2, $3) RETURNING sequence_id ` @@ -229,7 +254,12 @@ func (q *Queries) InsertInboxLog(ctx context.Context, arg InsertInboxLogParams) } const insertWelcomeMessage = `-- name: InsertWelcomeMessage :one -INSERT INTO welcome_messages (installation_key, data, installation_key_data_hash, hpke_public_key) +INSERT INTO welcome_messages ( + installation_key, + data, + installation_key_data_hash, + hpke_public_key + ) VALUES ($1, $2, $3, $4) RETURNING id, created_at, installation_key, data, installation_key_data_hash, hpke_public_key ` @@ -261,7 +291,8 @@ func (q *Queries) InsertWelcomeMessage(ctx context.Context, arg InsertWelcomeMes } const queryGroupMessagesAsc = `-- name: QueryGroupMessagesAsc :many -SELECT id, created_at, group_id, data, group_id_data_hash FROM group_messages +SELECT id, created_at, group_id, data, group_id_data_hash +FROM group_messages WHERE group_id = $1 ORDER BY id ASC LIMIT $2 @@ -302,7 +333,8 @@ func (q *Queries) QueryGroupMessagesAsc(ctx context.Context, arg QueryGroupMessa } const queryGroupMessagesDesc = `-- name: QueryGroupMessagesDesc :many -SELECT id, created_at, group_id, data, group_id_data_hash FROM group_messages +SELECT id, created_at, group_id, data, group_id_data_hash +FROM group_messages WHERE group_id = $1 ORDER BY id DESC LIMIT $2 @@ -343,9 +375,10 @@ func (q *Queries) QueryGroupMessagesDesc(ctx context.Context, arg QueryGroupMess } const queryGroupMessagesWithCursorAsc = `-- name: QueryGroupMessagesWithCursorAsc :many -SELECT id, created_at, group_id, data, group_id_data_hash FROM group_messages +SELECT id, created_at, group_id, data, group_id_data_hash +FROM group_messages WHERE group_id = $1 -AND id > $2 + AND id > $2 ORDER BY id ASC LIMIT $3 ` @@ -386,9 +419,10 @@ func (q *Queries) QueryGroupMessagesWithCursorAsc(ctx context.Context, arg Query } const queryGroupMessagesWithCursorDesc = `-- name: QueryGroupMessagesWithCursorDesc :many -SELECT id, created_at, group_id, data, group_id_data_hash FROM group_messages +SELECT id, created_at, group_id, data, group_id_data_hash +FROM group_messages WHERE group_id = $1 -AND id < $2 + AND id < $2 ORDER BY id DESC LIMIT $3 ` @@ -432,7 +466,7 @@ const revokeInstallation = `-- name: RevokeInstallation :exec UPDATE installations SET revoked_at = $1 WHERE id = $2 -AND revoked_at IS NULL + AND revoked_at IS NULL ` type RevokeInstallationParams struct { @@ -447,7 +481,9 @@ func (q *Queries) RevokeInstallation(ctx context.Context, arg RevokeInstallation const updateKeyPackage = `-- name: UpdateKeyPackage :execrows UPDATE installations -SET key_package = $1, updated_at = $2, expiration = $3 +SET key_package = $1, + updated_at = $2, + expiration = $3 WHERE id = $4 ` diff --git a/pkg/mls/store/store.go b/pkg/mls/store/store.go index f26a42d3..9e5f6da5 100644 --- a/pkg/mls/store/store.go +++ b/pkg/mls/store/store.go @@ -12,6 +12,7 @@ import ( "github.com/uptrace/bun" "github.com/uptrace/bun/migrate" migrations "github.com/xmtp/xmtp-node-go/pkg/migrations/mls" + queries "github.com/xmtp/xmtp-node-go/pkg/mls/store/queries" 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" @@ -22,9 +23,10 @@ import ( const maxPageSize = 100 type Store struct { - config Config - log *zap.Logger - db *bun.DB + config Config + log *zap.Logger + db *bun.DB + queries *queries.Queries } type IdentityStore interface { @@ -37,7 +39,7 @@ type MlsStore interface { 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) + FetchKeyPackages(ctx context.Context, installationIds [][]byte) ([]queries.FetchKeyPackagesRow, error) GetIdentityUpdates(ctx context.Context, walletAddresses []string, startTimeNs int64) (map[string]IdentityUpdateList, error) InsertGroupMessage(ctx context.Context, groupId []byte, data []byte) (*GroupMessage, error) InsertWelcomeMessage(ctx context.Context, installationId []byte, data []byte, hpkePublicKey []byte) (*WelcomeMessage, error) @@ -52,9 +54,10 @@ func New(ctx context.Context, config Config) (*Store, error) { } } s := &Store{ - log: config.Log.Named("mlsstore"), - db: config.DB, - config: config, + log: config.Log.Named("mlsstore"), + db: config.DB, + config: config, + queries: queries.New(config.DB.DB), } if err := s.migrate(ctx); err != nil { @@ -70,54 +73,42 @@ func (s *Store) PublishIdentityUpdate(ctx context.Context, req *identity.Publish return nil, errors.New("IdentityUpdate is required") } - // 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(). - Model(&inbox_log_entries). - Where("inbox_id = ?", new_update.GetInboxId()). - Order("sequence_id ASC"). - For("UPDATE"). - Scan(ctx); err != nil { + if err := s.RunInTx(ctx, &sql.TxOptions{Isolation: sql.LevelSerializable}, func(ctx context.Context, txQueries *queries.Queries) error { + inboxLogEntries, err := txQueries.GetAllInboxLogs(ctx, new_update.GetInboxId()) + if err != nil { return err } - if len(inbox_log_entries) >= 256 { + if len(inboxLogEntries) >= 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{} - if err := proto.Unmarshal(log.IdentityUpdateProto, identity_update); err != nil { + updates := make([]*associations.IdentityUpdate, 0, len(inboxLogEntries)+1) + for _, log := range inboxLogEntries { + identityUpdate := &associations.IdentityUpdate{} + if err := proto.Unmarshal(log.IdentityUpdateProto, identityUpdate); err != nil { return err } - updates = append(updates, identity_update) + updates = append(updates, identityUpdate) } _ = append(updates, new_update) // TODO: Validate the updates, and abort transaction if failed - proto_bytes, err := proto.Marshal(new_update) + protoBytes, err := proto.Marshal(new_update) if err != nil { return err } - new_entry := InboxLogEntry{ - InboxId: new_update.GetInboxId(), + _, err = txQueries.InsertInboxLog(ctx, queries.InsertInboxLogParams{ + InboxID: new_update.GetInboxId(), ServerTimestampNs: nowNs(), - IdentityUpdateProto: proto_bytes, - } + IdentityUpdateProto: protoBytes, + }) - _, 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 @@ -130,36 +121,47 @@ func (s *Store) PublishIdentityUpdate(ctx context.Context, req *identity.Publish 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)) + filters := make(queries.InboxLogFilterList, 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()). - Order("sequence_id ASC"). - Scan(ctx) - if err != nil { - return nil, err + filters[i] = queries.InboxLogFilter{ + InboxId: req.InboxId, + SequenceId: int64(req.SequenceId), } + } + filterBytes, err := filters.ToSql() + if err != nil { + return nil, err + } - updates := make([]*identity.GetIdentityUpdatesResponse_IdentityUpdateLog, len(inbox_log_entries)) - for j, entry := range inbox_log_entries { + results, err := s.queries.GetInboxLogFiltered(ctx, filterBytes) + if err != nil { + return nil, err + } + + // Organize the results by inbox ID + resultMap := make(map[string][]queries.InboxLog) + for _, result := range results { + resultMap[result.InboxID] = append(resultMap[result.InboxID], result) + } + + resps := make([]*identity.GetIdentityUpdatesResponse_Response, len(reqs)) + for i, req := range reqs { + logEntries := resultMap[req.InboxId] + updates := make([]*identity.GetIdentityUpdatesResponse_IdentityUpdateLog, len(logEntries)) + for j, entry := range logEntries { 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, + SequenceId: uint64(entry.SequenceID), ServerTimestampNs: uint64(entry.ServerTimestampNs), Update: identity_update, } } - resps[i] = &identity.GetIdentityUpdatesResponse_Response{ - InboxId: req.GetInboxId(), + InboxId: req.InboxId, Updates: updates, } } @@ -173,78 +175,45 @@ func (s *Store) GetInboxLogs(ctx context.Context, batched_req *identity.GetIdent func (s *Store) CreateInstallation(ctx context.Context, installationId []byte, walletAddress string, credentialIdentity, keyPackage []byte, expiration uint64) error { createdAt := nowNs() - installation := Installation{ + return s.queries.CreateInstallation(ctx, queries.CreateInstallationParams{ ID: installationId, WalletAddress: walletAddress, CreatedAt: createdAt, - UpdatedAt: createdAt, CredentialIdentity: credentialIdentity, - - KeyPackage: keyPackage, - Expiration: expiration, - } - - _, err := s.db.NewInsert(). - Model(&installation). - Ignore(). - Exec(ctx) - return err + KeyPackage: keyPackage, + Expiration: int64(expiration), + }) } // Insert a new key package, ignoring any that may already exist func (s *Store) UpdateKeyPackage(ctx context.Context, installationId, keyPackage []byte, expiration uint64) error { - installation := Installation{ - ID: installationId, - UpdatedAt: nowNs(), - + rowsUpdated, err := s.queries.UpdateKeyPackage(ctx, queries.UpdateKeyPackageParams{ + ID: installationId, + UpdatedAt: nowNs(), KeyPackage: keyPackage, - Expiration: expiration, - } + Expiration: int64(expiration), + }) - res, err := s.db.NewUpdate(). - Model(&installation). - OmitZero(). - WherePK(). - Exec(ctx) if err != nil { return err } - rows, err := res.RowsAffected() - if err != nil { - return err - } - if rows == 0 { + + if rowsUpdated == 0 { return errors.New("installation id unknown") } + return nil } -func (s *Store) FetchKeyPackages(ctx context.Context, installationIds [][]byte) ([]*Installation, error) { - installations := make([]*Installation, 0) - - err := s.db.NewSelect(). - Model(&installations). - Where("ID IN (?)", bun.In(installationIds)). - Scan(ctx, &installations) - if err != nil { - return nil, err - } - - return installations, nil +func (s *Store) FetchKeyPackages(ctx context.Context, installationIds [][]byte) ([]queries.FetchKeyPackagesRow, error) { + return s.queries.FetchKeyPackages(ctx, installationIds) } func (s *Store) GetIdentityUpdates(ctx context.Context, walletAddresses []string, startTimeNs int64) (map[string]IdentityUpdateList, error) { - updated := make([]*Installation, 0) - // Find all installations that were changed since the startTimeNs - err := s.db.NewSelect(). - Model(&updated). - Where("wallet_address IN (?)", bun.In(walletAddresses)). - WhereGroup(" AND ", func(q *bun.SelectQuery) *bun.SelectQuery { - return q.Where("created_at > ?", startTimeNs).WhereOr("revoked_at > ?", startTimeNs) - }). - Order("created_at ASC"). - Scan(ctx) - + updated, err := s.queries.GetIdentityUpdates(ctx, queries.GetIdentityUpdatesParams{ + WalletAddresses: walletAddresses, + StartTime: startTimeNs, + }) if err != nil { return nil, err } @@ -260,11 +229,11 @@ func (s *Store) GetIdentityUpdates(ctx context.Context, walletAddresses []string TimestampNs: uint64(installation.CreatedAt), }) } - if installation.RevokedAt != nil && *installation.RevokedAt > startTimeNs { + if installation.RevokedAt.Valid && installation.RevokedAt.Int64 > startTimeNs { out[installation.WalletAddress] = append(out[installation.WalletAddress], IdentityUpdate{ Kind: Revoke, InstallationKey: installation.ID, - TimestampNs: uint64(*installation.RevokedAt), + TimestampNs: uint64(installation.RevokedAt.Int64), }) } } @@ -277,14 +246,10 @@ func (s *Store) GetIdentityUpdates(ctx context.Context, walletAddresses []string } func (s *Store) RevokeInstallation(ctx context.Context, installationId []byte) error { - _, err := s.db.NewUpdate(). - Model(&Installation{}). - Set("revoked_at = ?", nowNs()). - Where("id = ?", installationId). - Where("revoked_at IS NULL"). - Exec(ctx) - - return err + return s.queries.RevokeInstallation(ctx, queries.RevokeInstallationParams{ + RevokedAt: sql.NullInt64{Valid: true, Int64: nowNs()}, + InstallationID: installationId, + }) } func (s *Store) InsertGroupMessage(ctx context.Context, groupId []byte, data []byte) (*GroupMessage, error) { @@ -534,3 +499,27 @@ func IsAlreadyExistsError(err error) bool { _, ok := err.(*AlreadyExistsError) return ok } + +func (s *Store) RunInTx( + ctx context.Context, opts *sql.TxOptions, fn func(ctx context.Context, txQueries *queries.Queries) error, +) error { + tx, err := s.db.DB.BeginTx(ctx, opts) + if err != nil { + return err + } + + var done bool + + defer func() { + if !done { + _ = tx.Rollback() + } + }() + + if err := fn(ctx, s.queries.WithTx(tx)); err != nil { + return err + } + + done = true + return tx.Commit() +} From cb1822fce9aa1ed4a83984b9af513cf1527f69c6 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 25 Apr 2024 14:36:28 -0700 Subject: [PATCH 5/7] Add GetInboxIDs and use validation service in PublishIdentityUpdates (#382) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial commit * Set up sqlc * Initial commit * Set up sqlc * Migrate first store methods to sqlc * Migrate first store methods to sqlc * Migrate first store methods to sqlc * Add GetAddressLog SQL * Add GetAddressLog SQL * Merge branch '04-24-migrate_first_store_methods_to_sqlc' of github.com:xmtp/xmtp-node-go into 04-24-migrate_first_store_methods_to_sqlc * Add GetAddressLog SQL * Initial commit * Set up sqlc * Initial commit * Set up sqlc * Add InsertLog Query (#383) * Add insertlog query * validation service * insert log * revocation for removed members * lint * remove unnecessary log * change test to use query from sqlc * remove comments * fix tests * Migrate first store methods to sqlc * Migrate MLS DB To SQLC (#380) Bun has been bothering me for a while, so I've been working on a migration that will get rid of our ORM altogether and just use boring SQL queries for everything. [`sqlc`](https://sqlc.dev/) is a very slick tool to generate code based on plain SQL queries using placeholders for arguments. It's not perfect...I had to do some gymnastics to make a few of the query types work. But the fact that there is no runtime other than the standard SQL driver and some generated code outweighs its limitations IMO. There's no fancy ORM library to worry about mangling your queries, and the learning curve is basically just "how well do you know SQL". - No support for serializable transactions - The SQL driver is not as well maintained as PGX - High learning curve to build complex queries, even if you know SQL well - Relations system is not very powerful and ends up doing N+1 queries a lot of the time. - Configuring the database with struct tags is errorprone, and there aren't great checks to make sure the struct tags actually match the schema. - I can't find a good way to have dynamic ORDER BY expressions. So I literally have separate queries for ASC and DESC versions. It's not the end of the world, but it's very frustrating. There's an [issue to fix it](https://github.com/sqlc-dev/sqlc/issues/2061), and some hacky workarounds using CASE statements, but it's not great. - Making the filters play nice with `json_populate_recordset` is a bit of a pain. Switching to the `pgx` driver helped, since I think there was a bug in Bun's pgdriver. We use Bun in a lot of places and for a lot of things today. - It powers the `authz` database and all the migrations there - It powers the migrations for the `message` database (but not the queries) - It powers the `mls` database and all the queries in the `mlsstore`. The priority right now is to remove it from the `mlsstore`. We will still use it for migrations (`sqlc` can read Bun migrations just fine). This involves replacing the bun `pgdriver` with `pgx` (done in this PR) and replacing all the Bun ORM queries with `sqlc` queries. I have most of the queries written, but I'll split up the actual migration over several PRs. This can be done incrementally, but once the process is complete we can delete the Bun models. We aren't using any of the fancy `sqlc` cloud features and have no plans to. Ummmm. 😬. That was me. * Migrate first store methods to sqlc * Add InsertLog Query (#383) * Add insertlog query * validation service * insert log * revocation for removed members * lint * remove unnecessary log * change test to use query from sqlc * remove comments * fix tests * Add GetAddressLog SQL * Merge branch '04-24-migrate_first_store_methods_to_sqlc' of github.com:xmtp/xmtp-node-go into 04-24-migrate_first_store_methods_to_sqlc * Add InsertLog Query (#383) * Add insertlog query * validation service * insert log * revocation for removed members * lint * remove unnecessary log * change test to use query from sqlc * remove comments * fix tests * Add InsertLog Query (#383) * Add insertlog query * validation service * insert log * revocation for removed members * lint * remove unnecessary log * change test to use query from sqlc * remove comments * fix tests --------- Co-authored-by: Andrew Plaza --- pkg/identity/api/v1/identity_service.go | 6 +- pkg/identity/api/v1/identity_service_test.go | 22 +++- .../mls/20240411200242_init-identity.up.sql | 4 - pkg/mls/store/models.go | 9 ++ pkg/mls/store/queries.sql | 39 +++++++ pkg/mls/store/queries/queries.sql.go | 106 ++++++++++++++++++ pkg/mls/store/store.go | 77 ++++++++++++- pkg/mls/store/store_test.go | 43 +++++++ 8 files changed, 292 insertions(+), 14 deletions(-) diff --git a/pkg/identity/api/v1/identity_service.go b/pkg/identity/api/v1/identity_service.go index 7f36b31d..8c1459be 100644 --- a/pkg/identity/api/v1/identity_service.go +++ b/pkg/identity/api/v1/identity_service.go @@ -7,8 +7,6 @@ import ( "github.com/xmtp/xmtp-node-go/pkg/mlsvalidate" api "github.com/xmtp/xmtp-node-go/pkg/proto/identity/api/v1" "go.uber.org/zap" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) type Service struct { @@ -78,7 +76,7 @@ Start transaction (SERIALIZABLE isolation level) End transaction */ func (s *Service) PublishIdentityUpdate(ctx context.Context, req *api.PublishIdentityUpdateRequest) (*api.PublishIdentityUpdateResponse, error) { - return s.store.PublishIdentityUpdate(ctx, req) + return s.store.PublishIdentityUpdate(ctx, req, s.validationService) } func (s *Service) GetIdentityUpdates(ctx context.Context, req *api.GetIdentityUpdatesRequest) (*api.GetIdentityUpdatesResponse, error) { @@ -97,5 +95,5 @@ func (s *Service) GetInboxIds(ctx context.Context, req *api.GetInboxIdsRequest) for the address where revocation_sequence_id is lower or NULL 2. Return the value of the 'inbox_id' column */ - return nil, status.Errorf(codes.Unimplemented, "unimplemented") + return s.store.GetInboxIds(ctx, req) } diff --git a/pkg/identity/api/v1/identity_service_test.go b/pkg/identity/api/v1/identity_service_test.go index d0a7d2c4..24d49a4c 100644 --- a/pkg/identity/api/v1/identity_service_test.go +++ b/pkg/identity/api/v1/identity_service_test.go @@ -20,7 +20,27 @@ type mockedMLSValidationService struct { } func (m *mockedMLSValidationService) GetAssociationState(ctx context.Context, oldUpdates []*associations.IdentityUpdate, newUpdates []*associations.IdentityUpdate) (*mlsvalidate.AssociationStateResult, error) { - return nil, nil + + member_map := make([]*associations.MemberMap, 0) + member_map = append(member_map, &associations.MemberMap{ + Key: &associations.MemberIdentifier{Kind: &associations.MemberIdentifier_Address{Address: "key_address"}}, + Value: &associations.Member{ + Identifier: &associations.MemberIdentifier{Kind: &associations.MemberIdentifier_Address{Address: "ident"}}, + AddedByEntity: &associations.MemberIdentifier{Kind: &associations.MemberIdentifier_Address{Address: "added_by_entity"}}, + }, + }) + + new_members := make([]*associations.MemberIdentifier, 0) + + new_members = append(new_members, &associations.MemberIdentifier{Kind: &associations.MemberIdentifier_Address{Address: "0x01"}}) + new_members = append(new_members, &associations.MemberIdentifier{Kind: &associations.MemberIdentifier_Address{Address: "0x02"}}) + new_members = append(new_members, &associations.MemberIdentifier{Kind: &associations.MemberIdentifier_Address{Address: "0x03"}}) + + out := mlsvalidate.AssociationStateResult{ + AssociationState: &associations.AssociationState{InboxId: "test_inbox", Members: member_map, RecoveryAddress: "recovery", SeenSignatures: [][]byte{[]byte("seen"), []byte("sig")}}, + StateDiff: &associations.AssociationStateDiff{NewMembers: new_members, RemovedMembers: nil}, + } + return &out, nil } func (m *mockedMLSValidationService) ValidateKeyPackages(ctx context.Context, keyPackages [][]byte) ([]mlsvalidate.IdentityValidationResult, error) { diff --git a/pkg/migrations/mls/20240411200242_init-identity.up.sql b/pkg/migrations/mls/20240411200242_init-identity.up.sql index cc56762e..d3399c0b 100644 --- a/pkg/migrations/mls/20240411200242_init-identity.up.sql +++ b/pkg/migrations/mls/20240411200242_init-identity.up.sql @@ -1,7 +1,6 @@ SET statement_timeout = 0; --bun:split - CREATE TABLE inbox_log ( sequence_id BIGSERIAL PRIMARY KEY, inbox_id TEXT NOT NULL, @@ -10,11 +9,9 @@ CREATE TABLE inbox_log ( ); --bun:split - CREATE INDEX idx_inbox_log_inbox_id ON inbox_log(inbox_id); --bun:split - CREATE TABLE address_log ( address TEXT NOT NULL, inbox_id TEXT NOT NULL, @@ -23,5 +20,4 @@ CREATE TABLE address_log ( ); --bun:split - CREATE INDEX idx_address_log_address_inbox_id ON address_log(address, inbox_id); \ No newline at end of file diff --git a/pkg/mls/store/models.go b/pkg/mls/store/models.go index 4ac6342f..47d7145b 100644 --- a/pkg/mls/store/models.go +++ b/pkg/mls/store/models.go @@ -6,6 +6,15 @@ import ( "github.com/uptrace/bun" ) +type AddressLogEntry struct { + bun.BaseModel `bun:"table:address_log"` + + Address string `bun:",notnull"` + InboxId string `bun:",notnull"` + AssociationSequenceId *uint64 `bun:","` + RevocationSequenceId *uint64 `bun:","` +} + type InboxLogEntry struct { bun.BaseModel `bun:"table:inbox_log"` diff --git a/pkg/mls/store/queries.sql b/pkg/mls/store/queries.sql index 7bd43e35..a63937ce 100644 --- a/pkg/mls/store/queries.sql +++ b/pkg/mls/store/queries.sql @@ -15,6 +15,31 @@ FROM inbox_log AS a AND a.sequence_id > b.sequence_id ORDER BY a.sequence_id ASC; +-- name: GetAddressLogs :many +SELECT a.address, + a.inbox_id, + a.association_sequence_id +FROM address_log a + INNER JOIN ( + SELECT address, + MAX(association_sequence_id) AS max_association_sequence_id + FROM address_log + WHERE address = ANY (@addresses::text []) + AND revocation_sequence_id IS NULL + GROUP BY address + ) b ON a.address = b.address + AND a.association_sequence_id = b.max_association_sequence_id; + +-- name: InsertAddressLog :one +INSERT INTO address_log ( + address, + inbox_id, + association_sequence_id, + revocation_sequence_id + ) +VALUES ($1, $2, $3, $4) +RETURNING *; + -- name: InsertInboxLog :one INSERT INTO inbox_log ( inbox_id, @@ -24,6 +49,20 @@ INSERT INTO inbox_log ( VALUES ($1, $2, $3) RETURNING sequence_id; +-- name: RevokeAddressFromLog :exec +UPDATE address_log +SET revocation_sequence_id = $1 +WHERE (address, inbox_id, association_sequence_id) = ( + SELECT address, + inbox_id, + MAX(association_sequence_id) + FROM address_log AS a + WHERE a.address = $2 + AND a.inbox_id = $3 + GROUP BY address, + inbox_id + ); + -- name: CreateInstallation :exec INSERT INTO installations ( id, diff --git a/pkg/mls/store/queries/queries.sql.go b/pkg/mls/store/queries/queries.sql.go index 8a2d795d..db14c010 100644 --- a/pkg/mls/store/queries/queries.sql.go +++ b/pkg/mls/store/queries/queries.sql.go @@ -82,6 +82,51 @@ func (q *Queries) FetchKeyPackages(ctx context.Context, installationIds [][]byte return items, nil } +const getAddressLogs = `-- name: GetAddressLogs :many +SELECT a.address, + a.inbox_id, + a.association_sequence_id +FROM address_log a + INNER JOIN ( + SELECT address, + MAX(association_sequence_id) AS max_association_sequence_id + FROM address_log + WHERE address = ANY ($1::text []) + AND revocation_sequence_id IS NULL + GROUP BY address + ) b ON a.address = b.address + AND a.association_sequence_id = b.max_association_sequence_id +` + +type GetAddressLogsRow struct { + Address string + InboxID string + AssociationSequenceID sql.NullInt64 +} + +func (q *Queries) GetAddressLogs(ctx context.Context, addresses []string) ([]GetAddressLogsRow, error) { + rows, err := q.db.QueryContext(ctx, getAddressLogs, pq.Array(addresses)) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetAddressLogsRow + for rows.Next() { + var i GetAddressLogsRow + if err := rows.Scan(&i.Address, &i.InboxID, &i.AssociationSequenceID); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const getAllInboxLogs = `-- name: GetAllInboxLogs :many SELECT sequence_id, inbox_id, server_timestamp_ns, identity_update_proto FROM inbox_log @@ -205,6 +250,41 @@ func (q *Queries) GetInboxLogFiltered(ctx context.Context, filters json.RawMessa return items, nil } +const insertAddressLog = `-- name: InsertAddressLog :one +INSERT INTO address_log ( + address, + inbox_id, + association_sequence_id, + revocation_sequence_id + ) +VALUES ($1, $2, $3, $4) +RETURNING address, inbox_id, association_sequence_id, revocation_sequence_id +` + +type InsertAddressLogParams struct { + Address string + InboxID string + AssociationSequenceID sql.NullInt64 + RevocationSequenceID sql.NullInt64 +} + +func (q *Queries) InsertAddressLog(ctx context.Context, arg InsertAddressLogParams) (AddressLog, error) { + row := q.db.QueryRowContext(ctx, insertAddressLog, + arg.Address, + arg.InboxID, + arg.AssociationSequenceID, + arg.RevocationSequenceID, + ) + var i AddressLog + err := row.Scan( + &i.Address, + &i.InboxID, + &i.AssociationSequenceID, + &i.RevocationSequenceID, + ) + return i, err +} + const insertGroupMessage = `-- name: InsertGroupMessage :one INSERT INTO group_messages (group_id, data, group_id_data_hash) VALUES ($1, $2, $3) @@ -462,6 +542,32 @@ func (q *Queries) QueryGroupMessagesWithCursorDesc(ctx context.Context, arg Quer return items, nil } +const revokeAddressFromLog = `-- name: RevokeAddressFromLog :exec +UPDATE address_log +SET revocation_sequence_id = $1 +WHERE (address, inbox_id, association_sequence_id) = ( + SELECT address, + inbox_id, + MAX(association_sequence_id) + FROM address_log AS a + WHERE a.address = $2 + AND a.inbox_id = $3 + GROUP BY address, + inbox_id + ) +` + +type RevokeAddressFromLogParams struct { + RevocationSequenceID sql.NullInt64 + Address string + InboxID string +} + +func (q *Queries) RevokeAddressFromLog(ctx context.Context, arg RevokeAddressFromLogParams) error { + _, err := q.db.ExecContext(ctx, revokeAddressFromLog, arg.RevocationSequenceID, arg.Address, arg.InboxID) + return err +} + const revokeInstallation = `-- name: RevokeInstallation :exec UPDATE installations SET revoked_at = $1 diff --git a/pkg/mls/store/store.go b/pkg/mls/store/store.go index 9e5f6da5..172579fd 100644 --- a/pkg/mls/store/store.go +++ b/pkg/mls/store/store.go @@ -13,6 +13,7 @@ import ( "github.com/uptrace/bun/migrate" migrations "github.com/xmtp/xmtp-node-go/pkg/migrations/mls" queries "github.com/xmtp/xmtp-node-go/pkg/mls/store/queries" + "github.com/xmtp/xmtp-node-go/pkg/mlsvalidate" 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" @@ -30,8 +31,9 @@ type Store struct { } type IdentityStore interface { - PublishIdentityUpdate(ctx context.Context, req *identity.PublishIdentityUpdateRequest) (*identity.PublishIdentityUpdateResponse, error) + PublishIdentityUpdate(ctx context.Context, req *identity.PublishIdentityUpdateRequest, validationService mlsvalidate.MLSValidationService) (*identity.PublishIdentityUpdateResponse, error) GetInboxLogs(ctx context.Context, req *identity.GetIdentityUpdatesRequest) (*identity.GetIdentityUpdatesResponse, error) + GetInboxIds(ctx context.Context, req *identity.GetInboxIdsRequest) (*identity.GetInboxIdsResponse, error) } type MlsStore interface { @@ -67,7 +69,38 @@ 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) { +func (s *Store) GetInboxIds(ctx context.Context, req *identity.GetInboxIdsRequest) (*identity.GetInboxIdsResponse, error) { + + addresses := []string{} + for _, request := range req.Requests { + addresses = append(addresses, request.GetAddress()) + } + + addressLogEntries, err := s.queries.GetAddressLogs(ctx, addresses) + if err != nil { + return nil, err + } + + out := make([]*identity.GetInboxIdsResponse_Response, len(addresses)) + + for index, address := range addresses { + resp := identity.GetInboxIdsResponse_Response{} + resp.Address = address + + for _, log_entry := range addressLogEntries { + if log_entry.Address == address { + resp.InboxId = &log_entry.InboxID + } + } + out[index] = &resp + } + + return &identity.GetInboxIdsResponse{ + Responses: out, + }, nil +} + +func (s *Store) PublishIdentityUpdate(ctx context.Context, req *identity.PublishIdentityUpdateRequest, validationService mlsvalidate.MLSValidationService) (*identity.PublishIdentityUpdateResponse, error) { new_update := req.GetIdentityUpdate() if new_update == nil { return nil, errors.New("IdentityUpdate is required") @@ -93,23 +126,57 @@ func (s *Store) PublishIdentityUpdate(ctx context.Context, req *identity.Publish } _ = append(updates, new_update) - // TODO: Validate the updates, and abort transaction if failed + state, err := validationService.GetAssociationState(ctx, updates, []*associations.IdentityUpdate{new_update}) + if err != nil { + return err + } + s.log.Info("Got association state", zap.Any("state", state)) protoBytes, err := proto.Marshal(new_update) if err != nil { return err } - _, err = txQueries.InsertInboxLog(ctx, queries.InsertInboxLogParams{ + sequence_id, err := txQueries.InsertInboxLog(ctx, queries.InsertInboxLogParams{ InboxID: new_update.GetInboxId(), ServerTimestampNs: nowNs(), IdentityUpdateProto: protoBytes, }) + s.log.Info("Inserted inbox log", zap.Any("sequence_id", sequence_id)) + if err != nil { return err } - // TODO: Insert or update the address_log table using sequence_id + + for _, new_member := range state.StateDiff.NewMembers { + s.log.Info("New member", zap.Any("member", new_member)) + if address, ok := new_member.Kind.(*associations.MemberIdentifier_Address); ok { + _, err = txQueries.InsertAddressLog(ctx, queries.InsertAddressLogParams{ + Address: address.Address, + InboxID: state.AssociationState.InboxId, + AssociationSequenceID: sql.NullInt64{Valid: true, Int64: sequence_id}, + RevocationSequenceID: sql.NullInt64{Valid: false}, + }) + if err != nil { + return err + } + } + } + + for _, removed_member := range state.StateDiff.RemovedMembers { + s.log.Info("New member", zap.Any("member", removed_member)) + if address, ok := removed_member.Kind.(*associations.MemberIdentifier_Address); ok { + err = txQueries.RevokeAddressFromLog(ctx, queries.RevokeAddressFromLogParams{ + Address: address.Address, + InboxID: state.AssociationState.InboxId, + RevocationSequenceID: sql.NullInt64{Valid: true, Int64: sequence_id}, + }) + if err != nil { + return err + } + } + } return nil }); err != nil { diff --git a/pkg/mls/store/store_test.go b/pkg/mls/store/store_test.go index 379584f0..112776b9 100644 --- a/pkg/mls/store/store_test.go +++ b/pkg/mls/store/store_test.go @@ -2,11 +2,14 @@ package store import ( "context" + "database/sql" "sort" "testing" "time" "github.com/stretchr/testify/require" + queries "github.com/xmtp/xmtp-node-go/pkg/mls/store/queries" + identity "github.com/xmtp/xmtp-node-go/pkg/proto/identity/api/v1" mlsv1 "github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1" test "github.com/xmtp/xmtp-node-go/pkg/testing" ) @@ -26,6 +29,46 @@ func NewTestStore(t *testing.T) (*Store, func()) { return store, dbCleanup } +func TestInboxIds(t *testing.T) { + store, cleanup := NewTestStore(t) + defer cleanup() + ctx := context.Background() + + _, err := store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address", InboxID: "inbox1", AssociationSequenceID: sql.NullInt64{Valid: true, Int64: 1}, RevocationSequenceID: sql.NullInt64{Valid: false}}) + require.NoError(t, err) + _, err = store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address", InboxID: "inbox1", AssociationSequenceID: sql.NullInt64{Valid: true, Int64: 2}, RevocationSequenceID: sql.NullInt64{Valid: false}}) + require.NoError(t, err) + _, err = store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address", InboxID: "inbox1", AssociationSequenceID: sql.NullInt64{Valid: true, Int64: 3}, RevocationSequenceID: sql.NullInt64{Valid: false}}) + require.NoError(t, err) + _, err = store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address", InboxID: "correct", AssociationSequenceID: sql.NullInt64{Valid: true, Int64: 4}, RevocationSequenceID: sql.NullInt64{Valid: false}}) + require.NoError(t, err) + + reqs := make([]*identity.GetInboxIdsRequest_Request, 0) + reqs = append(reqs, &identity.GetInboxIdsRequest_Request{ + Address: "address", + }) + req := &identity.GetInboxIdsRequest{ + Requests: reqs, + } + resp, _ := store.GetInboxIds(context.Background(), req) + + require.Equal(t, "correct", *resp.Responses[0].InboxId) + + _, err = store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address", InboxID: "correct_inbox2", AssociationSequenceID: sql.NullInt64{Valid: true, Int64: 5}, RevocationSequenceID: sql.NullInt64{Valid: false}}) + require.NoError(t, err) + resp, _ = store.GetInboxIds(context.Background(), req) + require.Equal(t, "correct_inbox2", *resp.Responses[0].InboxId) + + reqs = append(reqs, &identity.GetInboxIdsRequest_Request{Address: "address2"}) + req = &identity.GetInboxIdsRequest{ + Requests: reqs, + } + _, err = store.queries.InsertAddressLog(ctx, queries.InsertAddressLogParams{Address: "address2", InboxID: "inbox2", AssociationSequenceID: sql.NullInt64{Valid: true, Int64: 8}, RevocationSequenceID: sql.NullInt64{Valid: false}}) + require.NoError(t, err) + resp, _ = store.GetInboxIds(context.Background(), req) + require.Equal(t, "inbox2", *resp.Responses[1].InboxId) +} + func TestCreateInstallation(t *testing.T) { store, cleanup := NewTestStore(t) defer cleanup() From 520f1c10a51b8fc5d06cb79bee6ebe1a79b7bdfd Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 25 Apr 2024 16:37:25 -0700 Subject: [PATCH 6/7] Define SQL formatting (#384) * Define SQL formatting * Define SQL formatting --- .vscode/extensions.json | 9 + .vscode/settings.json | 7 + .../mls/20231023050806_init-schema.down.sql | 4 +- .../mls/20231023050806_init-schema.up.sql | 23 +- .../mls/20240109001927_add-messages.down.sql | 1 - .../mls/20240109001927_add-messages.up.sql | 33 +-- .../mls/20240122230601_add-hpke-key.down.sql | 3 +- .../mls/20240122230601_add-hpke-key.up.sql | 3 +- .../mls/20240411200242_init-identity.down.sql | 3 +- .../mls/20240411200242_init-identity.up.sql | 23 +- .../20240425021053_add-inbox-filters.down.sql | 2 +- .../20240425021053_add-inbox-filters.up.sql | 6 +- pkg/mls/store/queries.sql | 257 ++++++++++-------- pkg/mls/store/queries/queries.sql.go | 254 +++++++++-------- 14 files changed, 348 insertions(+), 280 deletions(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..a72345bb --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + + // List of extensions which should be recommended for users of this workspace. + "recommendations": ["bradymholt.pgformatter", "golang.go"], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..f11a28f2 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "pgFormatter.typeCase": "uppercase", + "pgFormatter.tabs": true, + "[sql]": { + "editor.defaultFormatter": "bradymholt.pgformatter" + } +} diff --git a/pkg/migrations/mls/20231023050806_init-schema.down.sql b/pkg/migrations/mls/20231023050806_init-schema.down.sql index bcbc86f0..77c9a8e7 100644 --- a/pkg/migrations/mls/20231023050806_init-schema.down.sql +++ b/pkg/migrations/mls/20231023050806_init-schema.down.sql @@ -1,5 +1,5 @@ -SET - statement_timeout = 0; +SET statement_timeout = 0; --bun:split DROP TABLE IF EXISTS installations; + diff --git a/pkg/migrations/mls/20231023050806_init-schema.up.sql b/pkg/migrations/mls/20231023050806_init-schema.up.sql index a0ebe97c..b57561fc 100644 --- a/pkg/migrations/mls/20231023050806_init-schema.up.sql +++ b/pkg/migrations/mls/20231023050806_init-schema.up.sql @@ -1,17 +1,15 @@ -SET - statement_timeout = 0; +SET statement_timeout = 0; --bun:split -CREATE TABLE installations ( - id BYTEA PRIMARY KEY, - wallet_address TEXT NOT NULL, - created_at BIGINT NOT NULL, - updated_at BIGINT NOT NULL, - credential_identity BYTEA NOT NULL, - revoked_at BIGINT, - - key_package BYTEA NOT NULL, - expiration BIGINT NOT NULL +CREATE TABLE installations( + id BYTEA PRIMARY KEY, + wallet_address TEXT NOT NULL, + created_at BIGINT NOT NULL, + updated_at BIGINT NOT NULL, + credential_identity BYTEA NOT NULL, + revoked_at BIGINT, + key_package BYTEA NOT NULL, + expiration BIGINT NOT NULL ); --bun:split @@ -22,3 +20,4 @@ CREATE INDEX idx_installations_created_at ON installations(created_at); --bun:split CREATE INDEX idx_installations_revoked_at ON installations(revoked_at); + diff --git a/pkg/migrations/mls/20240109001927_add-messages.down.sql b/pkg/migrations/mls/20240109001927_add-messages.down.sql index a64da5e3..3c0d999e 100644 --- a/pkg/migrations/mls/20240109001927_add-messages.down.sql +++ b/pkg/migrations/mls/20240109001927_add-messages.down.sql @@ -1,6 +1,5 @@ SET statement_timeout = 0; --bun:split - DROP TABLE IF EXISTS messages; diff --git a/pkg/migrations/mls/20240109001927_add-messages.up.sql b/pkg/migrations/mls/20240109001927_add-messages.up.sql index 6e71eb8b..aa76a2be 100644 --- a/pkg/migrations/mls/20240109001927_add-messages.up.sql +++ b/pkg/migrations/mls/20240109001927_add-messages.up.sql @@ -1,37 +1,32 @@ SET statement_timeout = 0; --bun:split - -CREATE TABLE group_messages ( - id BIGSERIAL PRIMARY KEY, - created_at TIMESTAMP NOT NULL DEFAULT NOW(), - group_id BYTEA NOT NULL, - data BYTEA NOT NULL, - group_id_data_hash BYTEA NOT NULL +CREATE TABLE group_messages( + id BIGSERIAL PRIMARY KEY, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + group_id BYTEA NOT NULL, + data BYTEA NOT NULL, + group_id_data_hash BYTEA NOT NULL ); --bun:split - CREATE INDEX idx_group_messages_group_id_created_at ON group_messages(group_id, created_at); --bun:split - -CREATE UNIQUE INDEX idx_group_messages_group_id_data_hash ON group_messages (group_id_data_hash); +CREATE UNIQUE INDEX idx_group_messages_group_id_data_hash ON group_messages(group_id_data_hash); --bun:split - -CREATE TABLE welcome_messages ( - id BIGSERIAL PRIMARY KEY, - created_at TIMESTAMP NOT NULL DEFAULT NOW(), - installation_key BYTEA NOT NULL, - data BYTEA NOT NULL, - installation_key_data_hash BYTEA NOT NULL +CREATE TABLE welcome_messages( + id BIGSERIAL PRIMARY KEY, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + installation_key BYTEA NOT NULL, + data BYTEA NOT NULL, + installation_key_data_hash BYTEA NOT NULL ); --bun:split - CREATE INDEX idx_welcome_messages_installation_key_created_at ON welcome_messages(installation_key, created_at); --bun:split +CREATE UNIQUE INDEX idx_welcome_messages_group_key_data_hash ON welcome_messages(installation_key_data_hash); -CREATE UNIQUE INDEX idx_welcome_messages_group_key_data_hash ON welcome_messages (installation_key_data_hash); diff --git a/pkg/migrations/mls/20240122230601_add-hpke-key.down.sql b/pkg/migrations/mls/20240122230601_add-hpke-key.down.sql index e418afea..b51fe300 100644 --- a/pkg/migrations/mls/20240122230601_add-hpke-key.down.sql +++ b/pkg/migrations/mls/20240122230601_add-hpke-key.down.sql @@ -1,4 +1,5 @@ SET statement_timeout = 0; ALTER TABLE welcome_messages -DROP COLUMN IF EXISTS hpke_public_key BYTEA; + DROP COLUMN IF EXISTS hpke_public_key BYTEA; + diff --git a/pkg/migrations/mls/20240122230601_add-hpke-key.up.sql b/pkg/migrations/mls/20240122230601_add-hpke-key.up.sql index 0d3bc54b..f38bf60d 100644 --- a/pkg/migrations/mls/20240122230601_add-hpke-key.up.sql +++ b/pkg/migrations/mls/20240122230601_add-hpke-key.up.sql @@ -1,4 +1,5 @@ SET statement_timeout = 0; ALTER TABLE welcome_messages -ADD COLUMN hpke_public_key BYTEA; + ADD COLUMN hpke_public_key BYTEA; + diff --git a/pkg/migrations/mls/20240411200242_init-identity.down.sql b/pkg/migrations/mls/20240411200242_init-identity.down.sql index 6189ef52..29753e66 100644 --- a/pkg/migrations/mls/20240411200242_init-identity.down.sql +++ b/pkg/migrations/mls/20240411200242_init-identity.down.sql @@ -1,9 +1,8 @@ SET statement_timeout = 0; --bun:split - DROP TABLE IF EXISTS inbox_log; --bun:split - DROP TABLE IF EXISTS address_log; + diff --git a/pkg/migrations/mls/20240411200242_init-identity.up.sql b/pkg/migrations/mls/20240411200242_init-identity.up.sql index d3399c0b..cb42e660 100644 --- a/pkg/migrations/mls/20240411200242_init-identity.up.sql +++ b/pkg/migrations/mls/20240411200242_init-identity.up.sql @@ -1,23 +1,24 @@ SET statement_timeout = 0; --bun:split -CREATE TABLE inbox_log ( - sequence_id BIGSERIAL PRIMARY KEY, - inbox_id TEXT NOT NULL, - server_timestamp_ns BIGINT NOT NULL, - identity_update_proto BYTEA NOT NULL +CREATE TABLE inbox_log( + sequence_id BIGSERIAL PRIMARY KEY, + inbox_id TEXT NOT NULL, + server_timestamp_ns BIGINT NOT NULL, + identity_update_proto BYTEA NOT NULL ); --bun:split CREATE INDEX idx_inbox_log_inbox_id ON inbox_log(inbox_id); --bun:split -CREATE TABLE address_log ( - address TEXT NOT NULL, - inbox_id TEXT NOT NULL, - association_sequence_id BIGINT, - revocation_sequence_id BIGINT +CREATE TABLE address_log( + address TEXT NOT NULL, + inbox_id TEXT NOT NULL, + association_sequence_id BIGINT, + revocation_sequence_id BIGINT ); --bun:split -CREATE INDEX idx_address_log_address_inbox_id ON address_log(address, inbox_id); \ No newline at end of file +CREATE INDEX idx_address_log_address_inbox_id ON address_log(address, inbox_id); + diff --git a/pkg/migrations/mls/20240425021053_add-inbox-filters.down.sql b/pkg/migrations/mls/20240425021053_add-inbox-filters.down.sql index f5b5f1c0..6a628122 100644 --- a/pkg/migrations/mls/20240425021053_add-inbox-filters.down.sql +++ b/pkg/migrations/mls/20240425021053_add-inbox-filters.down.sql @@ -1,5 +1,5 @@ SET statement_timeout = 0; --bun:split +DROP TYPE IF EXISTS inbox_filter; -DROP TYPE IF EXISTS inbox_filter; \ No newline at end of file diff --git a/pkg/migrations/mls/20240425021053_add-inbox-filters.up.sql b/pkg/migrations/mls/20240425021053_add-inbox-filters.up.sql index edd4b911..bee29307 100644 --- a/pkg/migrations/mls/20240425021053_add-inbox-filters.up.sql +++ b/pkg/migrations/mls/20240425021053_add-inbox-filters.up.sql @@ -1,8 +1,8 @@ SET statement_timeout = 0; --bun:split - CREATE TYPE inbox_filter AS ( - inbox_id TEXT, - sequence_id BIGINT + inbox_id TEXT, + sequence_id BIGINT ); + diff --git a/pkg/mls/store/queries.sql b/pkg/mls/store/queries.sql index a63937ce..d18f4f8e 100644 --- a/pkg/mls/store/queries.sql +++ b/pkg/mls/store/queries.sql @@ -1,150 +1,179 @@ -- name: GetAllInboxLogs :many -SELECT * -FROM inbox_log -WHERE inbox_id = $1 -ORDER BY sequence_id ASC FOR -UPDATE; +SELECT + * +FROM + inbox_log +WHERE + inbox_id = $1 +ORDER BY + sequence_id ASC +FOR UPDATE; -- name: GetInboxLogFiltered :many -SELECT a.* -FROM inbox_log AS a - JOIN ( - SELECT * - FROM json_populate_recordset(null::inbox_filter, sqlc.arg(filters)) as b(inbox_id, sequence_id) - ) as b on b.inbox_id = a.inbox_id - AND a.sequence_id > b.sequence_id -ORDER BY a.sequence_id ASC; +SELECT + a.* +FROM + inbox_log AS a + JOIN ( + SELECT + * + FROM + json_populate_recordset(NULL::inbox_filter, sqlc.arg(filters)) AS b(inbox_id, + sequence_id)) AS b ON b.inbox_id = a.inbox_id + AND a.sequence_id > b.sequence_id + ORDER BY + a.sequence_id ASC; -- name: GetAddressLogs :many -SELECT a.address, - a.inbox_id, - a.association_sequence_id -FROM address_log a - INNER JOIN ( - SELECT address, - MAX(association_sequence_id) AS max_association_sequence_id - FROM address_log - WHERE address = ANY (@addresses::text []) - AND revocation_sequence_id IS NULL - GROUP BY address - ) b ON a.address = b.address - AND a.association_sequence_id = b.max_association_sequence_id; +SELECT + a.address, + a.inbox_id, + a.association_sequence_id +FROM + address_log a + INNER JOIN ( + SELECT + address, + MAX(association_sequence_id) AS max_association_sequence_id + FROM + address_log + WHERE + address = ANY (@addresses::TEXT[]) + AND revocation_sequence_id IS NULL + GROUP BY + address) b ON a.address = b.address + AND a.association_sequence_id = b.max_association_sequence_id; -- name: InsertAddressLog :one -INSERT INTO address_log ( - address, - inbox_id, - association_sequence_id, - revocation_sequence_id - ) -VALUES ($1, $2, $3, $4) -RETURNING *; +INSERT INTO address_log(address, inbox_id, association_sequence_id, revocation_sequence_id) + VALUES ($1, $2, $3, $4) +RETURNING + *; -- name: InsertInboxLog :one -INSERT INTO inbox_log ( - inbox_id, - server_timestamp_ns, - identity_update_proto - ) -VALUES ($1, $2, $3) -RETURNING sequence_id; +INSERT INTO inbox_log(inbox_id, server_timestamp_ns, identity_update_proto) + VALUES ($1, $2, $3) +RETURNING + sequence_id; -- name: RevokeAddressFromLog :exec -UPDATE address_log -SET revocation_sequence_id = $1 -WHERE (address, inbox_id, association_sequence_id) = ( - SELECT address, - inbox_id, - MAX(association_sequence_id) - FROM address_log AS a - WHERE a.address = $2 - AND a.inbox_id = $3 - GROUP BY address, - inbox_id - ); +UPDATE + address_log +SET + revocation_sequence_id = $1 +WHERE (address, inbox_id, association_sequence_id) =( + SELECT + address, + inbox_id, + MAX(association_sequence_id) + FROM + address_log AS a + WHERE + a.address = $2 + AND a.inbox_id = $3 + GROUP BY + address, + inbox_id); -- name: CreateInstallation :exec -INSERT INTO installations ( - id, - wallet_address, - created_at, - updated_at, - credential_identity, - key_package, - expiration - ) -VALUES ($1, $2, $3, $3, $4, $5, $6); +INSERT INTO installations(id, wallet_address, created_at, updated_at, credential_identity, key_package, expiration) + VALUES ($1, $2, $3, $3, $4, $5, $6); -- name: UpdateKeyPackage :execrows -UPDATE installations -SET key_package = @key_package, - updated_at = @updated_at, - expiration = @expiration -WHERE id = @id; +UPDATE + installations +SET + key_package = @key_package, + updated_at = @updated_at, + expiration = @expiration +WHERE + id = @id; -- name: FetchKeyPackages :many -SELECT id, - key_package -FROM installations -WHERE id = ANY (sqlc.arg(installation_ids)::bytea []); +SELECT + id, + key_package +FROM + installations +WHERE + id = ANY (sqlc.arg(installation_ids)::BYTEA[]); -- name: GetIdentityUpdates :many -SELECT * -FROM installations -WHERE wallet_address = ANY (@wallet_addresses::text []) - AND ( - created_at > @start_time - OR revoked_at > @start_time - ) -ORDER BY created_at ASC; +SELECT + * +FROM + installations +WHERE + wallet_address = ANY (@wallet_addresses::TEXT[]) + AND (created_at > @start_time + OR revoked_at > @start_time) +ORDER BY + created_at ASC; -- name: RevokeInstallation :exec -UPDATE installations -SET revoked_at = @revoked_at -WHERE id = @installation_id - AND revoked_at IS NULL; +UPDATE + installations +SET + revoked_at = @revoked_at +WHERE + id = @installation_id + AND revoked_at IS NULL; -- name: InsertGroupMessage :one -INSERT INTO group_messages (group_id, data, group_id_data_hash) -VALUES ($1, $2, $3) -RETURNING *; +INSERT INTO group_messages(group_id, data, group_id_data_hash) + VALUES ($1, $2, $3) +RETURNING + *; -- name: InsertWelcomeMessage :one -INSERT INTO welcome_messages ( - installation_key, - data, - installation_key_data_hash, - hpke_public_key - ) -VALUES ($1, $2, $3, $4) -RETURNING *; +INSERT INTO welcome_messages(installation_key, data, installation_key_data_hash, hpke_public_key) + VALUES ($1, $2, $3, $4) +RETURNING + *; -- name: QueryGroupMessagesAsc :many -SELECT * -FROM group_messages -WHERE group_id = @group_id -ORDER BY id ASC +SELECT + * +FROM + group_messages +WHERE + group_id = @group_id +ORDER BY + id ASC LIMIT @numrows; -- name: QueryGroupMessagesDesc :many -SELECT * -FROM group_messages -WHERE group_id = @group_id -ORDER BY id DESC +SELECT + * +FROM + group_messages +WHERE + group_id = @group_id +ORDER BY + id DESC LIMIT @numrows; -- name: QueryGroupMessagesWithCursorAsc :many -SELECT * -FROM group_messages -WHERE group_id = $1 - AND id > $2 -ORDER BY id ASC +SELECT + * +FROM + group_messages +WHERE + group_id = $1 + AND id > $2 +ORDER BY + id ASC LIMIT $3; -- name: QueryGroupMessagesWithCursorDesc :many -SELECT * -FROM group_messages -WHERE group_id = $1 - AND id < $2 -ORDER BY id DESC -LIMIT $3; \ No newline at end of file +SELECT + * +FROM + group_messages +WHERE + group_id = $1 + AND id < $2 +ORDER BY + id DESC +LIMIT $3; + diff --git a/pkg/mls/store/queries/queries.sql.go b/pkg/mls/store/queries/queries.sql.go index db14c010..f7e3311e 100644 --- a/pkg/mls/store/queries/queries.sql.go +++ b/pkg/mls/store/queries/queries.sql.go @@ -14,16 +14,8 @@ import ( ) const createInstallation = `-- name: CreateInstallation :exec -INSERT INTO installations ( - id, - wallet_address, - created_at, - updated_at, - credential_identity, - key_package, - expiration - ) -VALUES ($1, $2, $3, $3, $4, $5, $6) +INSERT INTO installations(id, wallet_address, created_at, updated_at, credential_identity, key_package, expiration) + VALUES ($1, $2, $3, $3, $4, $5, $6) ` type CreateInstallationParams struct { @@ -48,10 +40,13 @@ func (q *Queries) CreateInstallation(ctx context.Context, arg CreateInstallation } const fetchKeyPackages = `-- name: FetchKeyPackages :many -SELECT id, - key_package -FROM installations -WHERE id = ANY ($1::bytea []) +SELECT + id, + key_package +FROM + installations +WHERE + id = ANY ($1::BYTEA[]) ` type FetchKeyPackagesRow struct { @@ -83,19 +78,24 @@ func (q *Queries) FetchKeyPackages(ctx context.Context, installationIds [][]byte } const getAddressLogs = `-- name: GetAddressLogs :many -SELECT a.address, - a.inbox_id, - a.association_sequence_id -FROM address_log a - INNER JOIN ( - SELECT address, - MAX(association_sequence_id) AS max_association_sequence_id - FROM address_log - WHERE address = ANY ($1::text []) - AND revocation_sequence_id IS NULL - GROUP BY address - ) b ON a.address = b.address - AND a.association_sequence_id = b.max_association_sequence_id +SELECT + a.address, + a.inbox_id, + a.association_sequence_id +FROM + address_log a + INNER JOIN ( + SELECT + address, + MAX(association_sequence_id) AS max_association_sequence_id + FROM + address_log + WHERE + address = ANY ($1::TEXT[]) + AND revocation_sequence_id IS NULL + GROUP BY + address) b ON a.address = b.address + AND a.association_sequence_id = b.max_association_sequence_id ` type GetAddressLogsRow struct { @@ -128,11 +128,15 @@ func (q *Queries) GetAddressLogs(ctx context.Context, addresses []string) ([]Get } const getAllInboxLogs = `-- name: GetAllInboxLogs :many -SELECT sequence_id, inbox_id, server_timestamp_ns, identity_update_proto -FROM inbox_log -WHERE inbox_id = $1 -ORDER BY sequence_id ASC FOR -UPDATE +SELECT + sequence_id, inbox_id, server_timestamp_ns, identity_update_proto +FROM + inbox_log +WHERE + inbox_id = $1 +ORDER BY + sequence_id ASC +FOR UPDATE ` func (q *Queries) GetAllInboxLogs(ctx context.Context, inboxID string) ([]InboxLog, error) { @@ -164,14 +168,16 @@ func (q *Queries) GetAllInboxLogs(ctx context.Context, inboxID string) ([]InboxL } const getIdentityUpdates = `-- name: GetIdentityUpdates :many -SELECT id, wallet_address, created_at, updated_at, credential_identity, revoked_at, key_package, expiration -FROM installations -WHERE wallet_address = ANY ($1::text []) - AND ( - created_at > $2 - OR revoked_at > $2 - ) -ORDER BY created_at ASC +SELECT + id, wallet_address, created_at, updated_at, credential_identity, revoked_at, key_package, expiration +FROM + installations +WHERE + wallet_address = ANY ($1::TEXT[]) + AND (created_at > $2 + OR revoked_at > $2) +ORDER BY + created_at ASC ` type GetIdentityUpdatesParams struct { @@ -212,14 +218,19 @@ func (q *Queries) GetIdentityUpdates(ctx context.Context, arg GetIdentityUpdates } const getInboxLogFiltered = `-- name: GetInboxLogFiltered :many -SELECT a.sequence_id, a.inbox_id, a.server_timestamp_ns, a.identity_update_proto -FROM inbox_log AS a - JOIN ( - SELECT inbox_id, sequence_id - FROM json_populate_recordset(null::inbox_filter, $1) as b(inbox_id, sequence_id) - ) as b on b.inbox_id = a.inbox_id - AND a.sequence_id > b.sequence_id -ORDER BY a.sequence_id ASC +SELECT + a.sequence_id, a.inbox_id, a.server_timestamp_ns, a.identity_update_proto +FROM + inbox_log AS a + JOIN ( + SELECT + inbox_id, sequence_id + FROM + json_populate_recordset(NULL::inbox_filter, $1) AS b(inbox_id, + sequence_id)) AS b ON b.inbox_id = a.inbox_id + AND a.sequence_id > b.sequence_id + ORDER BY + a.sequence_id ASC ` func (q *Queries) GetInboxLogFiltered(ctx context.Context, filters json.RawMessage) ([]InboxLog, error) { @@ -251,14 +262,10 @@ func (q *Queries) GetInboxLogFiltered(ctx context.Context, filters json.RawMessa } const insertAddressLog = `-- name: InsertAddressLog :one -INSERT INTO address_log ( - address, - inbox_id, - association_sequence_id, - revocation_sequence_id - ) -VALUES ($1, $2, $3, $4) -RETURNING address, inbox_id, association_sequence_id, revocation_sequence_id +INSERT INTO address_log(address, inbox_id, association_sequence_id, revocation_sequence_id) + VALUES ($1, $2, $3, $4) +RETURNING + address, inbox_id, association_sequence_id, revocation_sequence_id ` type InsertAddressLogParams struct { @@ -286,9 +293,10 @@ func (q *Queries) InsertAddressLog(ctx context.Context, arg InsertAddressLogPara } const insertGroupMessage = `-- name: InsertGroupMessage :one -INSERT INTO group_messages (group_id, data, group_id_data_hash) -VALUES ($1, $2, $3) -RETURNING id, created_at, group_id, data, group_id_data_hash +INSERT INTO group_messages(group_id, data, group_id_data_hash) + VALUES ($1, $2, $3) +RETURNING + id, created_at, group_id, data, group_id_data_hash ` type InsertGroupMessageParams struct { @@ -311,13 +319,10 @@ func (q *Queries) InsertGroupMessage(ctx context.Context, arg InsertGroupMessage } const insertInboxLog = `-- name: InsertInboxLog :one -INSERT INTO inbox_log ( - inbox_id, - server_timestamp_ns, - identity_update_proto - ) -VALUES ($1, $2, $3) -RETURNING sequence_id +INSERT INTO inbox_log(inbox_id, server_timestamp_ns, identity_update_proto) + VALUES ($1, $2, $3) +RETURNING + sequence_id ` type InsertInboxLogParams struct { @@ -334,14 +339,10 @@ func (q *Queries) InsertInboxLog(ctx context.Context, arg InsertInboxLogParams) } const insertWelcomeMessage = `-- name: InsertWelcomeMessage :one -INSERT INTO welcome_messages ( - installation_key, - data, - installation_key_data_hash, - hpke_public_key - ) -VALUES ($1, $2, $3, $4) -RETURNING id, created_at, installation_key, data, installation_key_data_hash, hpke_public_key +INSERT INTO welcome_messages(installation_key, data, installation_key_data_hash, hpke_public_key) + VALUES ($1, $2, $3, $4) +RETURNING + id, created_at, installation_key, data, installation_key_data_hash, hpke_public_key ` type InsertWelcomeMessageParams struct { @@ -371,10 +372,14 @@ func (q *Queries) InsertWelcomeMessage(ctx context.Context, arg InsertWelcomeMes } const queryGroupMessagesAsc = `-- name: QueryGroupMessagesAsc :many -SELECT id, created_at, group_id, data, group_id_data_hash -FROM group_messages -WHERE group_id = $1 -ORDER BY id ASC +SELECT + id, created_at, group_id, data, group_id_data_hash +FROM + group_messages +WHERE + group_id = $1 +ORDER BY + id ASC LIMIT $2 ` @@ -413,10 +418,14 @@ func (q *Queries) QueryGroupMessagesAsc(ctx context.Context, arg QueryGroupMessa } const queryGroupMessagesDesc = `-- name: QueryGroupMessagesDesc :many -SELECT id, created_at, group_id, data, group_id_data_hash -FROM group_messages -WHERE group_id = $1 -ORDER BY id DESC +SELECT + id, created_at, group_id, data, group_id_data_hash +FROM + group_messages +WHERE + group_id = $1 +ORDER BY + id DESC LIMIT $2 ` @@ -455,11 +464,15 @@ func (q *Queries) QueryGroupMessagesDesc(ctx context.Context, arg QueryGroupMess } const queryGroupMessagesWithCursorAsc = `-- name: QueryGroupMessagesWithCursorAsc :many -SELECT id, created_at, group_id, data, group_id_data_hash -FROM group_messages -WHERE group_id = $1 - AND id > $2 -ORDER BY id ASC +SELECT + id, created_at, group_id, data, group_id_data_hash +FROM + group_messages +WHERE + group_id = $1 + AND id > $2 +ORDER BY + id ASC LIMIT $3 ` @@ -499,11 +512,15 @@ func (q *Queries) QueryGroupMessagesWithCursorAsc(ctx context.Context, arg Query } const queryGroupMessagesWithCursorDesc = `-- name: QueryGroupMessagesWithCursorDesc :many -SELECT id, created_at, group_id, data, group_id_data_hash -FROM group_messages -WHERE group_id = $1 - AND id < $2 -ORDER BY id DESC +SELECT + id, created_at, group_id, data, group_id_data_hash +FROM + group_messages +WHERE + group_id = $1 + AND id < $2 +ORDER BY + id DESC LIMIT $3 ` @@ -543,18 +560,23 @@ func (q *Queries) QueryGroupMessagesWithCursorDesc(ctx context.Context, arg Quer } const revokeAddressFromLog = `-- name: RevokeAddressFromLog :exec -UPDATE address_log -SET revocation_sequence_id = $1 -WHERE (address, inbox_id, association_sequence_id) = ( - SELECT address, - inbox_id, - MAX(association_sequence_id) - FROM address_log AS a - WHERE a.address = $2 - AND a.inbox_id = $3 - GROUP BY address, - inbox_id - ) +UPDATE + address_log +SET + revocation_sequence_id = $1 +WHERE (address, inbox_id, association_sequence_id) =( + SELECT + address, + inbox_id, + MAX(association_sequence_id) + FROM + address_log AS a + WHERE + a.address = $2 + AND a.inbox_id = $3 + GROUP BY + address, + inbox_id) ` type RevokeAddressFromLogParams struct { @@ -569,10 +591,13 @@ func (q *Queries) RevokeAddressFromLog(ctx context.Context, arg RevokeAddressFro } const revokeInstallation = `-- name: RevokeInstallation :exec -UPDATE installations -SET revoked_at = $1 -WHERE id = $2 - AND revoked_at IS NULL +UPDATE + installations +SET + revoked_at = $1 +WHERE + id = $2 + AND revoked_at IS NULL ` type RevokeInstallationParams struct { @@ -586,11 +611,14 @@ func (q *Queries) RevokeInstallation(ctx context.Context, arg RevokeInstallation } const updateKeyPackage = `-- name: UpdateKeyPackage :execrows -UPDATE installations -SET key_package = $1, - updated_at = $2, - expiration = $3 -WHERE id = $4 +UPDATE + installations +SET + key_package = $1, + updated_at = $2, + expiration = $3 +WHERE + id = $4 ` type UpdateKeyPackageParams struct { From ff22ba53f3c52ce7d5a36b54baed22e1fa8c2617 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Fri, 26 Apr 2024 15:43:18 -0700 Subject: [PATCH 7/7] Continue sqlc migration (#385) --- pkg/metrics/mls.go | 6 +- pkg/mls/api/v1/service.go | 6 +- pkg/mls/api/v1/service_test.go | 11 +- pkg/mls/store/models.go | 58 ------ pkg/mls/store/queries.sql | 86 ++++++-- pkg/mls/store/queries/queries.sql.go | 285 +++++++++++++++++++++++---- pkg/mls/store/store.go | 187 ++++++++++-------- pkg/mls/store/store_test.go | 44 ++--- pkg/server/pgxdb.go | 3 +- 9 files changed, 455 insertions(+), 231 deletions(-) delete mode 100644 pkg/mls/store/models.go diff --git a/pkg/metrics/mls.go b/pkg/metrics/mls.go index 82acbbf2..fe27690a 100644 --- a/pkg/metrics/mls.go +++ b/pkg/metrics/mls.go @@ -4,7 +4,7 @@ import ( "context" "github.com/prometheus/client_golang/prometheus" - mlsstore "github.com/xmtp/xmtp-node-go/pkg/mls/store" + "github.com/xmtp/xmtp-node-go/pkg/mls/store/queries" "go.uber.org/zap" ) @@ -25,7 +25,7 @@ var mlsSentGroupMessageCount = prometheus.NewCounterVec( appClientVersionTagKeys, ) -func EmitMLSSentGroupMessage(ctx context.Context, log *zap.Logger, msg *mlsstore.GroupMessage) { +func EmitMLSSentGroupMessage(ctx context.Context, log *zap.Logger, msg *queries.GroupMessage) { labels := contextLabels(ctx) mlsSentGroupMessageSize.With(labels).Observe(float64(len(msg.Data))) mlsSentGroupMessageCount.With(labels).Inc() @@ -48,7 +48,7 @@ var mlsSentWelcomeMessageCount = prometheus.NewCounterVec( appClientVersionTagKeys, ) -func EmitMLSSentWelcomeMessage(ctx context.Context, log *zap.Logger, msg *mlsstore.WelcomeMessage) { +func EmitMLSSentWelcomeMessage(ctx context.Context, log *zap.Logger, msg *queries.WelcomeMessage) { labels := contextLabels(ctx) mlsSentWelcomeMessageSize.With(labels).Observe(float64(len(msg.Data))) mlsSentWelcomeMessageCount.With(labels).Inc() diff --git a/pkg/mls/api/v1/service.go b/pkg/mls/api/v1/service.go index 3d79c522..44d13d08 100644 --- a/pkg/mls/api/v1/service.go +++ b/pkg/mls/api/v1/service.go @@ -262,9 +262,9 @@ func (s *Service) SendGroupMessages(ctx context.Context, req *mlsv1.SendGroupMes msgB, err := pb.Marshal(&mlsv1.GroupMessage{ Version: &mlsv1.GroupMessage_V1_{ V1: &mlsv1.GroupMessage_V1{ - Id: msg.Id, + Id: uint64(msg.ID), CreatedNs: uint64(msg.CreatedAt.UnixNano()), - GroupId: msg.GroupId, + GroupId: msg.GroupID, Data: msg.Data, }, }, @@ -312,7 +312,7 @@ func (s *Service) SendWelcomeMessages(ctx context.Context, req *mlsv1.SendWelcom msgB, err := pb.Marshal(&mlsv1.WelcomeMessage{ Version: &mlsv1.WelcomeMessage_V1_{ V1: &mlsv1.WelcomeMessage_V1{ - Id: msg.Id, + Id: uint64(msg.ID), CreatedNs: uint64(msg.CreatedAt.UnixNano()), InstallationKey: msg.InstallationKey, Data: msg.Data, diff --git a/pkg/mls/api/v1/service_test.go b/pkg/mls/api/v1/service_test.go index fc002047..bb02ee88 100644 --- a/pkg/mls/api/v1/service_test.go +++ b/pkg/mls/api/v1/service_test.go @@ -14,6 +14,7 @@ import ( "github.com/uptrace/bun" wakupb "github.com/waku-org/go-waku/waku/v2/protocol/pb" mlsstore "github.com/xmtp/xmtp-node-go/pkg/mls/store" + "github.com/xmtp/xmtp-node-go/pkg/mls/store/queries" "github.com/xmtp/xmtp-node-go/pkg/mlsvalidate" "github.com/xmtp/xmtp-node-go/pkg/proto/identity/associations" mlsv1 "github.com/xmtp/xmtp-node-go/pkg/proto/mls/api/v1" @@ -120,12 +121,10 @@ func TestRegisterInstallation(t *testing.T) { require.NoError(t, err) require.Equal(t, installationId, res.InstallationKey) - installations := []mlsstore.Installation{} - err = mlsDb.NewSelect().Model(&installations).Where("id = ?", installationId).Scan(ctx) + installation, err := queries.New(mlsDb.DB).GetInstallation(ctx, installationId) require.NoError(t, err) - require.Len(t, installations, 1) - require.Equal(t, accountAddress, installations[0].WalletAddress) + require.Equal(t, accountAddress, installation.WalletAddress) } func TestRegisterInstallationError(t *testing.T) { @@ -170,9 +169,9 @@ func TestUploadKeyPackage(t *testing.T) { require.NoError(t, err) require.NotNil(t, uploadRes) - installation := &mlsstore.Installation{} - err = mlsDb.NewSelect().Model(installation).Where("id = ?", installationId).Scan(ctx) + installation, err := queries.New(mlsDb.DB).GetInstallation(ctx, installationId) require.NoError(t, err) + require.Equal(t, accountAddress, installation.WalletAddress) } func TestFetchKeyPackages(t *testing.T) { diff --git a/pkg/mls/store/models.go b/pkg/mls/store/models.go deleted file mode 100644 index 47d7145b..00000000 --- a/pkg/mls/store/models.go +++ /dev/null @@ -1,58 +0,0 @@ -package store - -import ( - "time" - - "github.com/uptrace/bun" -) - -type AddressLogEntry struct { - bun.BaseModel `bun:"table:address_log"` - - Address string `bun:",notnull"` - InboxId string `bun:",notnull"` - AssociationSequenceId *uint64 `bun:","` - RevocationSequenceId *uint64 `bun:","` -} - -type InboxLogEntry struct { - bun.BaseModel `bun:"table:inbox_log"` - - SequenceId uint64 `bun:",autoincrement"` - InboxId string - ServerTimestampNs int64 - IdentityUpdateProto []byte -} - -type Installation struct { - bun.BaseModel `bun:"table:installations"` - - ID []byte `bun:",pk,type:bytea"` - WalletAddress string `bun:"wallet_address,notnull"` - CreatedAt int64 `bun:"created_at,notnull"` - UpdatedAt int64 `bun:"updated_at,notnull"` - RevokedAt *int64 `bun:"revoked_at"` - CredentialIdentity []byte `bun:"credential_identity,notnull,type:bytea"` - - KeyPackage []byte `bun:"key_package,notnull,type:bytea"` - Expiration uint64 `bun:"expiration,notnull"` -} - -type GroupMessage struct { - bun.BaseModel `bun:"table:group_messages"` - - Id uint64 `bun:",pk,notnull"` - CreatedAt time.Time `bun:",notnull"` - GroupId []byte `bun:",notnull,type:bytea"` - Data []byte `bun:",notnull,type:bytea"` -} - -type WelcomeMessage struct { - bun.BaseModel `bun:"table:welcome_messages"` - - Id uint64 `bun:",pk,notnull"` - CreatedAt time.Time `bun:",notnull"` - InstallationKey []byte `bun:",notnull,type:bytea"` - Data []byte `bun:",notnull,type:bytea"` - HpkePublicKey []byte `bun:"hpke_public_key,notnull,type:bytea"` -} diff --git a/pkg/mls/store/queries.sql b/pkg/mls/store/queries.sql index d18f4f8e..29ad2e84 100644 --- a/pkg/mls/store/queries.sql +++ b/pkg/mls/store/queries.sql @@ -18,7 +18,7 @@ FROM SELECT * FROM - json_populate_recordset(NULL::inbox_filter, sqlc.arg(filters)) AS b(inbox_id, + json_populate_recordset(NULL::inbox_filter, @filters) AS b(inbox_id, sequence_id)) AS b ON b.inbox_id = a.inbox_id AND a.sequence_id > b.sequence_id ORDER BY @@ -79,6 +79,14 @@ WHERE (address, inbox_id, association_sequence_id) =( INSERT INTO installations(id, wallet_address, created_at, updated_at, credential_identity, key_package, expiration) VALUES ($1, $2, $3, $3, $4, $5, $6); +-- name: GetInstallation :one +SELECT + * +FROM + installations +WHERE + id = $1; + -- name: UpdateKeyPackage :execrows UPDATE installations @@ -96,7 +104,7 @@ SELECT FROM installations WHERE - id = ANY (sqlc.arg(installation_ids)::BYTEA[]); + id = ANY (@installation_ids::BYTEA[]); -- name: GetIdentityUpdates :many SELECT @@ -131,49 +139,99 @@ INSERT INTO welcome_messages(installation_key, data, installation_key_data_hash, RETURNING *; --- name: QueryGroupMessagesAsc :many +-- name: GetAllGroupMessages :many +SELECT + * +FROM + group_messages +ORDER BY + id ASC; + +-- name: QueryGroupMessages :many SELECT * FROM group_messages WHERE group_id = @group_id +ORDER BY + CASE WHEN @sort_desc::BOOL THEN + id + END DESC, + CASE WHEN @sort_desc::BOOL = FALSE THEN + id + END ASC +LIMIT @numrows; + +-- name: QueryGroupMessagesWithCursorAsc :many +SELECT + * +FROM + group_messages +WHERE + group_id = @group_id + AND id > @cursor ORDER BY id ASC LIMIT @numrows; --- name: QueryGroupMessagesDesc :many +-- name: QueryGroupMessagesWithCursorDesc :many SELECT * FROM group_messages WHERE group_id = @group_id + AND id < @cursor ORDER BY id DESC LIMIT @numrows; --- name: QueryGroupMessagesWithCursorAsc :many +-- name: GetAllWelcomeMessages :many SELECT * FROM - group_messages + welcome_messages +ORDER BY + id ASC; + +-- name: QueryWelcomeMessages :many +SELECT + * +FROM + welcome_messages +WHERE + installation_key = @installation_key +ORDER BY + CASE WHEN @sort_desc::BOOL THEN + id + END DESC, + CASE WHEN @sort_desc::BOOL = FALSE THEN + id + END ASC +LIMIT @numrows; + +-- name: QueryWelcomeMessagesWithCursorAsc :many +SELECT + * +FROM + welcome_messages WHERE - group_id = $1 - AND id > $2 + installation_key = @installation_key + AND id > @cursor ORDER BY id ASC -LIMIT $3; +LIMIT @numrows; --- name: QueryGroupMessagesWithCursorDesc :many +-- name: QueryWelcomeMessagesWithCursorDesc :many SELECT * FROM - group_messages + welcome_messages WHERE - group_id = $1 - AND id < $2 + installation_key = @installation_key + AND id < @cursor ORDER BY id DESC -LIMIT $3; +LIMIT @numrows; diff --git a/pkg/mls/store/queries/queries.sql.go b/pkg/mls/store/queries/queries.sql.go index f7e3311e..99a27987 100644 --- a/pkg/mls/store/queries/queries.sql.go +++ b/pkg/mls/store/queries/queries.sql.go @@ -127,6 +127,44 @@ func (q *Queries) GetAddressLogs(ctx context.Context, addresses []string) ([]Get return items, nil } +const getAllGroupMessages = `-- name: GetAllGroupMessages :many +SELECT + id, created_at, group_id, data, group_id_data_hash +FROM + group_messages +ORDER BY + id ASC +` + +func (q *Queries) GetAllGroupMessages(ctx context.Context) ([]GroupMessage, error) { + rows, err := q.db.QueryContext(ctx, getAllGroupMessages) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GroupMessage + for rows.Next() { + var i GroupMessage + if err := rows.Scan( + &i.ID, + &i.CreatedAt, + &i.GroupID, + &i.Data, + &i.GroupIDDataHash, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const getAllInboxLogs = `-- name: GetAllInboxLogs :many SELECT sequence_id, inbox_id, server_timestamp_ns, identity_update_proto @@ -167,6 +205,45 @@ func (q *Queries) GetAllInboxLogs(ctx context.Context, inboxID string) ([]InboxL return items, nil } +const getAllWelcomeMessages = `-- name: GetAllWelcomeMessages :many +SELECT + id, created_at, installation_key, data, installation_key_data_hash, hpke_public_key +FROM + welcome_messages +ORDER BY + id ASC +` + +func (q *Queries) GetAllWelcomeMessages(ctx context.Context) ([]WelcomeMessage, error) { + rows, err := q.db.QueryContext(ctx, getAllWelcomeMessages) + if err != nil { + return nil, err + } + defer rows.Close() + var items []WelcomeMessage + for rows.Next() { + var i WelcomeMessage + if err := rows.Scan( + &i.ID, + &i.CreatedAt, + &i.InstallationKey, + &i.Data, + &i.InstallationKeyDataHash, + &i.HpkePublicKey, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const getIdentityUpdates = `-- name: GetIdentityUpdates :many SELECT id, wallet_address, created_at, updated_at, credential_identity, revoked_at, key_package, expiration @@ -261,6 +338,31 @@ func (q *Queries) GetInboxLogFiltered(ctx context.Context, filters json.RawMessa return items, nil } +const getInstallation = `-- name: GetInstallation :one +SELECT + id, wallet_address, created_at, updated_at, credential_identity, revoked_at, key_package, expiration +FROM + installations +WHERE + id = $1 +` + +func (q *Queries) GetInstallation(ctx context.Context, id []byte) (Installation, error) { + row := q.db.QueryRowContext(ctx, getInstallation, id) + var i Installation + err := row.Scan( + &i.ID, + &i.WalletAddress, + &i.CreatedAt, + &i.UpdatedAt, + &i.CredentialIdentity, + &i.RevokedAt, + &i.KeyPackage, + &i.Expiration, + ) + return i, err +} + const insertAddressLog = `-- name: InsertAddressLog :one INSERT INTO address_log(address, inbox_id, association_sequence_id, revocation_sequence_id) VALUES ($1, $2, $3, $4) @@ -371,7 +473,7 @@ func (q *Queries) InsertWelcomeMessage(ctx context.Context, arg InsertWelcomeMes return i, err } -const queryGroupMessagesAsc = `-- name: QueryGroupMessagesAsc :many +const queryGroupMessages = `-- name: QueryGroupMessages :many SELECT id, created_at, group_id, data, group_id_data_hash FROM @@ -379,17 +481,23 @@ FROM WHERE group_id = $1 ORDER BY - id ASC -LIMIT $2 + CASE WHEN $2::BOOL THEN + id + END DESC, + CASE WHEN $2::BOOL = FALSE THEN + id + END ASC +LIMIT $3 ` -type QueryGroupMessagesAscParams struct { - GroupID []byte - Numrows int32 +type QueryGroupMessagesParams struct { + GroupID []byte + SortDesc bool + Numrows int32 } -func (q *Queries) QueryGroupMessagesAsc(ctx context.Context, arg QueryGroupMessagesAscParams) ([]GroupMessage, error) { - rows, err := q.db.QueryContext(ctx, queryGroupMessagesAsc, arg.GroupID, arg.Numrows) +func (q *Queries) QueryGroupMessages(ctx context.Context, arg QueryGroupMessagesParams) ([]GroupMessage, error) { + rows, err := q.db.QueryContext(ctx, queryGroupMessages, arg.GroupID, arg.SortDesc, arg.Numrows) if err != nil { return nil, err } @@ -417,25 +525,27 @@ func (q *Queries) QueryGroupMessagesAsc(ctx context.Context, arg QueryGroupMessa return items, nil } -const queryGroupMessagesDesc = `-- name: QueryGroupMessagesDesc :many +const queryGroupMessagesWithCursorAsc = `-- name: QueryGroupMessagesWithCursorAsc :many SELECT id, created_at, group_id, data, group_id_data_hash FROM group_messages WHERE group_id = $1 + AND id > $2 ORDER BY - id DESC -LIMIT $2 + id ASC +LIMIT $3 ` -type QueryGroupMessagesDescParams struct { +type QueryGroupMessagesWithCursorAscParams struct { GroupID []byte + Cursor int64 Numrows int32 } -func (q *Queries) QueryGroupMessagesDesc(ctx context.Context, arg QueryGroupMessagesDescParams) ([]GroupMessage, error) { - rows, err := q.db.QueryContext(ctx, queryGroupMessagesDesc, arg.GroupID, arg.Numrows) +func (q *Queries) QueryGroupMessagesWithCursorAsc(ctx context.Context, arg QueryGroupMessagesWithCursorAscParams) ([]GroupMessage, error) { + rows, err := q.db.QueryContext(ctx, queryGroupMessagesWithCursorAsc, arg.GroupID, arg.Cursor, arg.Numrows) if err != nil { return nil, err } @@ -463,27 +573,27 @@ func (q *Queries) QueryGroupMessagesDesc(ctx context.Context, arg QueryGroupMess return items, nil } -const queryGroupMessagesWithCursorAsc = `-- name: QueryGroupMessagesWithCursorAsc :many +const queryGroupMessagesWithCursorDesc = `-- name: QueryGroupMessagesWithCursorDesc :many SELECT id, created_at, group_id, data, group_id_data_hash FROM group_messages WHERE group_id = $1 - AND id > $2 + AND id < $2 ORDER BY - id ASC + id DESC LIMIT $3 ` -type QueryGroupMessagesWithCursorAscParams struct { +type QueryGroupMessagesWithCursorDescParams struct { GroupID []byte - ID int64 - Limit int32 + Cursor int64 + Numrows int32 } -func (q *Queries) QueryGroupMessagesWithCursorAsc(ctx context.Context, arg QueryGroupMessagesWithCursorAscParams) ([]GroupMessage, error) { - rows, err := q.db.QueryContext(ctx, queryGroupMessagesWithCursorAsc, arg.GroupID, arg.ID, arg.Limit) +func (q *Queries) QueryGroupMessagesWithCursorDesc(ctx context.Context, arg QueryGroupMessagesWithCursorDescParams) ([]GroupMessage, error) { + rows, err := q.db.QueryContext(ctx, queryGroupMessagesWithCursorDesc, arg.GroupID, arg.Cursor, arg.Numrows) if err != nil { return nil, err } @@ -511,40 +621,143 @@ func (q *Queries) QueryGroupMessagesWithCursorAsc(ctx context.Context, arg Query return items, nil } -const queryGroupMessagesWithCursorDesc = `-- name: QueryGroupMessagesWithCursorDesc :many +const queryWelcomeMessages = `-- name: QueryWelcomeMessages :many SELECT - id, created_at, group_id, data, group_id_data_hash + id, created_at, installation_key, data, installation_key_data_hash, hpke_public_key FROM - group_messages + welcome_messages WHERE - group_id = $1 + installation_key = $1 +ORDER BY + CASE WHEN $2::BOOL THEN + id + END DESC, + CASE WHEN $2::BOOL = FALSE THEN + id + END ASC +LIMIT $3 +` + +type QueryWelcomeMessagesParams struct { + InstallationKey []byte + SortDesc bool + Numrows int32 +} + +func (q *Queries) QueryWelcomeMessages(ctx context.Context, arg QueryWelcomeMessagesParams) ([]WelcomeMessage, error) { + rows, err := q.db.QueryContext(ctx, queryWelcomeMessages, arg.InstallationKey, arg.SortDesc, arg.Numrows) + if err != nil { + return nil, err + } + defer rows.Close() + var items []WelcomeMessage + for rows.Next() { + var i WelcomeMessage + if err := rows.Scan( + &i.ID, + &i.CreatedAt, + &i.InstallationKey, + &i.Data, + &i.InstallationKeyDataHash, + &i.HpkePublicKey, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const queryWelcomeMessagesWithCursorAsc = `-- name: QueryWelcomeMessagesWithCursorAsc :many +SELECT + id, created_at, installation_key, data, installation_key_data_hash, hpke_public_key +FROM + welcome_messages +WHERE + installation_key = $1 + AND id > $2 +ORDER BY + id ASC +LIMIT $3 +` + +type QueryWelcomeMessagesWithCursorAscParams struct { + InstallationKey []byte + Cursor int64 + Numrows int32 +} + +func (q *Queries) QueryWelcomeMessagesWithCursorAsc(ctx context.Context, arg QueryWelcomeMessagesWithCursorAscParams) ([]WelcomeMessage, error) { + rows, err := q.db.QueryContext(ctx, queryWelcomeMessagesWithCursorAsc, arg.InstallationKey, arg.Cursor, arg.Numrows) + if err != nil { + return nil, err + } + defer rows.Close() + var items []WelcomeMessage + for rows.Next() { + var i WelcomeMessage + if err := rows.Scan( + &i.ID, + &i.CreatedAt, + &i.InstallationKey, + &i.Data, + &i.InstallationKeyDataHash, + &i.HpkePublicKey, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const queryWelcomeMessagesWithCursorDesc = `-- name: QueryWelcomeMessagesWithCursorDesc :many +SELECT + id, created_at, installation_key, data, installation_key_data_hash, hpke_public_key +FROM + welcome_messages +WHERE + installation_key = $1 AND id < $2 ORDER BY id DESC LIMIT $3 ` -type QueryGroupMessagesWithCursorDescParams struct { - GroupID []byte - ID int64 - Limit int32 +type QueryWelcomeMessagesWithCursorDescParams struct { + InstallationKey []byte + Cursor int64 + Numrows int32 } -func (q *Queries) QueryGroupMessagesWithCursorDesc(ctx context.Context, arg QueryGroupMessagesWithCursorDescParams) ([]GroupMessage, error) { - rows, err := q.db.QueryContext(ctx, queryGroupMessagesWithCursorDesc, arg.GroupID, arg.ID, arg.Limit) +func (q *Queries) QueryWelcomeMessagesWithCursorDesc(ctx context.Context, arg QueryWelcomeMessagesWithCursorDescParams) ([]WelcomeMessage, error) { + rows, err := q.db.QueryContext(ctx, queryWelcomeMessagesWithCursorDesc, arg.InstallationKey, arg.Cursor, arg.Numrows) if err != nil { return nil, err } defer rows.Close() - var items []GroupMessage + var items []WelcomeMessage for rows.Next() { - var i GroupMessage + var i WelcomeMessage if err := rows.Scan( &i.ID, &i.CreatedAt, - &i.GroupID, + &i.InstallationKey, &i.Data, - &i.GroupIDDataHash, + &i.InstallationKeyDataHash, + &i.HpkePublicKey, ); err != nil { return nil, err } diff --git a/pkg/mls/store/store.go b/pkg/mls/store/store.go index 172579fd..bf202994 100644 --- a/pkg/mls/store/store.go +++ b/pkg/mls/store/store.go @@ -43,8 +43,8 @@ type MlsStore interface { UpdateKeyPackage(ctx context.Context, installationId, keyPackage []byte, expiration uint64) error FetchKeyPackages(ctx context.Context, installationIds [][]byte) ([]queries.FetchKeyPackagesRow, error) GetIdentityUpdates(ctx context.Context, walletAddresses []string, startTimeNs int64) (map[string]IdentityUpdateList, error) - InsertGroupMessage(ctx context.Context, groupId []byte, data []byte) (*GroupMessage, error) - InsertWelcomeMessage(ctx context.Context, installationId []byte, data []byte, hpkePublicKey []byte) (*WelcomeMessage, error) + InsertGroupMessage(ctx context.Context, groupId []byte, data []byte) (*queries.GroupMessage, error) + InsertWelcomeMessage(ctx context.Context, installationId []byte, data []byte, hpkePublicKey []byte) (*queries.WelcomeMessage, error) QueryGroupMessagesV1(ctx context.Context, query *mlsv1.QueryGroupMessagesRequest) (*mlsv1.QueryGroupMessagesResponse, error) QueryWelcomeMessagesV1(ctx context.Context, query *mlsv1.QueryWelcomeMessagesRequest) (*mlsv1.QueryWelcomeMessagesResponse, error) } @@ -319,13 +319,14 @@ func (s *Store) RevokeInstallation(ctx context.Context, installationId []byte) e }) } -func (s *Store) InsertGroupMessage(ctx context.Context, groupId []byte, data []byte) (*GroupMessage, error) { - message := GroupMessage{ - Data: data, - } +func (s *Store) InsertGroupMessage(ctx context.Context, groupId []byte, data []byte) (*queries.GroupMessage, error) { + dataHash := sha256.Sum256(append(groupId, data...)) + message, err := s.queries.InsertGroupMessage(ctx, queries.InsertGroupMessageParams{ + GroupID: groupId, + Data: data, + GroupIDDataHash: dataHash[:], + }) - var id uint64 - err := s.db.QueryRow("INSERT INTO group_messages (group_id, data, group_id_data_hash) VALUES (?, ?, ?) RETURNING id", groupId, data, sha256.Sum256(append(groupId, data...))).Scan(&id) if err != nil { if strings.Contains(err.Error(), "duplicate key value violates unique constraint") { return nil, NewAlreadyExistsError(err) @@ -333,21 +334,17 @@ func (s *Store) InsertGroupMessage(ctx context.Context, groupId []byte, data []b return nil, err } - err = s.db.NewSelect().Model(&message).Where("id = ?", id).Scan(ctx) - if err != nil { - return nil, err - } - return &message, nil } -func (s *Store) InsertWelcomeMessage(ctx context.Context, installationId []byte, data []byte, hpkePublicKey []byte) (*WelcomeMessage, error) { - message := WelcomeMessage{ - Data: data, - } - - var id uint64 - err := s.db.QueryRow("INSERT INTO welcome_messages (installation_key, data, installation_key_data_hash, hpke_public_key) VALUES (?, ?, ?, ?) RETURNING id", installationId, data, sha256.Sum256(append(installationId, data...)), hpkePublicKey).Scan(&id) +func (s *Store) InsertWelcomeMessage(ctx context.Context, installationId []byte, data []byte, hpkePublicKey []byte) (*queries.WelcomeMessage, error) { + dataHash := sha256.Sum256(append(installationId, data...)) + message, err := s.queries.InsertWelcomeMessage(ctx, queries.InsertWelcomeMessageParams{ + InstallationKey: installationId, + Data: data, + InstallationKeyDataHash: dataHash[:], + HpkePublicKey: hpkePublicKey, + }) if err != nil { if strings.Contains(err.Error(), "duplicate key value violates unique constraint") { return nil, NewAlreadyExistsError(err) @@ -355,145 +352,163 @@ func (s *Store) InsertWelcomeMessage(ctx context.Context, installationId []byte, return nil, err } - err = s.db.NewSelect().Model(&message).Where("id = ?", id).Scan(ctx) - if err != nil { - return nil, err - } - return &message, nil } func (s *Store) QueryGroupMessagesV1(ctx context.Context, req *mlsv1.QueryGroupMessagesRequest) (*mlsv1.QueryGroupMessagesResponse, error) { - msgs := make([]*GroupMessage, 0) - if len(req.GroupId) == 0 { return nil, errors.New("group is required") } - q := s.db.NewSelect(). - Model(&msgs). - Where("group_id = ?", req.GroupId) + sortDesc := true + var idCursor int64 + var err error + var messages []queries.GroupMessage + pageSize := int32(maxPageSize) - direction := mlsv1.SortDirection_SORT_DIRECTION_DESCENDING - if req.PagingInfo != nil && req.PagingInfo.Direction != mlsv1.SortDirection_SORT_DIRECTION_UNSPECIFIED { - direction = req.PagingInfo.Direction - } - switch direction { - case mlsv1.SortDirection_SORT_DIRECTION_DESCENDING: - q = q.Order("id DESC") - case mlsv1.SortDirection_SORT_DIRECTION_ASCENDING: - q = q.Order("id ASC") + if req.PagingInfo != nil && req.PagingInfo.Direction == mlsv1.SortDirection_SORT_DIRECTION_ASCENDING { + sortDesc = false } - pageSize := maxPageSize if req.PagingInfo != nil && req.PagingInfo.Limit > 0 && req.PagingInfo.Limit <= maxPageSize { - pageSize = int(req.PagingInfo.Limit) + pageSize = int32(req.PagingInfo.Limit) } - q = q.Limit(pageSize) if req.PagingInfo != nil && req.PagingInfo.IdCursor != 0 { - if direction == mlsv1.SortDirection_SORT_DIRECTION_ASCENDING { - q = q.Where("id > ?", req.PagingInfo.IdCursor) + idCursor = int64(req.PagingInfo.IdCursor) + } + + if idCursor > 0 { + if sortDesc { + messages, err = s.queries.QueryGroupMessagesWithCursorDesc(ctx, queries.QueryGroupMessagesWithCursorDescParams{ + GroupID: req.GroupId, + Cursor: idCursor, + Numrows: pageSize, + }) } else { - q = q.Where("id < ?", req.PagingInfo.IdCursor) + messages, err = s.queries.QueryGroupMessagesWithCursorAsc(ctx, queries.QueryGroupMessagesWithCursorAscParams{ + GroupID: req.GroupId, + Cursor: idCursor, + Numrows: pageSize, + }) } + } else { + messages, err = s.queries.QueryGroupMessages(ctx, queries.QueryGroupMessagesParams{ + GroupID: req.GroupId, + Numrows: pageSize, + SortDesc: sortDesc, + }) } - err := q.Scan(ctx) if err != nil { return nil, err } - messages := make([]*mlsv1.GroupMessage, 0, len(msgs)) - for _, msg := range msgs { - messages = append(messages, &mlsv1.GroupMessage{ + out := make([]*mlsv1.GroupMessage, len(messages)) + for idx, msg := range messages { + out[idx] = &mlsv1.GroupMessage{ Version: &mlsv1.GroupMessage_V1_{ V1: &mlsv1.GroupMessage_V1{ - Id: msg.Id, + Id: uint64(msg.ID), CreatedNs: uint64(msg.CreatedAt.UnixNano()), - GroupId: msg.GroupId, + GroupId: msg.GroupID, Data: msg.Data, }, }, - }) + } + } + + direction := mlsv1.SortDirection_SORT_DIRECTION_ASCENDING + if sortDesc { + direction = mlsv1.SortDirection_SORT_DIRECTION_DESCENDING } pagingInfo := &mlsv1.PagingInfo{Limit: uint32(pageSize), IdCursor: 0, Direction: direction} - if len(messages) >= pageSize { - lastMsg := msgs[len(messages)-1] - pagingInfo.IdCursor = lastMsg.Id + if len(messages) >= int(pageSize) { + lastMsg := messages[len(messages)-1] + pagingInfo.IdCursor = uint64(lastMsg.ID) } return &mlsv1.QueryGroupMessagesResponse{ - Messages: messages, + Messages: out, PagingInfo: pagingInfo, }, nil } func (s *Store) QueryWelcomeMessagesV1(ctx context.Context, req *mlsv1.QueryWelcomeMessagesRequest) (*mlsv1.QueryWelcomeMessagesResponse, error) { - msgs := make([]*WelcomeMessage, 0) - if len(req.InstallationKey) == 0 { return nil, errors.New("installation is required") } - q := s.db.NewSelect(). - Model(&msgs). - Where("installation_key = ?", req.InstallationKey) - + sortDesc := true direction := mlsv1.SortDirection_SORT_DIRECTION_DESCENDING - if req.PagingInfo != nil && req.PagingInfo.Direction != mlsv1.SortDirection_SORT_DIRECTION_UNSPECIFIED { - direction = req.PagingInfo.Direction - } - switch direction { - case mlsv1.SortDirection_SORT_DIRECTION_DESCENDING: - q = q.Order("id DESC") - case mlsv1.SortDirection_SORT_DIRECTION_ASCENDING: - q = q.Order("id ASC") + pageSize := int32(maxPageSize) + var idCursor int64 + var err error + var messages []queries.WelcomeMessage + + if req.PagingInfo != nil && req.PagingInfo.Direction == mlsv1.SortDirection_SORT_DIRECTION_ASCENDING { + sortDesc = false + direction = mlsv1.SortDirection_SORT_DIRECTION_ASCENDING } - pageSize := maxPageSize if req.PagingInfo != nil && req.PagingInfo.Limit > 0 && req.PagingInfo.Limit <= maxPageSize { - pageSize = int(req.PagingInfo.Limit) + pageSize = int32(req.PagingInfo.Limit) } - q = q.Limit(pageSize) if req.PagingInfo != nil && req.PagingInfo.IdCursor != 0 { - if direction == mlsv1.SortDirection_SORT_DIRECTION_ASCENDING { - q = q.Where("id > ?", req.PagingInfo.IdCursor) + idCursor = int64(req.PagingInfo.IdCursor) + } + + if idCursor > 0 { + if sortDesc { + messages, err = s.queries.QueryWelcomeMessagesWithCursorDesc(ctx, queries.QueryWelcomeMessagesWithCursorDescParams{ + InstallationKey: req.InstallationKey, + Cursor: idCursor, + Numrows: pageSize, + }) } else { - q = q.Where("id < ?", req.PagingInfo.IdCursor) + messages, err = s.queries.QueryWelcomeMessagesWithCursorAsc(ctx, queries.QueryWelcomeMessagesWithCursorAscParams{ + InstallationKey: req.InstallationKey, + Cursor: idCursor, + Numrows: pageSize, + }) } + } else { + messages, err = s.queries.QueryWelcomeMessages(ctx, queries.QueryWelcomeMessagesParams{ + InstallationKey: req.InstallationKey, + Numrows: pageSize, + SortDesc: sortDesc, + }) } - err := q.Scan(ctx) if err != nil { return nil, err } - messages := make([]*mlsv1.WelcomeMessage, 0, len(msgs)) - for _, msg := range msgs { - messages = append(messages, &mlsv1.WelcomeMessage{ + out := make([]*mlsv1.WelcomeMessage, len(messages)) + for idx, msg := range messages { + out[idx] = &mlsv1.WelcomeMessage{ Version: &mlsv1.WelcomeMessage_V1_{ V1: &mlsv1.WelcomeMessage_V1{ - Id: msg.Id, + Id: uint64(msg.ID), CreatedNs: uint64(msg.CreatedAt.UnixNano()), Data: msg.Data, InstallationKey: msg.InstallationKey, HpkePublicKey: msg.HpkePublicKey, }, }, - }) + } } pagingInfo := &mlsv1.PagingInfo{Limit: uint32(pageSize), IdCursor: 0, Direction: direction} - if len(messages) >= pageSize { - lastMsg := msgs[len(messages)-1] - pagingInfo.IdCursor = lastMsg.Id + if len(messages) >= int(pageSize) { + lastMsg := messages[len(messages)-1] + pagingInfo.IdCursor = uint64(lastMsg.ID) } return &mlsv1.QueryWelcomeMessagesResponse{ - Messages: messages, + Messages: out, PagingInfo: pagingInfo, }, nil } diff --git a/pkg/mls/store/store_test.go b/pkg/mls/store/store_test.go index 112776b9..e4eb3bcb 100644 --- a/pkg/mls/store/store_test.go +++ b/pkg/mls/store/store_test.go @@ -80,8 +80,8 @@ func TestCreateInstallation(t *testing.T) { err := store.CreateInstallation(ctx, installationId, walletAddress, test.RandomBytes(32), test.RandomBytes(32), 0) require.NoError(t, err) - installationFromDb := &Installation{} - require.NoError(t, store.db.NewSelect().Model(installationFromDb).Where("id = ?", installationId).Scan(ctx)) + installationFromDb, err := store.queries.GetInstallation(ctx, installationId) + require.NoError(t, err) require.Equal(t, walletAddress, installationFromDb.WalletAddress) } @@ -101,11 +101,11 @@ func TestUpdateKeyPackage(t *testing.T) { err = store.UpdateKeyPackage(ctx, installationId, keyPackage2, 1) require.NoError(t, err) - installationFromDb := &Installation{} - require.NoError(t, store.db.NewSelect().Model(installationFromDb).Where("id = ?", installationId).Scan(ctx)) + installationFromDb, err := store.queries.GetInstallation(ctx, installationId) + require.NoError(t, err) require.Equal(t, keyPackage2, installationFromDb.KeyPackage) - require.Equal(t, uint64(1), installationFromDb.Expiration) + require.Equal(t, int64(1), installationFromDb.Expiration) } func TestConsumeLastResortKeyPackage(t *testing.T) { @@ -226,16 +226,15 @@ func TestInsertGroupMessage_Single(t *testing.T) { msg, err := store.InsertGroupMessage(ctx, []byte("group"), []byte("data")) require.NoError(t, err) require.NotNil(t, msg) - require.Equal(t, uint64(1), msg.Id) + require.Equal(t, int64(1), msg.ID) require.True(t, msg.CreatedAt.Before(time.Now().UTC()) && msg.CreatedAt.After(started)) - require.Equal(t, []byte("group"), msg.GroupId) + require.Equal(t, []byte("group"), msg.GroupID) require.Equal(t, []byte("data"), msg.Data) - msgs := make([]*GroupMessage, 0) - err = store.db.NewSelect().Model(&msgs).Scan(ctx) + msgs, err := store.queries.GetAllGroupMessages(ctx) require.NoError(t, err) require.Len(t, msgs, 1) - require.Equal(t, msg, msgs[0]) + require.Equal(t, *msg, msgs[0]) } func TestInsertGroupMessage_Duplicate(t *testing.T) { @@ -265,13 +264,12 @@ func TestInsertGroupMessage_ManyOrderedByTime(t *testing.T) { _, err = store.InsertGroupMessage(ctx, []byte("group"), []byte("data3")) require.NoError(t, err) - msgs := make([]*GroupMessage, 0) - err = store.db.NewSelect().Model(&msgs).Order("created_at DESC").Scan(ctx) + msgs, err := store.queries.GetAllGroupMessages(ctx) require.NoError(t, err) require.Len(t, msgs, 3) - require.Equal(t, []byte("data3"), msgs[0].Data) + require.Equal(t, []byte("data1"), msgs[0].Data) require.Equal(t, []byte("data2"), msgs[1].Data) - require.Equal(t, []byte("data1"), msgs[2].Data) + require.Equal(t, []byte("data3"), msgs[2].Data) } func TestInsertWelcomeMessage_Single(t *testing.T) { @@ -283,17 +281,16 @@ func TestInsertWelcomeMessage_Single(t *testing.T) { msg, err := store.InsertWelcomeMessage(ctx, []byte("installation"), []byte("data"), []byte("hpke")) require.NoError(t, err) require.NotNil(t, msg) - require.Equal(t, uint64(1), msg.Id) - require.True(t, msg.CreatedAt.Before(time.Now().UTC()) && msg.CreatedAt.After(started)) + require.Equal(t, int64(1), msg.ID) + require.True(t, msg.CreatedAt.Before(time.Now().UTC().Add(1*time.Minute)) && msg.CreatedAt.After(started)) require.Equal(t, []byte("installation"), msg.InstallationKey) require.Equal(t, []byte("data"), msg.Data) require.Equal(t, []byte("hpke"), msg.HpkePublicKey) - msgs := make([]*WelcomeMessage, 0) - err = store.db.NewSelect().Model(&msgs).Scan(ctx) + msgs, err := store.queries.GetAllWelcomeMessages(ctx) require.NoError(t, err) require.Len(t, msgs, 1) - require.Equal(t, msg, msgs[0]) + require.Equal(t, *msg, msgs[0]) } func TestInsertWelcomeMessage_Duplicate(t *testing.T) { @@ -323,13 +320,14 @@ func TestInsertWelcomeMessage_ManyOrderedByTime(t *testing.T) { _, err = store.InsertWelcomeMessage(ctx, []byte("installation"), []byte("data3"), []byte("hpke")) require.NoError(t, err) - msgs := make([]*WelcomeMessage, 0) - err = store.db.NewSelect().Model(&msgs).Order("created_at DESC").Scan(ctx) + msgs, err := store.queries.GetAllWelcomeMessages(ctx) require.NoError(t, err) require.Len(t, msgs, 3) - require.Equal(t, []byte("data3"), msgs[0].Data) + require.Equal(t, []byte("data1"), msgs[0].Data) require.Equal(t, []byte("data2"), msgs[1].Data) - require.Equal(t, []byte("data1"), msgs[2].Data) + require.Equal(t, []byte("data3"), msgs[2].Data) + require.Greater(t, msgs[1].CreatedAt, msgs[0].CreatedAt) + require.Greater(t, msgs[2].CreatedAt, msgs[1].CreatedAt) } func TestQueryGroupMessagesV1_MissingGroup(t *testing.T) { diff --git a/pkg/server/pgxdb.go b/pkg/server/pgxdb.go index 2c33c905..e36c663b 100644 --- a/pkg/server/pgxdb.go +++ b/pkg/server/pgxdb.go @@ -6,7 +6,6 @@ import ( "fmt" "time" - "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/pgxpool" "github.com/jackc/pgx/v5/stdlib" _ "github.com/jackc/pgx/v5/stdlib" @@ -19,7 +18,7 @@ func newPGXDB(dsn string, waitForDB, statementTimeout time.Duration) (*sql.DB, e if err != nil { return nil, err } - config.ConnConfig.DefaultQueryExecMode = pgx.QueryExecModeSimpleProtocol + config.ConnConfig.RuntimeParams["statement_timeout"] = fmt.Sprint(statementTimeout.Milliseconds()) dbpool, err := pgxpool.NewWithConfig(context.Background(), config)