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
5b1c29c8
Commit
5b1c29c8
authored
Sep 25, 2020
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
fixed uses of old contact object
parent
328d9ab3
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
api/authenticatedChannel.go
+7
-4
7 additions, 4 deletions
api/authenticatedChannel.go
api/userDiscovery.go
+9
-6
9 additions, 6 deletions
api/userDiscovery.go
with
16 additions
and
10 deletions
api/authenticatedChannel.go
+
7
−
4
View file @
5b1c29c8
package
api
package
api
import
jww
"github.com/spf13/jwalterweatherman"
import
(
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/interfaces/contact"
)
// CreateAuthenticatedChannel creates a 1-way authenticated channel
// CreateAuthenticatedChannel creates a 1-way authenticated channel
// so this user can send messages to the desired recipient Contact.
// so this user can send messages to the desired recipient Contact.
// To receive confirmation from the remote user, clients must
// To receive confirmation from the remote user, clients must
// register a listener to do that.
// register a listener to do that.
func
(
c
*
Client
)
CreateAuthenticatedChannel
(
recipient
Contact
,
func
(
c
*
Client
)
CreateAuthenticatedChannel
(
recipient
contact
.
Contact
,
payload
[]
byte
)
error
{
payload
[]
byte
)
error
{
jww
.
INFO
.
Printf
(
"CreateAuthenticatedChannel(%v, %v)"
,
jww
.
INFO
.
Printf
(
"CreateAuthenticatedChannel(%v, %v)"
,
recipient
,
payload
)
recipient
,
payload
)
...
@@ -15,14 +18,14 @@ func (c *Client) CreateAuthenticatedChannel(recipient Contact,
...
@@ -15,14 +18,14 @@ func (c *Client) CreateAuthenticatedChannel(recipient Contact,
// RegisterAuthConfirmationCb registers a callback for channel
// RegisterAuthConfirmationCb registers a callback for channel
// authentication confirmation events.
// authentication confirmation events.
func
(
c
*
Client
)
RegisterAuthConfirmationCb
(
cb
func
(
contact
Contact
,
func
(
c
*
Client
)
RegisterAuthConfirmationCb
(
cb
func
(
contact
contact
.
Contact
,
payload
[]
byte
))
{
payload
[]
byte
))
{
jww
.
INFO
.
Printf
(
"RegisterAuthConfirmationCb(...)"
)
jww
.
INFO
.
Printf
(
"RegisterAuthConfirmationCb(...)"
)
}
}
// RegisterAuthRequestCb registers a callback for channel
// RegisterAuthRequestCb registers a callback for channel
// authentication request events.
// authentication request events.
func
(
c
*
Client
)
RegisterAuthRequestCb
(
cb
func
(
contact
Contact
,
func
(
c
*
Client
)
RegisterAuthRequestCb
(
cb
func
(
contact
contact
.
Contact
,
payload
[]
byte
))
{
payload
[]
byte
))
{
jww
.
INFO
.
Printf
(
"RegisterAuthRequestCb(...)"
)
jww
.
INFO
.
Printf
(
"RegisterAuthRequestCb(...)"
)
}
}
This diff is collapsed.
Click to expand it.
api/userDiscovery.go
+
9
−
6
View file @
5b1c29c8
package
api
package
api
import
jww
"github.com/spf13/jwalterweatherman"
import
(
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/interfaces/contact"
)
// Returns true if the cryptographic identity has been registered with
// Returns true if the cryptographic identity has been registered with
// the CMIX user discovery agent.
// the CMIX user discovery agent.
...
@@ -48,7 +51,7 @@ func (c *Client) ConfirmRegistration(token, code []byte) error {
...
@@ -48,7 +51,7 @@ func (c *Client) ConfirmRegistration(token, code []byte) error {
// Search accepts a "separator" separated list of search elements with
// Search accepts a "separator" separated list of search elements with
// an associated list of searchTypes. It returns a ContactList which
// an associated list of searchTypes. It returns a ContactList which
// allows you to iterate over the found contact objects.
// allows you to iterate over the found contact objects.
func
(
c
*
Client
)
Search
(
data
,
separator
string
,
searchTypes
[]
byte
)
[]
Contact
{
func
(
c
*
Client
)
Search
(
data
,
separator
string
,
searchTypes
[]
byte
)
[]
contact
.
Contact
{
jww
.
INFO
.
Printf
(
"Search(%s, %s, %s)"
,
data
,
separator
,
searchTypes
)
jww
.
INFO
.
Printf
(
"Search(%s, %s, %s)"
,
data
,
separator
,
searchTypes
)
return
nil
return
nil
}
}
...
@@ -56,14 +59,14 @@ func (c *Client) Search(data, separator string, searchTypes []byte) []Contact {
...
@@ -56,14 +59,14 @@ func (c *Client) Search(data, separator string, searchTypes []byte) []Contact {
// SearchWithHandler is a non-blocking search that also registers
// SearchWithHandler is a non-blocking search that also registers
// a callback interface for user disovery events.
// a callback interface for user disovery events.
func
(
c
*
Client
)
SearchWithCallback
(
data
,
separator
string
,
searchTypes
[]
byte
,
func
(
c
*
Client
)
SearchWithCallback
(
data
,
separator
string
,
searchTypes
[]
byte
,
cb
func
(
results
[]
Contact
))
{
cb
func
(
results
[]
contact
.
Contact
))
{
resultCh
:=
make
(
chan
[]
Contact
,
1
)
resultCh
:=
make
(
chan
[]
contact
.
Contact
,
1
)
go
func
(
out
chan
[]
Contact
,
data
,
separator
string
,
srchTypes
[]
byte
)
{
go
func
(
out
chan
[]
contact
.
Contact
,
data
,
separator
string
,
srchTypes
[]
byte
)
{
out
<-
c
.
Search
(
data
,
separator
,
srchTypes
)
out
<-
c
.
Search
(
data
,
separator
,
srchTypes
)
close
(
out
)
close
(
out
)
}(
resultCh
,
data
,
separator
,
searchTypes
)
}(
resultCh
,
data
,
separator
,
searchTypes
)
go
func
(
in
chan
[]
Contact
,
cb
func
(
results
[]
Contact
))
{
go
func
(
in
chan
[]
contact
.
Contact
,
cb
func
(
results
[]
contact
.
Contact
))
{
select
{
select
{
case
contacts
:=
<-
in
:
case
contacts
:=
<-
in
:
cb
(
contacts
)
cb
(
contacts
)
...
...
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