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
8370bb30
Commit
8370bb30
authored
Oct 19, 2020
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
MORE WORK
parent
99fa093d
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
auth/callback.go
+8
-2
8 additions, 2 deletions
auth/callback.go
auth/confirm.go
+15
-3
15 additions, 3 deletions
auth/confirm.go
auth/request.go
+3
-0
3 additions, 0 deletions
auth/request.go
with
26 additions
and
5 deletions
auth/callback.go
+
8
−
2
View file @
8370bb30
...
...
@@ -167,6 +167,8 @@ func handleRequest(cmixMsg format.Message, myHistoricalPrivKey *cyclic.Int,
Facts
:
facts
,
}
// fixme: the client will never be notified of the channel creation if a
// crash occurs after the store but before the conclusion of the callback
//create the auth storage
if
err
=
storage
.
Auth
()
.
AddReceived
(
c
);
err
!=
nil
{
jww
.
WARN
.
Printf
(
"failed to store contact Auth "
+
...
...
@@ -233,7 +235,8 @@ func doConfirm(sr *auth.SentRequest, grp *cyclic.Group,
"confirmation of %s"
,
sr
.
GetPartner
())
}
// create the relationship
// fixme: channel can get into a bricked state if the first save occurs and
// the second does not
p
:=
e2e
.
GetDefaultSessionParams
()
if
err
:=
storage
.
E2e
()
.
AddPartner
(
sr
.
GetPartner
(),
partnerPubKey
,
p
,
p
);
err
!=
nil
{
...
...
@@ -241,7 +244,6 @@ func doConfirm(sr *auth.SentRequest, grp *cyclic.Group,
"after confirmation: %+v"
,
sr
.
GetPartner
(),
err
)
}
net
.
CheckGarbledMessages
()
// delete the in progress negotiation
if
err
:=
storage
.
Auth
()
.
Delete
(
sr
.
GetPartner
());
err
!=
nil
{
...
...
@@ -258,8 +260,12 @@ func doConfirm(sr *auth.SentRequest, grp *cyclic.Group,
Facts
:
make
([]
contact
.
Fact
,
0
),
}
// fixme: if a crash occurs before or during the call, the notification
// will never be sent.
go
ccb
(
c
)
net
.
CheckGarbledMessages
()
return
nil
}
...
...
This diff is collapsed.
Click to expand it.
auth/confirm.go
+
15
−
3
View file @
8370bb30
...
...
@@ -5,7 +5,9 @@ import (
"gitlab.com/elixxir/client/interfaces"
"gitlab.com/elixxir/client/interfaces/contact"
"gitlab.com/elixxir/client/storage"
"gitlab.com/elixxir/crypto/diffieHellman"
"io"
cAuth
"gitlab.com/elixxir/crypto/e2e/auth"
)
func
ConfirmRequestAuth
(
partner
contact
.
Contact
,
rng
io
.
Reader
,
...
...
@@ -19,17 +21,27 @@ func ConfirmRequestAuth(partner contact.Contact, rng io.Reader,
// check if the partner has an auth in progress
storedContact
,
err
:=
storage
.
Auth
()
.
GetReceivedRequest
(
partner
.
ID
)
if
err
=
=
nil
{
if
err
!
=
nil
{
return
errors
.
Errorf
(
"failed to find a pending Auth Request: %s"
,
err
)
}
// verify the passed contact matches what is stored
if
storedContact
.
DhPubKey
.
Cmp
(
partner
.
DhPubKey
)
!=
0
{
return
errors
.
Errorf
(
"Pending Auth Request has diferent pubkey than : %s"
,
return
errors
.
Errorf
(
"Pending Auth Request has different "
+
"pubkey than stored"
,
err
)
}
// chec
grp
:=
storage
.
E2e
()
.
GetGroup
()
//generate ownership proof
ownership
:=
cAuth
.
MakeOwnershipProof
(
storage
.
E2e
()
.
GetDHPrivateKey
(),
partner
.
DhPubKey
,
storage
.
E2e
()
.
GetGroup
())
//generate new keypair
newPrivKey
:=
diffieHellman
.
GeneratePrivateKey
(
256
,
grp
,
rng
)
newPubKey
:=
diffieHellman
.
GeneratePublicKey
(
newPrivKey
,
grp
)
}
This diff is collapsed.
Click to expand it.
auth/request.go
+
3
−
0
View file @
8370bb30
...
...
@@ -150,6 +150,9 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
jww
.
ERROR
.
Printf
(
"request failed to transmit, will be "
+
"handled on reconnect"
)
storage
.
GetCriticalRawMessages
()
.
Failed
(
cmixMsg
)
}
else
{
storage
.
GetCriticalRawMessages
()
.
Succeeded
(
cmixMsg
)
}
return
nil
}
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