Documentation ¶
Index ¶
- Variables
- func ValidateCommunityDescription(desc *protobuf.CommunityDescription) error
- type Community
- func (o *Community) AcceptRequestToJoin(pk *ecdsa.PublicKey) (*protobuf.CommunityRequestJoinResponse, error)
- func (o *Community) CanPost(pk *ecdsa.PublicKey, chatID string, grantBytes []byte) (bool, error)
- func (o *Community) Chats() map[string]*protobuf.CommunityChat
- func (o *Community) CreateChat(chatID string, chat *protobuf.CommunityChat) (*CommunityChanges, error)
- func (o *Community) DeclineRequestToJoin(pk *ecdsa.PublicKey) (*protobuf.CommunityRequestJoinResponse, error)
- func (o *Community) DeleteChat(chatID string) (*protobuf.CommunityDescription, error)
- func (o *Community) HandleCommunityDescription(signer *ecdsa.PublicKey, description *protobuf.CommunityDescription, ...) (*CommunityChanges, error)
- func (o *Community) HandleRequestJoin(signer *ecdsa.PublicKey, request *protobuf.CommunityRequestJoin) error
- func (o *Community) HasMember(pk *ecdsa.PublicKey) bool
- func (o *Community) ID() []byte
- func (o *Community) IDString() string
- func (o *Community) InviteUserToChat(pk *ecdsa.PublicKey, chatID string) (*protobuf.CommunityInvitation, error)
- func (o *Community) InviteUserToOrg(pk *ecdsa.PublicKey) (*protobuf.CommunityInvitation, error)
- func (o *Community) IsAdmin() bool
- func (o *Community) IsMemberInChat(pk *ecdsa.PublicKey, chatID string) bool
- func (o *Community) Join()
- func (o *Community) Joined() bool
- func (o *Community) Leave()
- func (o *Community) MarshalJSON() ([]byte, error)
- func (o *Community) MarshaledDescription() ([]byte, error)
- func (o *Community) PrivateKey() *ecdsa.PrivateKey
- func (o *Community) RemoveUserFromChat(pk *ecdsa.PublicKey, chatID string) (*protobuf.CommunityDescription, error)
- func (o *Community) RemoveUserFromOrg(pk *ecdsa.PublicKey) (*protobuf.CommunityDescription, error)
- func (o *Community) ToBytes() ([]byte, error)
- func (o *Community) VerifyGrantSignature(data []byte) (*protobuf.Grant, error)
- type CommunityChanges
- type CommunityChatChanges
- type Config
- type Manager
- func (m *Manager) All() ([]*Community, error)
- func (m *Manager) CanPost(pk *ecdsa.PublicKey, orgIDString, chatID string, grant []byte) (bool, error)
- func (m *Manager) CreateChat(idString string, chat *protobuf.CommunityChat) (*Community, *CommunityChanges, error)
- func (m *Manager) CreateCommunity(description *protobuf.CommunityDescription) (*Community, error)
- func (m *Manager) Created() ([]*Community, error)
- func (m *Manager) ExportCommunity(idString string) (*ecdsa.PrivateKey, error)
- func (m *Manager) GetByIDString(idString string) (*Community, error)
- func (m *Manager) HandleCommunityDescriptionMessage(signer *ecdsa.PublicKey, description *protobuf.CommunityDescription, ...) (*Community, error)
- func (m *Manager) HandleCommunityInvitation(signer *ecdsa.PublicKey, invitation *protobuf.CommunityInvitation, ...) (*Community, error)
- func (m *Manager) HandleWrappedCommunityDescriptionMessage(payload []byte) (*Community, error)
- func (m *Manager) ImportCommunity(key *ecdsa.PrivateKey) (*Community, error)
- func (m *Manager) InviteUserToCommunity(idString string, pk *ecdsa.PublicKey) (*Community, error)
- func (m *Manager) JoinCommunity(idString string) (*Community, error)
- func (m *Manager) Joined() ([]*Community, error)
- func (m *Manager) LeaveCommunity(idString string) (*Community, error)
- func (m *Manager) RemoveUserFromCommunity(idString string, pk *ecdsa.PublicKey) (*Community, error)
- func (m *Manager) Stop() error
- func (m *Manager) Subscribe() chan *Subscription
- type Persistence
- func (p *Persistence) AllCommunities() ([]*Community, error)
- func (p *Persistence) CreatedCommunities() ([]*Community, error)
- func (p *Persistence) GetByID(id []byte) (*Community, error)
- func (p *Persistence) JoinedCommunities() ([]*Community, error)
- func (p *Persistence) SaveCommunity(community *Community) error
- type Subscription
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCantRequestAccess = errors.New("can't request access")
View Source
var ErrChatAlreadyExists = errors.New("chat already exists")
View Source
var ErrChatNotFound = errors.New("chat not found")
View Source
var ErrInvalidCommunityDescription = errors.New("invalid community description")
View Source
var ErrInvalidCommunityDescriptionMemberInChatButNotInOrg = errors.New("invalid community description member in chat but not in org")
View Source
var ErrInvalidCommunityDescriptionNoChatPermissions = errors.New("invalid community description no chat permissions")
View Source
var ErrInvalidCommunityDescriptionNoOrgPermissions = errors.New("invalid community description no org permissions")
View Source
var ErrInvalidCommunityDescriptionUnknownChatAccess = errors.New("invalid community description unknown chat access")
View Source
var ErrInvalidCommunityDescriptionUnknownOrgAccess = errors.New("invalid community description unknown org access")
View Source
var ErrInvalidGrant = errors.New("invalid grant")
View Source
var ErrInvalidMessage = errors.New("invalid community description message")
View Source
var ErrNotAdmin = errors.New("no admin privileges for this community")
View Source
var ErrNotAuthorized = errors.New("not authorized")
View Source
var ErrOrgNotFound = errors.New("community not found")
Functions ¶
func ValidateCommunityDescription ¶
func ValidateCommunityDescription(desc *protobuf.CommunityDescription) error
Types ¶
type Community ¶
type Community struct {
// contains filtered or unexported fields
}
func (*Community) AcceptRequestToJoin ¶
func (o *Community) AcceptRequestToJoin(pk *ecdsa.PublicKey) (*protobuf.CommunityRequestJoinResponse, error)
TODO: this should accept a request from a user to join and perform any validation
func (*Community) CreateChat ¶
func (o *Community) CreateChat(chatID string, chat *protobuf.CommunityChat) (*CommunityChanges, error)
func (*Community) DeclineRequestToJoin ¶
func (o *Community) DeclineRequestToJoin(pk *ecdsa.PublicKey) (*protobuf.CommunityRequestJoinResponse, error)
TODO: this should decline a request from a user to join
func (*Community) DeleteChat ¶
func (o *Community) DeleteChat(chatID string) (*protobuf.CommunityDescription, error)
func (*Community) HandleCommunityDescription ¶
func (o *Community) HandleCommunityDescription(signer *ecdsa.PublicKey, description *protobuf.CommunityDescription, rawMessage []byte) (*CommunityChanges, error)
func (*Community) HandleRequestJoin ¶
func (o *Community) HandleRequestJoin(signer *ecdsa.PublicKey, request *protobuf.CommunityRequestJoin) error
HandleRequestJoin handles a request, checks that the right permissions are applied and returns an CommunityRequestJoinResponse
func (*Community) InviteUserToChat ¶
func (*Community) InviteUserToOrg ¶
func (*Community) IsMemberInChat ¶
func (*Community) MarshalJSON ¶
func (*Community) MarshaledDescription ¶
func (*Community) PrivateKey ¶
func (o *Community) PrivateKey() *ecdsa.PrivateKey
func (*Community) RemoveUserFromChat ¶
func (*Community) RemoveUserFromOrg ¶
type CommunityChanges ¶
type CommunityChanges struct { MembersAdded map[string]*protobuf.CommunityMember MembersRemoved map[string]*protobuf.CommunityMember ChatsRemoved map[string]*protobuf.CommunityChat ChatsAdded map[string]*protobuf.CommunityChat ChatsModified map[string]*CommunityChatChanges }
type CommunityChatChanges ¶
type CommunityChatChanges struct { MembersAdded map[string]*protobuf.CommunityMember MembersRemoved map[string]*protobuf.CommunityMember }
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) CreateChat ¶
func (m *Manager) CreateChat(idString string, chat *protobuf.CommunityChat) (*Community, *CommunityChanges, error)
func (*Manager) CreateCommunity ¶
func (m *Manager) CreateCommunity(description *protobuf.CommunityDescription) (*Community, error)
CreateCommunity takes a description, generates an ID for it, saves it and return it
func (*Manager) ExportCommunity ¶
func (m *Manager) ExportCommunity(idString string) (*ecdsa.PrivateKey, error)
func (*Manager) GetByIDString ¶
func (*Manager) HandleCommunityDescriptionMessage ¶
func (*Manager) HandleCommunityInvitation ¶
func (m *Manager) HandleCommunityInvitation(signer *ecdsa.PublicKey, invitation *protobuf.CommunityInvitation, payload []byte) (*Community, error)
TODO: Finish implementing this
func (*Manager) HandleWrappedCommunityDescriptionMessage ¶
func (*Manager) ImportCommunity ¶
func (m *Manager) ImportCommunity(key *ecdsa.PrivateKey) (*Community, error)
func (*Manager) InviteUserToCommunity ¶
func (*Manager) JoinCommunity ¶
func (*Manager) LeaveCommunity ¶
func (*Manager) RemoveUserFromCommunity ¶
func (*Manager) Subscribe ¶
func (m *Manager) Subscribe() chan *Subscription
type Persistence ¶
type Persistence struct {
// contains filtered or unexported fields
}
func (*Persistence) AllCommunities ¶
func (p *Persistence) AllCommunities() ([]*Community, error)
func (*Persistence) CreatedCommunities ¶
func (p *Persistence) CreatedCommunities() ([]*Community, error)
func (*Persistence) JoinedCommunities ¶
func (p *Persistence) JoinedCommunities() ([]*Community, error)
func (*Persistence) SaveCommunity ¶
func (p *Persistence) SaveCommunity(community *Community) error
type Subscription ¶
type Subscription struct { Community *Community Invitation *protobuf.CommunityInvitation }
Click to show internal directories.
Click to hide internal directories.