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
Automate
Agent sessions
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
4e555580
Commit
4e555580
authored
Oct 21, 2020
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
initial version of contact
parent
c4799479
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bindings/contact.go
+75
-0
75 additions, 0 deletions
bindings/contact.go
interfaces/params/CMIX.go
+1
-1
1 addition, 1 deletion
interfaces/params/CMIX.go
with
76 additions
and
1 deletion
bindings/contact.go
0 → 100644
+
75
−
0
View file @
4e555580
package
bindings
import
(
"encoding/json"
"errors"
"gitlab.com/elixxir/client/interfaces/contact"
)
/* fact object*/
type
Fact
struct
{
f
*
contact
.
Fact
}
func
(
f
*
Fact
)
Get
()
string
{
return
f
.
f
.
Fact
}
func
(
f
*
Fact
)
Type
()
int
{
return
int
(
f
.
f
.
T
)
}
/* contact object*/
type
Contact
struct
{
c
*
contact
.
Contact
}
// GetID returns the user ID for this user.
func
(
c
*
Contact
)
GetID
()
[]
byte
{
return
c
.
c
.
ID
.
Bytes
()
}
// GetDHPublicKey returns the public key associated with the Contact.
func
(
c
*
Contact
)
GetDHPublicKey
()
[]
byte
{
return
c
.
c
.
DhPubKey
.
Bytes
()
}
// GetDHPublicKey returns hash of a DH proof of key ownership.
func
(
c
*
Contact
)
GetOwnershipProof
()
[]
byte
{
return
c
.
c
.
OwnershipProof
}
// Returns a fact list for adding and getting facts to and from the contact
func
(
c
*
Contact
)
GetFactList
()
*
FactList
{
return
&
FactList
{
c
:
c
.
c
}
}
type
FactList
struct
{
c
*
contact
.
Contact
}
func
(
fl
*
FactList
)
Num
()
int
{
return
len
(
fl
.
c
.
Facts
)
}
func
(
fl
*
FactList
)
Get
(
i
int
)
Fact
{
return
Fact
{
f
:
&
(
fl
.
c
.
Facts
)[
i
]}
}
func
(
fl
*
FactList
)
Add
(
fact
string
,
factType
int
)
error
{
ft
:=
contact
.
FactType
(
factType
)
if
!
ft
.
IsValid
()
{
return
errors
.
New
(
"Invalid fact type"
)
}
fl
.
c
.
Facts
=
append
(
fl
.
c
.
Facts
,
contact
.
Fact
{
Fact
:
fact
,
T
:
ft
,
})
return
nil
}
func
(
fl
*
FactList
)
Marshal
()
([]
byte
,
error
)
{
return
json
.
Marshal
(
&
fl
.
c
.
Facts
)
}
func
unmarshalFactList
This diff is collapsed.
Click to expand it.
interfaces/params/CMIX.go
+
1
−
1
View file @
4e555580
...
...
@@ -12,7 +12,7 @@ type CMIX struct {
func
GetDefaultCMIX
()
CMIX
{
return
CMIX
{
RoundTries
:
3
,
Timeout
:
10
*
time
.
Second
,
Timeout
:
25
*
time
.
Second
,
RetryDelay
:
2
*
time
.
Second
,
}
}
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
sign in
to comment