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
757fb816
Commit
757fb816
authored
3 years ago
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
added a closer to auth and made it called in connect on its closer
parent
514325bb
No related branches found
No related tags found
1 merge request
!510
Release
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
auth/interface.go
+4
-0
4 additions, 0 deletions
auth/interface.go
auth/state.go
+15
-0
15 additions, 0 deletions
auth/state.go
connect/connect.go
+9
-4
9 additions, 4 deletions
connect/connect.go
with
28 additions
and
4 deletions
auth/interface.go
+
4
−
0
View file @
757fb816
...
...
@@ -16,6 +16,7 @@ import (
"gitlab.com/elixxir/primitives/format"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id/ephemeral"
"io"
)
type
State
interface
{
...
...
@@ -94,6 +95,9 @@ type State interface {
// VerifyOwnership checks if the received ownership proof is valid
VerifyOwnership
(
received
,
verified
contact
.
Contact
,
e2e
e2e
.
Handler
)
bool
//Closer stops listening to auth
io
.
Closer
}
// Callbacks is the interface for auth callback methods.
...
...
This diff is collapsed.
Click to expand it.
auth/state.go
+
15
−
0
View file @
757fb816
...
...
@@ -119,3 +119,18 @@ func (s *state) CallAllReceivedRequests() {
func
makeStorePrefix
(
partner
*
id
.
ID
)
string
{
return
"authStore:"
+
base64
.
StdEncoding
.
EncodeToString
(
partner
.
Marshal
())
}
func
(
s
*
state
)
Close
()
error
{
s
.
net
.
DeleteService
(
s
.
e2e
.
GetReceptionID
(),
message
.
Service
{
Identifier
:
s
.
e2e
.
GetReceptionID
()[
:
],
Tag
:
s
.
params
.
RequestTag
,
Metadata
:
nil
,
},
nil
)
s
.
net
.
AddService
(
s
.
e2e
.
GetReceptionID
(),
message
.
Service
{
Identifier
:
s
.
e2e
.
GetReceptionID
()[
:
],
Tag
:
s
.
params
.
ResetRequestTag
,
Metadata
:
nil
,
},
nil
)
return
nil
}
This diff is collapsed.
Click to expand it.
connect/connect.go
+
9
−
4
View file @
757fb816
...
...
@@ -211,6 +211,7 @@ func StartServer(cb Callback, myId *id.ID, privKey *cyclic.Int,
// handler provides an implementation for the Connection interface.
type
handler
struct
{
auth
auth
.
State
partner
partner
.
Manager
e2e
clientE2e
.
Handler
params
Params
...
...
@@ -220,8 +221,9 @@ type handler struct {
// after an E2E partnership has already been confirmed with the given
// partner.Manager.
func
BuildConnection
(
partner
partner
.
Manager
,
e2eHandler
clientE2e
.
Handler
,
p
Params
)
Connection
{
auth
auth
.
State
,
p
Params
)
Connection
{
return
&
handler
{
auth
:
auth
,
partner
:
partner
,
params
:
p
,
e2e
:
e2eHandler
,
...
...
@@ -230,7 +232,10 @@ func BuildConnection(partner partner.Manager, e2eHandler clientE2e.Handler,
// Close deletes this Connection's partner.Manager and releases resources.
func
(
h
*
handler
)
Close
()
error
{
return
h
.
e2e
.
DeletePartner
(
h
.
partner
.
PartnerId
())
if
err
:=
h
.
e2e
.
DeletePartner
(
h
.
partner
.
PartnerId
());
err
!=
nil
{
return
err
}
return
h
.
auth
.
Close
()
}
// GetPartner returns the partner.Manager for this Connection.
...
...
@@ -309,7 +314,7 @@ func (a authCallback) Confirm(requestor contact.Contact,
// Return the new Connection object
if
a
.
confrimCallback
!=
nil
{
a
.
confrimCallback
(
BuildConnection
(
newPartner
,
a
.
connectionE2e
,
a
.
connectionParams
))
a
.
authState
,
a
.
connectionParams
))
}
}
...
...
@@ -341,7 +346,7 @@ func (a authCallback) Request(requestor contact.Contact,
// Return the new Connection object
a
.
requestCallback
(
BuildConnection
(
newPartner
,
a
.
connectionE2e
,
a
.
connectionParams
))
a
.
authState
,
a
.
connectionParams
))
}
// Reset will be called when an auth Reset operation occurs.
...
...
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