mirror of
https://github.com/status-im/status-go.git
synced 2025-01-10 06:36:32 +00:00
ba5ed725ce
- use protected topics for communities - associate chats to pubsub topics and populate these depending if the chat belongs to a community or not - mailserver functions should be aware of pubsub topics - generate private key for pubsub topic protection when creating a community - add shard cluster and index to communities - setup shards for existing communities - distribute pubsubtopic password - fix: do not send the requests to join and cancel in the protected topic - fix: undefined shard values for backward compatibility - refactor: use shard message in protobuffers
31 lines
735 B
Go
31 lines
735 B
Go
package requests
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/status-im/status-go/eth-node/types"
|
|
"github.com/status-im/status-go/protocol/common"
|
|
)
|
|
|
|
type SetCommunityShard struct {
|
|
CommunityID types.HexBytes `json:"communityId"`
|
|
Shard *common.Shard `json:"shard,omitempty"`
|
|
PrivateKey *types.HexBytes `json:"privateKey,omitempty"`
|
|
}
|
|
|
|
func (s *SetCommunityShard) Validate() error {
|
|
if s == nil {
|
|
return errors.New("invalid request")
|
|
}
|
|
if s.Shard != nil {
|
|
// TODO: for now only MainStatusShard(16) is accepted
|
|
if s.Shard.Cluster != common.MainStatusShard {
|
|
return errors.New("invalid shard cluster")
|
|
}
|
|
if s.Shard.Index > 1023 {
|
|
return errors.New("invalid shard index. Only 0-1023 is allowed")
|
|
}
|
|
}
|
|
return nil
|
|
}
|