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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
59b65fca
Commit
59b65fca
authored
Feb 21, 2022
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
cleanup comments
parent
b35c5f63
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!170
Release
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bindings/ud.go
+10
-11
10 additions, 11 deletions
bindings/ud.go
cmd/ud.go
+2
-1
2 additions, 1 deletion
cmd/ud.go
with
12 additions
and
12 deletions
bindings/ud.go
+
10
−
11
View file @
59b65fca
...
...
@@ -19,12 +19,11 @@ import (
// This package wraps the user discovery system
// User Discovery object
type
UserDiscovery
struct
{
ud
*
ud
.
Manager
}
//
R
eturns a new user discovery object. Only call this once. It must be called
//
NewUserDiscovery r
eturns a new user discovery object. Only call this once. It must be called
// after StartNetworkFollower is called and will fail if the network has never
// been contacted.
// This function technically has a memory leak because it causes both sides of
...
...
@@ -55,7 +54,7 @@ func (ud *UserDiscovery) Register(username string) error {
return
ud
.
ud
.
Register
(
username
)
}
// Adds a fact for the user to user discovery. Will only succeed if the
// Add
Fact add
s a fact for the user to user discovery. Will only succeed if the
// user is already registered and the system does not have the fact currently
// registered for any user.
// Will fail if the fact string is not well formed.
...
...
@@ -73,14 +72,14 @@ func (ud *UserDiscovery) AddFact(fStr string) (string, error) {
return
ud
.
ud
.
SendRegisterFact
(
f
)
}
// Confirms a fact first registered via AddFact. The confirmation ID comes from
// Confirm
Fact confirm
s a fact first registered via AddFact. The confirmation ID comes from
// AddFact while the code will come over the associated communications system
func
(
ud
*
UserDiscovery
)
ConfirmFact
(
confirmationID
,
code
string
)
error
{
return
ud
.
ud
.
SendConfirmFact
(
confirmationID
,
code
)
}
// Removes a previously confirmed fact. Will fail if the passed fact string is
// not well
formed or if the fact is not associated with this client.
// Remove
Fact remove
s a previously confirmed fact. Will fail if the passed fact string is
// not well
-
formed or if the fact is not associated with this client.
// Users cannot remove username facts and must instead remove the user.
func
(
ud
*
UserDiscovery
)
RemoveFact
(
fStr
string
)
error
{
f
,
err
:=
fact
.
UnstringifyFact
(
fStr
)
...
...
@@ -108,7 +107,7 @@ type SearchCallback interface {
Callback
(
contacts
*
ContactList
,
error
string
)
}
// Search
es
for the passed Facts. The factList is the stringification of a
// Search for the passed Facts. The factList is the stringification of a
// fact list object, look at /bindings/list.go for more on that object.
// This will reject if that object is malformed. The SearchCallback will return
// a list of contacts, each having the facts it hit against.
...
...
@@ -141,7 +140,7 @@ type SingleSearchCallback interface {
Callback
(
contact
*
Contact
,
error
string
)
}
// Searches for the passed Facts. The fact is the stringification of a
// Search
Single search
es for the passed Facts. The fact is the stringification of a
// fact object, look at /bindings/contact.go for more on that object.
// This will reject if that object is malformed. The SearchCallback will return
// a list of contacts, each having the facts it hit against.
...
...
@@ -173,7 +172,7 @@ type LookupCallback interface {
Callback
(
contact
*
Contact
,
error
string
)
}
// Look
s for
the contact object associated with the given userID. The
// Look
up
the contact object associated with the given userID. The
// id is the byte representation of an id.
// This will reject if that id is malformed. The LookupCallback will return
// the associated contact if it exists.
...
...
@@ -202,7 +201,7 @@ func (ud UserDiscovery) Lookup(idBytes []byte, callback LookupCallback,
}
// MultiLookupCallback returns the result of many paralel lookups
// MultiLookupCallback returns the result of many paral
l
el lookups
type
MultiLookupCallback
interface
{
Callback
(
Succeeded
*
ContactList
,
failed
*
IdList
,
errors
string
)
}
...
...
This diff is collapsed.
Click to expand it.
cmd/ud.go
+
2
−
1
View file @
59b65fca
...
...
@@ -127,7 +127,6 @@ var udCmd = &cobra.Command{
confirmID
:=
viper
.
GetString
(
"confirm"
)
if
confirmID
!=
""
{
// TODO: Lookup code
err
=
userDiscoveryMgr
.
SendConfirmFact
(
confirmID
,
confirmID
)
if
err
!=
nil
{
fmt
.
Printf
(
"Couldn't confirm fact: %s
\n
"
,
...
...
@@ -136,6 +135,8 @@ var udCmd = &cobra.Command{
}
}
// Handle lookup (verification) process
// Note: Cryptographic verification occurs above the bindings layer
lookupIDStr
:=
viper
.
GetString
(
"lookup"
)
if
lookupIDStr
!=
""
{
lookupID
,
ok
:=
parseRecipient
(
lookupIDStr
)
...
...
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