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
b71bcca2
Commit
b71bcca2
authored
2 years ago
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Update connect to use new auth callback interface
parent
dfd866e6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!510
Release
,
!253
General Cleanup
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
connect/connect.go
+11
-8
11 additions, 8 deletions
connect/connect.go
with
11 additions
and
8 deletions
connect/connect.go
+
11
−
8
View file @
b71bcca2
...
...
@@ -8,10 +8,11 @@ package connect
import
(
"encoding/json"
"gitlab.com/elixxir/client/xxdk"
"io"
"time"
"gitlab.com/elixxir/client/xxdk"
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/auth"
...
...
@@ -123,7 +124,8 @@ func Connect(recipient contact.Contact, e2eClient *xxdk.E2e,
signalChannel
<-
connection
}
callback
:=
getAuthCallback
(
cb
,
nil
,
e2eClient
.
GetE2E
(),
e2eClient
.
GetAuth
(),
p
)
e2eClient
.
GetAuth
()
.
AddPartnerCallback
(
recipient
.
ID
,
callback
)
cbs
:=
xxdk
.
MakeAuthCB
(
e2eClient
,
callback
)
e2eClient
.
GetAuth
()
.
AddPartnerCallback
(
recipient
.
ID
,
cbs
)
// Perform the auth request
_
,
err
:=
e2eClient
.
GetAuth
()
.
Request
(
recipient
,
nil
)
...
...
@@ -254,7 +256,6 @@ func getAuthCallback(confirm, request Callback, e2e clientE2e.Handler,
return
&
authCallback
{
confirmCallback
:
confirm
,
requestCallback
:
request
,
connectionE2e
:
e2e
,
connectionParams
:
params
,
authState
:
auth
,
}
...
...
@@ -262,7 +263,7 @@ func getAuthCallback(confirm, request Callback, e2e clientE2e.Handler,
// Confirm will be called when an auth Confirm message is processed.
func
(
a
authCallback
)
Confirm
(
requestor
contact
.
Contact
,
receptionID
receptionID
.
EphemeralIdentity
,
round
rounds
.
Round
)
{
receptionID
receptionID
.
EphemeralIdentity
,
round
rounds
.
Round
,
e2e
*
xxdk
.
E2e
)
{
jww
.
DEBUG
.
Printf
(
"Connection auth request for %s confirmed"
,
requestor
.
ID
.
String
())
defer
a
.
authState
.
DeletePartnerCallback
(
requestor
.
ID
)
...
...
@@ -288,7 +289,8 @@ func (a authCallback) Confirm(requestor contact.Contact,
// Request will be called when an auth Request message is processed.
func
(
a
authCallback
)
Request
(
requestor
contact
.
Contact
,
receptionID
receptionID
.
EphemeralIdentity
,
round
rounds
.
Round
)
{
receptionID
receptionID
.
EphemeralIdentity
,
round
rounds
.
Round
,
e2e
*
xxdk
.
E2e
)
{
if
a
.
requestCallback
==
nil
{
jww
.
ERROR
.
Printf
(
"Received a request when requests are"
+
"not enable, will not accept"
)
...
...
@@ -301,7 +303,7 @@ func (a authCallback) Request(requestor contact.Contact,
a
.
requestCallback
(
nil
)
}
// After confirmation, get the new partner
newPartner
,
err
:=
a
.
connectionE2e
.
GetPartner
(
requestor
.
ID
)
newPartner
,
err
:=
e2e
.
GetE2E
()
.
GetPartner
(
requestor
.
ID
)
if
err
!=
nil
{
jww
.
ERROR
.
Printf
(
"Unable to build connection with "
+
"partner %s: %+v"
,
requestor
.
ID
,
err
)
...
...
@@ -312,13 +314,14 @@ func (a authCallback) Request(requestor contact.Contact,
}
// Return the new Connection object
a
.
requestCallback
(
BuildConnection
(
newPartner
,
a
.
connectionE2e
,
a
.
requestCallback
(
BuildConnection
(
newPartner
,
e2e
.
GetE2E
()
,
a
.
authState
,
a
.
connectionParams
))
}
// Reset will be called when an auth Reset operation occurs.
func
(
a
authCallback
)
Reset
(
requestor
contact
.
Contact
,
receptionID
receptionID
.
EphemeralIdentity
,
round
rounds
.
Round
)
{
receptionID
receptionID
.
EphemeralIdentity
,
round
rounds
.
Round
,
e2e
*
xxdk
.
E2e
)
{
}
// FirstPartitionSize returns the max partition payload size for the
...
...
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