fix_: send request for shared addresses when restoring a community (#5314)

* fix_: send request for shared addresses when restoring a community

Needed for https://github.com/status-im/status-desktop/issues/14289

When someone restores a community that they joined, it now sends a message to the control node to get their shared addresses back.

It's lighter that backing up the addresses all the time on waku and should only be needed once.

* fix_: filter communities before to avoid passing `alreadyHandled` parameter to `requestCommunityKeysAndSharedAddresses`

---------

Co-authored-by: Patryk Osmaczko <osmaczkopatryk@gmail.com>
This commit is contained in:
Jonathan Rainville 2024-06-14 13:32:55 -04:00 committed by GitHub
parent 4c090d5699
commit 4a63201a79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 443 additions and 67 deletions

View File

@ -2069,6 +2069,46 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) TestResendEncryptionKeyOnBac
s.Require().Len(response.Messages(), 1)
}
func (s *MessengerCommunitiesTokenPermissionsSuite) TestResendSharedAddressesOnBackupRestore() {
community, _ := s.createCommunity()
// bob joins the community
s.advertiseCommunityTo(community, s.bob)
s.joinCommunity(community, s.bob, bobPassword, []string{})
currentBobSharedAddresses, err := s.bob.GetRevealedAccounts(community.ID(), s.bob.IdentityPublicKeyString())
s.Require().NoError(err)
// Simulate backup creation and handling backup message
// As a result, bob sends request to resend encryption keys to the owner
clock, _ := s.bob.getLastClockWithRelatedChat()
community, err = s.owner.communitiesManager.GetByID(community.ID())
s.Require().NoError(err)
backupMessage, err := s.bob.backupCommunity(community, clock)
s.Require().NoError(err)
err = s.bob.HandleBackup(s.bob.buildMessageState(), backupMessage, nil)
s.Require().NoError(err)
// Owner will receive the request for addresses and send them back to Bob
response, err := WaitOnMessengerResponse(
s.bob,
func(r *MessengerResponse) bool {
_, _ = s.owner.RetrieveAll()
return len(r.requestsToJoinCommunity) > 0
},
"request to join not received",
)
s.Require().NoError(err)
requestID := communities.CalculateRequestID(common.PubkeyToHex(&s.bob.identity.PublicKey), community.ID())
requestToJoin, ok := response.requestsToJoinCommunity[requestID.String()]
s.Require().Equal(true, ok)
s.Require().Equal(currentBobSharedAddresses, requestToJoin.RevealedAccounts)
}
func (s *MessengerCommunitiesTokenPermissionsSuite) TestReevaluateMemberPermissionsPerformance() {
// This test is created for a performance degradation tracking for reevaluateMember permissions
// current scenario mostly track channels permissions reevaluating, but feel free to expand it to

View File

@ -302,15 +302,27 @@ func (m *Messenger) handleWatchOnlyAccount(message *protobuf.SyncAccount) error
return nil
}
func syncInstallationCommunitiesSet(communities []*protobuf.SyncInstallationCommunity) map[string]*protobuf.SyncInstallationCommunity {
ret := map[string]*protobuf.SyncInstallationCommunity{}
for _, c := range communities {
id := string(c.GetId())
prevC, ok := ret[id]
if !ok || prevC.Clock < c.Clock {
ret[id] = c
}
}
return ret
}
func (m *Messenger) handleSyncedCommunities(state *ReceivedMessageState, message *protobuf.Backup) []error {
var errors []error
for _, syncCommunity := range message.Communities {
for _, syncCommunity := range syncInstallationCommunitiesSet(message.Communities) {
err := m.handleSyncInstallationCommunity(state, syncCommunity, nil)
if err != nil {
errors = append(errors, err)
}
err = m.requestCommunityKeys(state, syncCommunity)
err = m.requestCommunityKeysAndSharedAddresses(state, syncCommunity)
if err != nil {
errors = append(errors, err)
}
@ -319,7 +331,7 @@ func (m *Messenger) handleSyncedCommunities(state *ReceivedMessageState, message
return errors
}
func (m *Messenger) requestCommunityKeys(state *ReceivedMessageState, syncCommunity *protobuf.SyncInstallationCommunity) error {
func (m *Messenger) requestCommunityKeysAndSharedAddresses(state *ReceivedMessageState, syncCommunity *protobuf.SyncInstallationCommunity) error {
if !syncCommunity.Joined {
return nil
}
@ -333,6 +345,32 @@ func (m *Messenger) requestCommunityKeys(state *ReceivedMessageState, syncCommun
return communities.ErrOrgNotFound
}
// Send a request to get back our previous shared addresses
request := &protobuf.CommunitySharedAddressesRequest{
CommunityId: syncCommunity.Id,
}
payload, err := proto.Marshal(request)
if err != nil {
return err
}
rawMessage := &common.RawMessage{
Payload: payload,
Sender: m.identity,
CommunityID: community.ID(),
SkipEncryptionLayer: true,
MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_SHARED_ADDRESSES_REQUEST,
}
_, err = m.SendMessageToControlNode(community, rawMessage)
if err != nil {
m.logger.Error("failed to request shared addresses", zap.String("communityId", community.IDString()), zap.Error(err))
return err
}
// If the community is encrypted or one channel is, ask for the encryption keys back
isEncrypted := syncCommunity.Encrypted || len(syncCommunity.EncryptionKeysV2) > 0
if !isEncrypted {
// check if we have encrypted channels

View File

@ -590,6 +590,29 @@ func (m *Messenger) HandleCommunityEncryptionKeysRequest(state *ReceivedMessageS
return m.handleCommunityEncryptionKeysRequest(community, signer)
}
func (m *Messenger) HandleCommunitySharedAddressesRequest(state *ReceivedMessageState, message *protobuf.CommunitySharedAddressesRequest, statusMessage *v1protocol.StatusMessage) error {
community, err := m.communitiesManager.GetByID(message.CommunityId)
if err != nil {
return err
}
if !community.IsControlNode() {
return communities.ErrNotControlNode
}
signer := state.CurrentMessageState.PublicKey
return m.handleCommunitySharedAddressesRequest(state, community, signer)
}
func (m *Messenger) HandleCommunitySharedAddressesResponse(state *ReceivedMessageState, message *protobuf.CommunitySharedAddressesResponse, statusMessage *v1protocol.StatusMessage) error {
community, err := m.communitiesManager.GetByID(message.CommunityId)
if err != nil {
return err
}
signer := state.CurrentMessageState.PublicKey
return m.handleCommunitySharedAddressesResponse(state, community, signer, message.RevealedAccounts)
}
func (m *Messenger) HandleCommunityTokenAction(state *ReceivedMessageState, message *protobuf.CommunityTokenAction, statusMessage *v1protocol.StatusMessage) error {
return m.communityTokensService.ProcessCommunityTokenAction(message)
}
@ -635,6 +658,70 @@ func (m *Messenger) handleCommunityEncryptionKeysRequest(community *communities.
return nil
}
func (m *Messenger) handleCommunitySharedAddressesRequest(state *ReceivedMessageState, community *communities.Community, signer *ecdsa.PublicKey) error {
if !community.HasMember(signer) {
return communities.ErrMemberNotFound
}
pkStr := common.PubkeyToHex(signer)
revealedAccounts, err := m.communitiesManager.GetRevealedAddresses(community.ID(), pkStr)
if err != nil {
return err
}
usersSharedAddressesProto := &protobuf.CommunitySharedAddressesResponse{
CommunityId: community.ID(),
RevealedAccounts: revealedAccounts,
}
payload, err := proto.Marshal(usersSharedAddressesProto)
if err != nil {
return err
}
rawMessage := common.RawMessage{
Payload: payload,
Sender: community.PrivateKey(),
CommunityID: community.ID(),
SkipEncryptionLayer: true,
MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_SHARED_ADDRESSES_RESPONSE,
PubsubTopic: shard.DefaultNonProtectedPubsubTopic(),
ResendType: common.ResendTypeRawMessage,
ResendMethod: common.ResendMethodSendPrivate,
Recipients: []*ecdsa.PublicKey{signer},
}
_, err = m.sender.SendPrivate(context.Background(), signer, &rawMessage)
if err != nil {
return err
}
return nil
}
func (m *Messenger) handleCommunitySharedAddressesResponse(state *ReceivedMessageState, community *communities.Community, signer *ecdsa.PublicKey, revealedAccounts []*protobuf.RevealedAccount) error {
isControlNodeMsg := common.IsPubKeyEqual(community.ControlNode(), signer)
if !isControlNodeMsg {
return errors.New(ErrSyncMessagesSentByNonControlNode)
}
requestID := communities.CalculateRequestID(common.PubkeyToHex(&m.identity.PublicKey), community.ID())
err := m.communitiesManager.SaveRequestToJoinRevealedAddresses(requestID, revealedAccounts)
if err != nil {
return nil
}
requestsToJoin, err := m.communitiesManager.GetCommunityRequestsToJoinWithRevealedAddresses(community.ID())
if err != nil {
return nil
}
state.Response.AddRequestsToJoinCommunity(requestsToJoin)
return nil
}
func (m *Messenger) handleCommunityGrant(community *communities.Community, grant []byte, clock uint64) error {
difference, err := m.communitiesManager.HandleCommunityGrant(community, grant, clock)
if err == communities.ErrGrantOlder || err == communities.ErrGrantExpired {

View File

@ -5,7 +5,7 @@
package protocol
import (
"errors"
"errors"
"github.com/golang/protobuf/proto"
"go.uber.org/zap"
@ -256,9 +256,15 @@ func (m *Messenger) dispatchToHandler(messageState *ReceivedMessageState, protoB
case protobuf.ApplicationMetadataMessage_COMMUNITY_ENCRYPTION_KEYS_REQUEST:
return m.handleCommunityEncryptionKeysRequestProtobuf(messageState, protoBytes, msg, filter)
case protobuf.ApplicationMetadataMessage_COMMUNITY_TOKEN_ACTION:
case protobuf.ApplicationMetadataMessage_COMMUNITY_TOKEN_ACTION:
return m.handleCommunityTokenActionProtobuf(messageState, protoBytes, msg, filter)
case protobuf.ApplicationMetadataMessage_COMMUNITY_SHARED_ADDRESSES_REQUEST:
return m.handleCommunitySharedAddressesRequestProtobuf(messageState, protoBytes, msg, filter)
case protobuf.ApplicationMetadataMessage_COMMUNITY_SHARED_ADDRESSES_RESPONSE:
return m.handleCommunitySharedAddressesResponseProtobuf(messageState, protoBytes, msg, filter)
default:
m.logger.Info("protobuf type not found", zap.String("type", string(msg.ApplicationLayer.Type)))
return errors.New("protobuf type not found")
@ -1835,9 +1841,12 @@ func (m *Messenger) handleCommunityEncryptionKeysRequestProtobuf(messageState *R
}
func (m *Messenger) handleCommunityTokenActionProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error {
m.logger.Info("handling CommunityTokenAction")
p := &protobuf.CommunityTokenAction{}
err := proto.Unmarshal(protoBytes, p)
if err != nil {
@ -1847,5 +1856,43 @@ func (m *Messenger) handleCommunityTokenActionProtobuf(messageState *ReceivedMes
m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p)
return m.HandleCommunityTokenAction(messageState, p, msg)
}
func (m *Messenger) handleCommunitySharedAddressesRequestProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error {
m.logger.Info("handling CommunitySharedAddressesRequest")
p := &protobuf.CommunitySharedAddressesRequest{}
err := proto.Unmarshal(protoBytes, p)
if err != nil {
return err
}
m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p)
return m.HandleCommunitySharedAddressesRequest(messageState, p, msg)
}
func (m *Messenger) handleCommunitySharedAddressesResponseProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error {
m.logger.Info("handling CommunitySharedAddressesResponse")
p := &protobuf.CommunitySharedAddressesResponse{}
err := proto.Unmarshal(protoBytes, p)
if err != nil {
return err
}
m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p)
return m.HandleCommunitySharedAddressesResponse(messageState, p, msg)
}

View File

@ -110,6 +110,8 @@ const (
ApplicationMetadataMessage_COMMUNITY_UPDATE_GRANT ApplicationMetadataMessage_Type = 86
ApplicationMetadataMessage_COMMUNITY_ENCRYPTION_KEYS_REQUEST ApplicationMetadataMessage_Type = 87
ApplicationMetadataMessage_COMMUNITY_TOKEN_ACTION ApplicationMetadataMessage_Type = 88
ApplicationMetadataMessage_COMMUNITY_SHARED_ADDRESSES_REQUEST ApplicationMetadataMessage_Type = 89
ApplicationMetadataMessage_COMMUNITY_SHARED_ADDRESSES_RESPONSE ApplicationMetadataMessage_Type = 90
)
// Enum value maps for ApplicationMetadataMessage_Type.
@ -199,6 +201,8 @@ var (
86: "COMMUNITY_UPDATE_GRANT",
87: "COMMUNITY_ENCRYPTION_KEYS_REQUEST",
88: "COMMUNITY_TOKEN_ACTION",
89: "COMMUNITY_SHARED_ADDRESSES_REQUEST",
90: "COMMUNITY_SHARED_ADDRESSES_RESPONSE",
}
ApplicationMetadataMessage_Type_value = map[string]int32{
"UNKNOWN": 0,
@ -285,6 +289,8 @@ var (
"COMMUNITY_UPDATE_GRANT": 86,
"COMMUNITY_ENCRYPTION_KEYS_REQUEST": 87,
"COMMUNITY_TOKEN_ACTION": 88,
"COMMUNITY_SHARED_ADDRESSES_REQUEST": 89,
"COMMUNITY_SHARED_ADDRESSES_RESPONSE": 90,
}
)
@ -386,7 +392,7 @@ var File_application_metadata_message_proto protoreflect.FileDescriptor
var file_application_metadata_message_proto_rawDesc = []byte{
0x0a, 0x22, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65,
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0xa6,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0xf7,
0x16, 0x0a, 0x1a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65,
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a,
0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c,
@ -396,7 +402,7 @@ var file_application_metadata_message_proto_rawDesc = []byte{
0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41,
0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,
0x74, 0x61, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04,
0x74, 0x79, 0x70, 0x65, 0x22, 0x90, 0x15, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a,
0x74, 0x79, 0x70, 0x65, 0x22, 0xe1, 0x15, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a,
0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x43, 0x48,
0x41, 0x54, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e,
0x43, 0x4f, 0x4e, 0x54, 0x41, 0x43, 0x54, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x02,
@ -555,18 +561,23 @@ var file_application_metadata_message_proto_rawDesc = []byte{
0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4b, 0x45, 0x59, 0x53, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45,
0x53, 0x54, 0x10, 0x57, 0x12, 0x1a, 0x0a, 0x16, 0x43, 0x4f, 0x4d, 0x4d, 0x55, 0x4e, 0x49, 0x54,
0x59, 0x5f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x58,
0x22, 0x04, 0x08, 0x0e, 0x10, 0x0e, 0x22, 0x04, 0x08, 0x41, 0x10, 0x41, 0x22, 0x04, 0x08, 0x42,
0x10, 0x42, 0x22, 0x04, 0x08, 0x47, 0x10, 0x47, 0x2a, 0x1d, 0x53, 0x59, 0x4e, 0x43, 0x5f, 0x49,
0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x55, 0x42, 0x4c,
0x49, 0x43, 0x5f, 0x43, 0x48, 0x41, 0x54, 0x2a, 0x22, 0x53, 0x59, 0x4e, 0x43, 0x5f, 0x41, 0x43,
0x54, 0x49, 0x56, 0x49, 0x54, 0x59, 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x45, 0x52, 0x5f, 0x4e, 0x4f,
0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x2a, 0x27, 0x53, 0x59, 0x4e,
0x43, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x49, 0x54, 0x59, 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x45,
0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53,
0x54, 0x41, 0x54, 0x45, 0x2a, 0x21, 0x43, 0x4f, 0x4d, 0x4d, 0x55, 0x4e, 0x49, 0x54, 0x59, 0x5f,
0x45, 0x56, 0x45, 0x4e, 0x54, 0x53, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x52,
0x45, 0x4a, 0x45, 0x43, 0x54, 0x45, 0x44, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2f, 0x3b, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x12, 0x26, 0x0a, 0x22, 0x43, 0x4f, 0x4d, 0x4d, 0x55, 0x4e, 0x49, 0x54, 0x59, 0x5f, 0x53, 0x48,
0x41, 0x52, 0x45, 0x44, 0x5f, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x45, 0x53, 0x5f, 0x52,
0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x59, 0x12, 0x27, 0x0a, 0x23, 0x43, 0x4f, 0x4d, 0x4d,
0x55, 0x4e, 0x49, 0x54, 0x59, 0x5f, 0x53, 0x48, 0x41, 0x52, 0x45, 0x44, 0x5f, 0x41, 0x44, 0x44,
0x52, 0x45, 0x53, 0x53, 0x45, 0x53, 0x5f, 0x52, 0x45, 0x53, 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x10,
0x5a, 0x22, 0x04, 0x08, 0x0e, 0x10, 0x0e, 0x22, 0x04, 0x08, 0x41, 0x10, 0x41, 0x22, 0x04, 0x08,
0x42, 0x10, 0x42, 0x22, 0x04, 0x08, 0x47, 0x10, 0x47, 0x2a, 0x1d, 0x53, 0x59, 0x4e, 0x43, 0x5f,
0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x55, 0x42,
0x4c, 0x49, 0x43, 0x5f, 0x43, 0x48, 0x41, 0x54, 0x2a, 0x22, 0x53, 0x59, 0x4e, 0x43, 0x5f, 0x41,
0x43, 0x54, 0x49, 0x56, 0x49, 0x54, 0x59, 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x45, 0x52, 0x5f, 0x4e,
0x4f, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x2a, 0x27, 0x53, 0x59,
0x4e, 0x43, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x49, 0x54, 0x59, 0x5f, 0x43, 0x45, 0x4e, 0x54,
0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f,
0x53, 0x54, 0x41, 0x54, 0x45, 0x2a, 0x21, 0x43, 0x4f, 0x4d, 0x4d, 0x55, 0x4e, 0x49, 0x54, 0x59,
0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x53, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f,
0x52, 0x45, 0x4a, 0x45, 0x43, 0x54, 0x45, 0x44, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2f, 0x3b, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -107,5 +107,7 @@ message ApplicationMetadataMessage {
COMMUNITY_UPDATE_GRANT = 86;
COMMUNITY_ENCRYPTION_KEYS_REQUEST = 87;
COMMUNITY_TOKEN_ACTION = 88;
COMMUNITY_SHARED_ADDRESSES_REQUEST = 89;
COMMUNITY_SHARED_ADDRESSES_RESPONSE = 90;
}
}

View File

@ -2753,6 +2753,108 @@ func (x *CommunityEncryptionKeysRequest) GetCommunityId() []byte {
return nil
}
type CommunitySharedAddressesRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
CommunityId []byte `protobuf:"bytes,1,opt,name=community_id,json=communityId,proto3" json:"community_id,omitempty"`
}
func (x *CommunitySharedAddressesRequest) Reset() {
*x = CommunitySharedAddressesRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_communities_proto_msgTypes[33]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CommunitySharedAddressesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CommunitySharedAddressesRequest) ProtoMessage() {}
func (x *CommunitySharedAddressesRequest) ProtoReflect() protoreflect.Message {
mi := &file_communities_proto_msgTypes[33]
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 CommunitySharedAddressesRequest.ProtoReflect.Descriptor instead.
func (*CommunitySharedAddressesRequest) Descriptor() ([]byte, []int) {
return file_communities_proto_rawDescGZIP(), []int{33}
}
func (x *CommunitySharedAddressesRequest) GetCommunityId() []byte {
if x != nil {
return x.CommunityId
}
return nil
}
type CommunitySharedAddressesResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
CommunityId []byte `protobuf:"bytes,1,opt,name=community_id,json=communityId,proto3" json:"community_id,omitempty"`
RevealedAccounts []*RevealedAccount `protobuf:"bytes,3,rep,name=revealed_accounts,json=revealedAccounts,proto3" json:"revealed_accounts,omitempty"`
}
func (x *CommunitySharedAddressesResponse) Reset() {
*x = CommunitySharedAddressesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_communities_proto_msgTypes[34]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CommunitySharedAddressesResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CommunitySharedAddressesResponse) ProtoMessage() {}
func (x *CommunitySharedAddressesResponse) ProtoReflect() protoreflect.Message {
mi := &file_communities_proto_msgTypes[34]
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 CommunitySharedAddressesResponse.ProtoReflect.Descriptor instead.
func (*CommunitySharedAddressesResponse) Descriptor() ([]byte, []int) {
return file_communities_proto_rawDescGZIP(), []int{34}
}
func (x *CommunitySharedAddressesResponse) GetCommunityId() []byte {
if x != nil {
return x.CommunityId
}
return nil
}
func (x *CommunitySharedAddressesResponse) GetRevealedAccounts() []*RevealedAccount {
if x != nil {
return x.RevealedAccounts
}
return nil
}
var File_communities_proto protoreflect.FileDescriptor
var file_communities_proto_rawDesc = []byte{
@ -3267,9 +3369,22 @@ var file_communities_proto_rawDesc = []byte{
0x75, 0x6e, 0x69, 0x74, 0x79, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b,
0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f,
0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c,
0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x49, 0x64, 0x42, 0x0d, 0x5a,
0x0b, 0x2e, 0x2f, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x49, 0x64, 0x22, 0x44, 0x0a,
0x1f, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64,
0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74,
0x79, 0x49, 0x64, 0x22, 0x8d, 0x01, 0x0a, 0x20, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74,
0x79, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d,
0x75, 0x6e, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b,
0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x49, 0x64, 0x12, 0x46, 0x0a, 0x11, 0x72,
0x65, 0x76, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73,
0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x52, 0x65, 0x76, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x52, 0x10, 0x72, 0x65, 0x76, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x73, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2f, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -3285,7 +3400,7 @@ func file_communities_proto_rawDescGZIP() []byte {
}
var file_communities_proto_enumTypes = make([]protoimpl.EnumInfo, 5)
var file_communities_proto_msgTypes = make([]protoimpl.MessageInfo, 44)
var file_communities_proto_msgTypes = make([]protoimpl.MessageInfo, 46)
var file_communities_proto_goTypes = []interface{}{
(CommunityMember_Roles)(0), // 0: protobuf.CommunityMember.Roles
(CommunityMember_ChannelRole)(0), // 1: protobuf.CommunityMember.ChannelRole
@ -3325,69 +3440,72 @@ var file_communities_proto_goTypes = []interface{}{
(*DeleteCommunityMemberMessages)(nil), // 35: protobuf.DeleteCommunityMemberMessages
(*CommunityUpdateGrant)(nil), // 36: protobuf.CommunityUpdateGrant
(*CommunityEncryptionKeysRequest)(nil), // 37: protobuf.CommunityEncryptionKeysRequest
nil, // 38: protobuf.CommunityTokenMetadata.ContractAddressesEntry
nil, // 39: protobuf.TokenCriteria.ContractAddressesEntry
nil, // 40: protobuf.CommunityDescription.MembersEntry
nil, // 41: protobuf.CommunityDescription.ChatsEntry
nil, // 42: protobuf.CommunityDescription.CategoriesEntry
nil, // 43: protobuf.CommunityDescription.TokenPermissionsEntry
nil, // 44: protobuf.CommunityDescription.BannedMembersEntry
nil, // 45: protobuf.CommunityDescription.PrivateDataEntry
nil, // 46: protobuf.CommunityChat.MembersEntry
nil, // 47: protobuf.WakuMessageArchiveIndex.ArchivesEntry
nil, // 48: protobuf.CommunityUpdateGrant.GrantsEntry
(CommunityTokenType)(0), // 49: protobuf.CommunityTokenType
(*ChatIdentity)(nil), // 50: protobuf.ChatIdentity
(*Shard)(nil), // 51: protobuf.Shard
(*CommunitySharedAddressesRequest)(nil), // 38: protobuf.CommunitySharedAddressesRequest
(*CommunitySharedAddressesResponse)(nil), // 39: protobuf.CommunitySharedAddressesResponse
nil, // 40: protobuf.CommunityTokenMetadata.ContractAddressesEntry
nil, // 41: protobuf.TokenCriteria.ContractAddressesEntry
nil, // 42: protobuf.CommunityDescription.MembersEntry
nil, // 43: protobuf.CommunityDescription.ChatsEntry
nil, // 44: protobuf.CommunityDescription.CategoriesEntry
nil, // 45: protobuf.CommunityDescription.TokenPermissionsEntry
nil, // 46: protobuf.CommunityDescription.BannedMembersEntry
nil, // 47: protobuf.CommunityDescription.PrivateDataEntry
nil, // 48: protobuf.CommunityChat.MembersEntry
nil, // 49: protobuf.WakuMessageArchiveIndex.ArchivesEntry
nil, // 50: protobuf.CommunityUpdateGrant.GrantsEntry
(CommunityTokenType)(0), // 51: protobuf.CommunityTokenType
(*ChatIdentity)(nil), // 52: protobuf.ChatIdentity
(*Shard)(nil), // 53: protobuf.Shard
}
var file_communities_proto_depIdxs = []int32{
0, // 0: protobuf.CommunityMember.roles:type_name -> protobuf.CommunityMember.Roles
17, // 1: protobuf.CommunityMember.revealed_accounts:type_name -> protobuf.RevealedAccount
1, // 2: protobuf.CommunityMember.channel_role:type_name -> protobuf.CommunityMember.ChannelRole
38, // 3: protobuf.CommunityTokenMetadata.contract_addresses:type_name -> protobuf.CommunityTokenMetadata.ContractAddressesEntry
49, // 4: protobuf.CommunityTokenMetadata.tokenType:type_name -> protobuf.CommunityTokenType
40, // 3: protobuf.CommunityTokenMetadata.contract_addresses:type_name -> protobuf.CommunityTokenMetadata.ContractAddressesEntry
51, // 4: protobuf.CommunityTokenMetadata.tokenType:type_name -> protobuf.CommunityTokenType
2, // 5: protobuf.CommunityTokenAction.action_type:type_name -> protobuf.CommunityTokenAction.ActionType
3, // 6: protobuf.CommunityPermissions.access:type_name -> protobuf.CommunityPermissions.Access
39, // 7: protobuf.TokenCriteria.contract_addresses:type_name -> protobuf.TokenCriteria.ContractAddressesEntry
49, // 8: protobuf.TokenCriteria.type:type_name -> protobuf.CommunityTokenType
41, // 7: protobuf.TokenCriteria.contract_addresses:type_name -> protobuf.TokenCriteria.ContractAddressesEntry
51, // 8: protobuf.TokenCriteria.type:type_name -> protobuf.CommunityTokenType
4, // 9: protobuf.CommunityTokenPermission.type:type_name -> protobuf.CommunityTokenPermission.Type
10, // 10: protobuf.CommunityTokenPermission.token_criteria:type_name -> protobuf.TokenCriteria
40, // 11: protobuf.CommunityDescription.members:type_name -> protobuf.CommunityDescription.MembersEntry
42, // 11: protobuf.CommunityDescription.members:type_name -> protobuf.CommunityDescription.MembersEntry
9, // 12: protobuf.CommunityDescription.permissions:type_name -> protobuf.CommunityPermissions
50, // 13: protobuf.CommunityDescription.identity:type_name -> protobuf.ChatIdentity
41, // 14: protobuf.CommunityDescription.chats:type_name -> protobuf.CommunityDescription.ChatsEntry
42, // 15: protobuf.CommunityDescription.categories:type_name -> protobuf.CommunityDescription.CategoriesEntry
52, // 13: protobuf.CommunityDescription.identity:type_name -> protobuf.ChatIdentity
43, // 14: protobuf.CommunityDescription.chats:type_name -> protobuf.CommunityDescription.ChatsEntry
44, // 15: protobuf.CommunityDescription.categories:type_name -> protobuf.CommunityDescription.CategoriesEntry
14, // 16: protobuf.CommunityDescription.admin_settings:type_name -> protobuf.CommunityAdminSettings
43, // 17: protobuf.CommunityDescription.token_permissions:type_name -> protobuf.CommunityDescription.TokenPermissionsEntry
45, // 17: protobuf.CommunityDescription.token_permissions:type_name -> protobuf.CommunityDescription.TokenPermissionsEntry
7, // 18: protobuf.CommunityDescription.community_tokens_metadata:type_name -> protobuf.CommunityTokenMetadata
44, // 19: protobuf.CommunityDescription.banned_members:type_name -> protobuf.CommunityDescription.BannedMembersEntry
45, // 20: protobuf.CommunityDescription.privateData:type_name -> protobuf.CommunityDescription.PrivateDataEntry
46, // 21: protobuf.CommunityChat.members:type_name -> protobuf.CommunityChat.MembersEntry
46, // 19: protobuf.CommunityDescription.banned_members:type_name -> protobuf.CommunityDescription.BannedMembersEntry
47, // 20: protobuf.CommunityDescription.privateData:type_name -> protobuf.CommunityDescription.PrivateDataEntry
48, // 21: protobuf.CommunityChat.members:type_name -> protobuf.CommunityChat.MembersEntry
9, // 22: protobuf.CommunityChat.permissions:type_name -> protobuf.CommunityPermissions
50, // 23: protobuf.CommunityChat.identity:type_name -> protobuf.ChatIdentity
52, // 23: protobuf.CommunityChat.identity:type_name -> protobuf.ChatIdentity
17, // 24: protobuf.CommunityRequestToJoin.revealed_accounts:type_name -> protobuf.RevealedAccount
17, // 25: protobuf.CommunityEditSharedAddresses.revealed_accounts:type_name -> protobuf.RevealedAccount
12, // 26: protobuf.CommunityRequestToJoinResponse.community:type_name -> protobuf.CommunityDescription
51, // 27: protobuf.CommunityRequestToJoinResponse.shard:type_name -> protobuf.Shard
53, // 27: protobuf.CommunityRequestToJoinResponse.shard:type_name -> protobuf.Shard
26, // 28: protobuf.WakuMessageArchive.metadata:type_name -> protobuf.WakuMessageArchiveMetadata
25, // 29: protobuf.WakuMessageArchive.messages:type_name -> protobuf.WakuMessage
26, // 30: protobuf.WakuMessageArchiveIndexMetadata.metadata:type_name -> protobuf.WakuMessageArchiveMetadata
47, // 31: protobuf.WakuMessageArchiveIndex.archives:type_name -> protobuf.WakuMessageArchiveIndex.ArchivesEntry
49, // 31: protobuf.WakuMessageArchiveIndex.archives:type_name -> protobuf.WakuMessageArchiveIndex.ArchivesEntry
32, // 32: protobuf.CommunityStorenodes.storenodes:type_name -> protobuf.Storenode
34, // 33: protobuf.DeleteCommunityMemberMessages.messages:type_name -> protobuf.DeleteCommunityMemberMessage
48, // 34: protobuf.CommunityUpdateGrant.grants:type_name -> protobuf.CommunityUpdateGrant.GrantsEntry
6, // 35: protobuf.CommunityDescription.MembersEntry.value:type_name -> protobuf.CommunityMember
15, // 36: protobuf.CommunityDescription.ChatsEntry.value:type_name -> protobuf.CommunityChat
16, // 37: protobuf.CommunityDescription.CategoriesEntry.value:type_name -> protobuf.CommunityCategory
11, // 38: protobuf.CommunityDescription.TokenPermissionsEntry.value:type_name -> protobuf.CommunityTokenPermission
13, // 39: protobuf.CommunityDescription.BannedMembersEntry.value:type_name -> protobuf.CommunityBanInfo
6, // 40: protobuf.CommunityChat.MembersEntry.value:type_name -> protobuf.CommunityMember
28, // 41: protobuf.WakuMessageArchiveIndex.ArchivesEntry.value:type_name -> protobuf.WakuMessageArchiveIndexMetadata
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
50, // 34: protobuf.CommunityUpdateGrant.grants:type_name -> protobuf.CommunityUpdateGrant.GrantsEntry
17, // 35: protobuf.CommunitySharedAddressesResponse.revealed_accounts:type_name -> protobuf.RevealedAccount
6, // 36: protobuf.CommunityDescription.MembersEntry.value:type_name -> protobuf.CommunityMember
15, // 37: protobuf.CommunityDescription.ChatsEntry.value:type_name -> protobuf.CommunityChat
16, // 38: protobuf.CommunityDescription.CategoriesEntry.value:type_name -> protobuf.CommunityCategory
11, // 39: protobuf.CommunityDescription.TokenPermissionsEntry.value:type_name -> protobuf.CommunityTokenPermission
13, // 40: protobuf.CommunityDescription.BannedMembersEntry.value:type_name -> protobuf.CommunityBanInfo
6, // 41: protobuf.CommunityChat.MembersEntry.value:type_name -> protobuf.CommunityMember
28, // 42: protobuf.WakuMessageArchiveIndex.ArchivesEntry.value:type_name -> protobuf.WakuMessageArchiveIndexMetadata
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_communities_proto_init() }
@ -3795,6 +3913,30 @@ func file_communities_proto_init() {
return nil
}
}
file_communities_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CommunitySharedAddressesRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_communities_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CommunitySharedAddressesResponse); 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{
@ -3802,7 +3944,7 @@ func file_communities_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_communities_proto_rawDesc,
NumEnums: 5,
NumMessages: 44,
NumMessages: 46,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -295,3 +295,12 @@ message CommunityUpdateGrant {
message CommunityEncryptionKeysRequest {
bytes community_id = 1;
}
message CommunitySharedAddressesRequest {
bytes community_id = 1;
}
message CommunitySharedAddressesResponse {
bytes community_id = 1;
repeated RevealedAccount revealed_accounts = 3;
}