Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
f54ff3c5
Commit
f54ff3c5
authored
2 years ago
by
Jono Wenger
Committed by
Jake Taylor
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
XX-4015 / Fix Group Chat MakeGroup
parent
c54ce718
No related branches found
No related tags found
2 merge requests
!510
Release
,
!326
XX-4015 / Fix Group Chat MakeGroup
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
bindings/backup.go
+10
-3
10 additions, 3 deletions
bindings/backup.go
bindings/e2eHandler.go
+4
-5
4 additions, 5 deletions
bindings/e2eHandler.go
bindings/group.go
+12
-11
12 additions, 11 deletions
bindings/group.go
bindings/identity.go
+0
-37
0 additions, 37 deletions
bindings/identity.go
with
26 additions
and
56 deletions
bindings/backup.go
+
10
−
3
View file @
f54ff3c5
...
@@ -10,6 +10,7 @@ package bindings
...
@@ -10,6 +10,7 @@ package bindings
import
(
import
(
"encoding/json"
"encoding/json"
"gitlab.com/elixxir/client/backup"
"gitlab.com/elixxir/client/backup"
"gitlab.com/xx_network/primitives/id"
)
)
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
...
@@ -26,10 +27,16 @@ type Backup struct {
...
@@ -26,10 +27,16 @@ type Backup struct {
// NewCmixFromBackup.
// NewCmixFromBackup.
//
//
// Example BackupReport:
// Example BackupReport:
//{"RestoredContacts":["0AeVYBe87SV45A2UI4AtIe6H4AIyZSLPBPrT6eTBLycD"],"Params":""}
// {
// "RestoredContacts": [
// "U4x/lrFkvxuXu59LtHLon1sUhPJSCcnZND6SugndnVID",
// "15tNdkKbYXoMn58NO6VbDMDWFEyIhTWEGsvgcJsHWAgD"
// ],
// "Params": ""
// }
type
BackupReport
struct
{
type
BackupReport
struct
{
// The list of restored E2E partner IDs
// The list of restored E2E partner IDs
RestoredContacts
IdList
RestoredContacts
[]
*
id
.
ID
// The backup parameters found within the backup file
// The backup parameters found within the backup file
Params
string
Params
string
...
@@ -70,7 +77,7 @@ func NewCmixFromBackup(ndfJSON, storageDir, backupPassphrase string,
...
@@ -70,7 +77,7 @@ func NewCmixFromBackup(ndfJSON, storageDir, backupPassphrase string,
// Construct report
// Construct report
report
:=
BackupReport
{
report
:=
BackupReport
{
RestoredContacts
:
makeIdList
(
backupIdList
)
,
RestoredContacts
:
backupIdList
,
Params
:
backupParams
,
Params
:
backupParams
,
}
}
...
...
This diff is collapsed.
Click to expand it.
bindings/e2eHandler.go
+
4
−
5
View file @
f54ff3c5
...
@@ -41,14 +41,13 @@ func (e *E2e) GetReceptionID() []byte {
...
@@ -41,14 +41,13 @@ func (e *E2e) GetReceptionID() []byte {
return
e
.
api
.
GetE2E
()
.
GetReceptionID
()
.
Marshal
()
return
e
.
api
.
GetE2E
()
.
GetReceptionID
()
.
Marshal
()
}
}
// GetAllPartnerIDs returns a
marshalled
list of all partner IDs that the user
// GetAllPartnerIDs returns a list of all partner IDs that the user
has an E2E
//
has an E2E
relationship with.
// relationship with.
//
//
// Returns:
// Returns:
// - []byte - the marshalled bytes of
the IdList object
.
// - []byte - the marshalled bytes of
[]*id.ID
.
func
(
e
*
E2e
)
GetAllPartnerIDs
()
([]
byte
,
error
)
{
func
(
e
*
E2e
)
GetAllPartnerIDs
()
([]
byte
,
error
)
{
partnerIds
:=
e
.
api
.
GetE2E
()
.
GetAllPartnerIDs
()
return
json
.
Marshal
(
e
.
api
.
GetE2E
()
.
GetAllPartnerIDs
())
return
json
.
Marshal
(
makeIdList
(
partnerIds
))
}
}
// PayloadSize returns the max payload size for a partitionable E2E message.
// PayloadSize returns the max payload size for a partitionable E2E message.
...
...
This diff is collapsed.
Click to expand it.
bindings/group.go
+
12
−
11
View file @
f54ff3c5
...
@@ -125,21 +125,24 @@ func NewGroupChat(e2eID int,
...
@@ -125,21 +125,24 @@ func NewGroupChat(e2eID int,
// group.
// group.
//
//
// Parameters:
// Parameters:
// - membership - IDs of members the user wants in the group.
// - membershipBytes - the JSON marshalled list of []*id.ID; it contains the
// IDs of members the user wants to add to the group.
// - message - the initial message sent to all members in the group. This is an
// - message - the initial message sent to all members in the group. This is an
// optional parameter and may be nil.
// optional parameter and may be nil.
// - tag - the name of the group decided by the creator. This is an optional parameter
// - tag - the name of the group decided by the creator. This is an optional
// and may be nil. If nil the group will be assigned the default name.
// parameter and may be nil. If nil the group will be assigned the default
// name.
//
//
// Returns:
// Returns:
// - []byte - the JSON marshalled bytes of the GroupReport object, which can be
// - []byte - the JSON marshalled bytes of the GroupReport object, which can be
// passed into WaitForRoundResult to see if the group request message send
// passed into WaitForRoundResult to see if the group request message send
// succeeded.
// succeeded.
func
(
g
*
GroupChat
)
MakeGroup
(
membership
IdList
,
message
,
name
[]
byte
)
(
func
(
g
*
GroupChat
)
MakeGroup
(
membership
Bytes
[]
byte
,
message
,
name
[]
byte
)
(
[]
byte
,
error
)
{
[]
byte
,
error
)
{
// Construct membership list into a list of []*id.Id
// Unmarshal membership list into a list of []*id.Id
members
,
err
:=
deserializeIdList
(
membership
)
var
members
[]
*
id
.
ID
err
:=
json
.
Unmarshal
(
membershipBytes
,
&
members
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -275,14 +278,12 @@ func (g *GroupChat) Send(groupId,
...
@@ -275,14 +278,12 @@ func (g *GroupChat) Send(groupId,
return
json
.
Marshal
(
sendReport
)
return
json
.
Marshal
(
sendReport
)
}
}
// GetGroups returns
an IdList containing
a list of group IDs that the user is a member of.
// GetGroups returns a list of group IDs that the user is a member of.
//
//
// Returns:
// Returns:
// - []byte - a JSON marshalled
IdList
representing all group ID's.
// - []byte - a JSON marshalled
[]*id.ID
representing all group ID's.
func
(
g
*
GroupChat
)
GetGroups
()
([]
byte
,
error
)
{
func
(
g
*
GroupChat
)
GetGroups
()
([]
byte
,
error
)
{
groupIds
:=
makeIdList
(
g
.
m
.
GetGroups
())
return
json
.
Marshal
(
g
.
m
.
GetGroups
())
return
json
.
Marshal
(
groupIds
)
}
}
// GetGroup returns the group with the group ID. If no group exists, then the
// GetGroup returns the group with the group ID. If no group exists, then the
...
...
This diff is collapsed.
Click to expand it.
bindings/identity.go
+
0
−
37
View file @
f54ff3c5
...
@@ -9,8 +9,6 @@ package bindings
...
@@ -9,8 +9,6 @@ package bindings
import
(
import
(
"encoding/json"
"encoding/json"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/elixxir/client/xxdk"
"gitlab.com/elixxir/client/xxdk"
"gitlab.com/elixxir/crypto/contact"
"gitlab.com/elixxir/crypto/contact"
"gitlab.com/elixxir/primitives/fact"
"gitlab.com/elixxir/primitives/fact"
...
@@ -189,38 +187,3 @@ func GetFactsFromContact(marshaled []byte) ([]byte, error) {
...
@@ -189,38 +187,3 @@ func GetFactsFromContact(marshaled []byte) ([]byte, error) {
}
}
return
factsListMarshaled
,
nil
return
factsListMarshaled
,
nil
}
}
////////////////////////////////////////////////////////////////////////////////
// IdList Functions //
////////////////////////////////////////////////////////////////////////////////
// IdList is a wrapper for a list of marshalled id.ID objects.
type
IdList
struct
{
Ids
[][]
byte
}
// makeIdList is a helper function which creates an IdList object
// given a list of id.ID's. It serializes each element of the
// given list of id.ID's, places that into a list of []byte's (ie [][]byte)
// and places that in the IdList.
func
makeIdList
(
ids
[]
*
id
.
ID
)
IdList
{
convertedIds
:=
make
([][]
byte
,
len
(
ids
))
for
i
,
partnerId
:=
range
ids
{
convertedIds
[
i
]
=
partnerId
.
Marshal
()
}
return
IdList
{
Ids
:
convertedIds
}
}
// deserializeIdList is a helper function which creates a list of id.ID's
// given an IdList. It deserializes each element of the IdList using id.Unmarshal.
func
deserializeIdList
(
ids
IdList
)
([]
*
id
.
ID
,
error
)
{
convertedIds
:=
make
([]
*
id
.
ID
,
len
(
ids
.
Ids
))
for
i
,
serializedId
:=
range
ids
.
Ids
{
deserializedId
,
err
:=
id
.
Unmarshal
(
serializedId
)
if
err
!=
nil
{
return
nil
,
err
}
convertedIds
[
i
]
=
deserializedId
}
return
convertedIds
,
nil
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment