Documentation ¶
Index ¶
- Constants
- Variables
- type GroupChat
- type MessageReceive
- type Processor
- type ReceiveCallback
- type Request
- func (*Request) Descriptor() ([]byte, []int)deprecated
- func (x *Request) GetCreated() int64
- func (x *Request) GetIdPreimage() []byte
- func (x *Request) GetKeyPreimage() []byte
- func (x *Request) GetMembers() []byte
- func (x *Request) GetMessage() []byte
- func (x *Request) GetName() []byte
- func (*Request) ProtoMessage()
- func (x *Request) ProtoReflect() protoreflect.Message
- func (x *Request) Reset()
- func (x *Request) String() string
- type RequestCallback
- type RequestStatus
- type Wrapper
- func (w *Wrapper) GetGroup(groupID *id.ID) (gs.Group, bool)
- func (w *Wrapper) GetGroups() []*id.ID
- func (w *Wrapper) JoinGroup(grp gs.Group) error
- func (w *Wrapper) LeaveGroup(groupID *id.ID) error
- func (w *Wrapper) MakeGroup(membership []*id.ID, name, message []byte) (gs.Group, []id.Round, RequestStatus, error)
- func (w *Wrapper) NumGroups() int
- func (w *Wrapper) ResendRequest(groupID *id.ID) ([]id.Round, RequestStatus, error)
- func (w *Wrapper) Send(groupID *id.ID, message []byte, tag string) (rounds.Round, time.Time, group.MessageID, error)
Constants ¶
const MaxInitMessageSize = 256
MaxInitMessageSize is the maximum allowable length of the initial message sent in a group request.
Variables ¶
var File_gcMessages_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type GroupChat ¶
type GroupChat interface { // MakeGroup sends GroupChat requests to all members over an authenticated // channel. The leader of a GroupChat must have an authenticated channel // with each member of the GroupChat to add them to the GroupChat. It blocks // until all the GroupChat requests are sent. Returns the new group and the // round IDs the requests were sent on. Returns an error if at least one // request to a member fails to send. Also returns the status of the sent // requests. MakeGroup(membership []*id.ID, name, message []byte) (gs.Group, []id.Round, RequestStatus, error) // ResendRequest allows a GroupChat request to be sent again. It returns // the rounds that the requests were sent on and the status of the send. ResendRequest(groupID *id.ID) ([]id.Round, RequestStatus, error) // JoinGroup allows a user to accept a GroupChat request and stores the // GroupChat as active to allow receiving and sending of messages from/to // the GroupChat. A user can only join a GroupChat once. JoinGroup(g gs.Group) error // LeaveGroup removes a group from a list of groups the user is a part of. LeaveGroup(groupID *id.ID) error // Send sends a message to all GroupChat members using Cmix.SendManyCMIX. // The send fails if the message is too long. Returns the ID of the round // sent on and the timestamp of the message send. Send(groupID *id.ID, tag string, message []byte) ( rounds.Round, time.Time, group.MessageID, error) // GetGroups returns a list of all registered GroupChat IDs. GetGroups() []*id.ID // GetGroup returns the group with the matching ID or returns false if none // exist. GetGroup(groupID *id.ID) (gs.Group, bool) // NumGroups returns the number of groups the user is a part of. NumGroups() int // AddService adds a service for all group chat partners of the given tag, // which will call back on the given processor. AddService(tag string, p Processor) error // RemoveService removes all services for the given tag. RemoveService(tag string) error }
GroupChat is used to send and receive cMix messages to/from multiple users.
func NewManager ¶
func NewManager(user groupE2e, requestFunc RequestCallback, receiveFunc Processor) (GroupChat, error)
NewManager creates a new group chat manager
type MessageReceive ¶
type MessageReceive struct { GroupID *id.ID ID group.MessageID Payload []byte SenderID *id.ID Timestamp time.Time }
MessageReceive contains the GroupChat message and associated data that a user receives when getting a group message.
func (MessageReceive) String ¶
func (mr MessageReceive) String() string
String returns the MessageReceive as readable text. This functions adheres to the fmt.Stringer interface.
type Processor ¶
type Processor interface { // Process decrypts and hands off the message to its internal down stream // message processing system. Process(decryptedMsg MessageReceive, msg format.Message, receptionID receptionID.EphemeralIdentity, round rounds.Round) // Stringer interface for debugging. fmt.Stringer }
Processor manages the handling of received group chat messages.
type ReceiveCallback ¶
type ReceiveCallback func(msg MessageReceive)
ReceiveCallback is called when a GroupChat message is received.
type Request ¶
type Request struct { Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` IdPreimage []byte `protobuf:"bytes,2,opt,name=idPreimage,proto3" json:"idPreimage,omitempty"` KeyPreimage []byte `protobuf:"bytes,3,opt,name=keyPreimage,proto3" json:"keyPreimage,omitempty"` Members []byte `protobuf:"bytes,4,opt,name=members,proto3" json:"members,omitempty"` Message []byte `protobuf:"bytes,5,opt,name=message,proto3" json:"message,omitempty"` Created int64 `protobuf:"varint,6,opt,name=created,proto3" json:"created,omitempty"` // contains filtered or unexported fields }
Request to join the group sent from leader to all members.
func (*Request) Descriptor
deprecated
func (*Request) GetCreated ¶
func (*Request) GetIdPreimage ¶
func (*Request) GetKeyPreimage ¶
func (*Request) GetMembers ¶
func (*Request) GetMessage ¶
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) ProtoReflect ¶
func (x *Request) ProtoReflect() protoreflect.Message
type RequestCallback ¶
RequestCallback is called when a GroupChat request is received.
type RequestStatus ¶
type RequestStatus int
RequestStatus signals the status of the group requests on group creation.
const ( NotSent RequestStatus = iota // Error occurred before sending requests AllFail // Sending of all requests failed PartialSent // Sending of some request failed AllSent // Sending of all request succeeded )
func (RequestStatus) Message ¶
func (rs RequestStatus) Message() string
Message prints a full description of the status code.
func (RequestStatus) String ¶
func (rs RequestStatus) String() string
String prints the description of the status code. This functions satisfies the fmt.Stringer interface.
type Wrapper ¶
type Wrapper struct {
// contains filtered or unexported fields
}
Wrapper handles the sending and receiving of group chat using E2E messages to inform the recipient of incoming group chat messages.
func NewWrapper ¶
NewWrapper constructs a wrapper around the GroupChat interface.
func (*Wrapper) LeaveGroup ¶
LeaveGroup calls GroupChat.LeaveGroup.
func (*Wrapper) MakeGroup ¶
func (w *Wrapper) MakeGroup(membership []*id.ID, name, message []byte) ( gs.Group, []id.Round, RequestStatus, error)
MakeGroup calls GroupChat.MakeGroup.
func (*Wrapper) ResendRequest ¶
ResendRequest calls GroupChat.ResendRequest.