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
f358b3a8
Commit
f358b3a8
authored
4 years ago
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Put auth processing inside a for loop
parent
2b6804b6
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
auth/callback.go
+42
-34
42 additions, 34 deletions
auth/callback.go
with
42 additions
and
34 deletions
auth/callback.go
+
42
−
34
View file @
f358b3a8
...
...
@@ -12,6 +12,7 @@ import (
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/interfaces"
"gitlab.com/elixxir/client/interfaces/contact"
"gitlab.com/elixxir/client/interfaces/message"
"gitlab.com/elixxir/client/stoppable"
"gitlab.com/elixxir/client/storage/auth"
"gitlab.com/elixxir/crypto/cyclic"
...
...
@@ -25,47 +26,54 @@ import (
func
(
m
*
Manager
)
StartProcessies
()
stoppable
.
Stoppable
{
stop
:=
stoppable
.
NewSingle
(
"Auth"
)
authStore
:=
m
.
storage
.
Auth
()
grp
:=
m
.
storage
.
E2e
()
.
GetGroup
()
go
func
()
{
for
{
select
{
case
<-
stop
.
Quit
()
:
return
case
msg
:=
<-
m
.
rawMessages
:
m
.
processAuthMessage
(
msg
)
}
}
}()
return
stop
}
func
(
m
*
Manager
)
processAuthMessage
(
msg
message
.
Receive
)
{
authStore
:=
m
.
storage
.
Auth
()
//lookup the message, check if it is an auth request
cmixMsg
:=
format
.
Unmarshal
(
msg
.
Payload
)
fp
:=
cmixMsg
.
GetKeyFP
()
jww
.
INFO
.
Printf
(
"RAW AUTH FP: %v"
,
fp
)
// this takes the request lock if it is a specific fp,
//
all
exits after this need to call fail or delete if it is
// this takes the request lock if it is a specific fp,
all
// exits after this need to call fail or delete if it is
// specific
fpType
,
sr
,
myHistoricalPrivKey
,
err
:=
authStore
.
GetFingerprint
(
fp
)
if
err
!=
nil
{
jww
.
TRACE
.
Printf
(
"FINGERPRINT FAILURE: %s"
,
err
.
Error
())
// if the lookup fails, ignore the message. It is
likely
// garbled or for a different protocol
break
// if the lookup fails, ignore the message. It is
//
likely
garbled or for a different protocol
return
}
//denote that the message is not garbled
m
.
storage
.
GetGarbledMessages
()
.
Remove
(
cmixMsg
)
grp
:=
m
.
storage
.
E2e
()
.
GetGroup
()
switch
fpType
{
// if it is general, that means a new request has been received
case
auth
.
General
:
// if it is general, that means a new request has
// been received
m
.
handleRequest
(
cmixMsg
,
myHistoricalPrivKey
,
grp
)
case
auth
.
Specific
:
// if it is specific, that means the original request was sent
// by this users and a confirmation has been received
case
auth
.
Specific
:
jww
.
INFO
.
Printf
(
"Received AutConfirm from %s,"
+
" msgDigest: %s"
,
sr
.
GetPartner
(),
cmixMsg
.
Digest
())
jww
.
INFO
.
Printf
(
"Received AutConfirm from %s, msgDigest: %s"
,
sr
.
GetPartner
(),
cmixMsg
.
Digest
())
m
.
handleConfirm
(
cmixMsg
,
sr
,
grp
)
}
}
}()
return
stop
}
func
(
m
*
Manager
)
handleRequest
(
cmixMsg
format
.
Message
,
myHistoricalPrivKey
*
cyclic
.
Int
,
grp
*
cyclic
.
Group
)
{
...
...
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