Documentation ¶
Index ¶
- Constants
- type DhKeyList
- type Group
- type Store
- func (s *Store) Add(g Group) error
- func (s *Store) Get(groupID *id.ID) (Group, bool)
- func (s *Store) GetByKeyFp(keyFp format.Fingerprint, salt [group.SaltLen]byte) (Group, bool)
- func (s *Store) GetUser() group.Member
- func (s *Store) GroupIDs() []*id.ID
- func (s *Store) Groups() []Group
- func (s *Store) Len() int
- func (s *Store) Remove(groupID *id.ID) error
- func (s *Store) SetUser(user group.Member, x interface{})
Constants ¶
const MaxGroupChats = 64
MaxGroupChats is the maximum number of group chats that a user can be a part of at once.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DhKeyList ¶
DhKeyList is a map of users to their DH key.
func DeserializeDhKeyList ¶
DeserializeDhKeyList deserializes the bytes into a DhKeyList.
func GenerateDhKeyList ¶
func GenerateDhKeyList(userID *id.ID, privKey *cyclic.Int, members group.Membership, grp *cyclic.Group) DhKeyList
GenerateDhKeyList generates the DH key between the user and all group members.
type Group ¶
type Group struct { Name []byte // Name of the group set by the user ID *id.ID // Group ID Key group.Key // Group key IdPreimage group.IdPreimage // 256-bit randomly generated value KeyPreimage group.KeyPreimage // 256-bit randomly generated value InitMessage []byte // The original invite message Created time.Time // Timestamp of when the group was created Members group.Membership // Sorted list of members in group DhKeys DhKeyList // List of shared DH keys }
Group contains the membership list, the cryptographic information, and the identifying information of a group chat.
func DeserializeGroup ¶
DeserializeGroup deserializes the bytes into a Group.
func NewGroup ¶
func NewGroup(name []byte, groupID *id.ID, groupKey group.Key, idPreimage group.IdPreimage, keyPreimage group.KeyPreimage, initMessage []byte, created time.Time, members group.Membership, dhKeys DhKeyList) Group
NewGroup creates a new Group from copies of the given data.
func (Group) GoString ¶
GoString returns all the Group's fields as text. This functions satisfies the fmt.GoStringer interface.
func (Group) Serialize ¶
Serialize serializes the Group and returns the byte slice. The serialized data follows the following format. +----------+----------+----------+----------+------------+-------------+-----------------+-------------+---------+-------------+----------+----------+ | Name len | Name | ID | Key | IdPreimage | KeyPreimage | InitMessage len | InitMessage | Created | Members len | Members | DhKeys | | 8 bytes | variable | 33 bytes | 32 bytes | 32 bytes | 32 bytes | 8 bytes | variable | 8 bytes | 8 bytes | variable | variable | +----------+----------+----------+----------+------------+-------------+-----------------+-------------+---------+-------------+----------+----------+
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store stores the list of Groups that a user is a part of.
func LoadStore ¶
LoadStore loads all the Groups from storage into memory and return them in a Store object.
func NewOrLoadStore ¶
NewOrLoadStore loads the group store from storage or makes a new one if it does not exist.
func (*Store) Add ¶
Add adds a new group to the group list and saves it to storage. An error is returned if the user has the max number of groups (MaxGroupChats).
func (*Store) Get ¶
Get returns the Group for the given group ID. Returns false if no Group is found.
func (*Store) GetByKeyFp ¶
GetByKeyFp returns the group with the matching key fingerprint and salt. Returns false if no group is found.