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
1c55b184
Commit
1c55b184
authored
2 years ago
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
load/init ee2e for login
parent
52f4dade
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!510
Release
,
!258
Hotfix/integration fixes
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xxdk/e2e.go
+34
-6
34 additions, 6 deletions
xxdk/e2e.go
with
34 additions
and
6 deletions
xxdk/e2e.go
+
34
−
6
View file @
1c55b184
...
...
@@ -72,7 +72,7 @@ func LoginLegacy(client *Cmix, callbacks AuthCallbacks) (m *E2e, err error) {
backup
:
&
Container
{},
}
m
.
e2e
,
err
=
L
oadOrInitE2e
(
client
)
m
.
e2e
,
err
=
l
oadOrInitE2e
Legacy
(
client
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -222,9 +222,7 @@ func login(client *Cmix, callbacks AuthCallbacks,
}
//load the new e2e storage
m
.
e2e
,
err
=
e2e
.
Load
(
kv
,
client
.
GetCmix
(),
identity
.
ID
,
e2eGrp
,
client
.
GetRng
(),
client
.
GetEventReporter
())
m
.
e2e
,
err
=
loadOrInitE2e
(
client
,
dhPrivKey
)
if
err
!=
nil
{
return
nil
,
errors
.
WithMessage
(
err
,
"Failed to load a "
+
"newly created e2e store"
)
...
...
@@ -246,10 +244,40 @@ func login(client *Cmix, callbacks AuthCallbacks,
return
m
,
err
}
// LoadOrInitE2e loads the e2e handler or makes a new one, generating a new
// loadOrInitE2e loads the modern e2e handler or makes a new one,
// generating a new e2e private key
func
loadOrInitE2e
(
client
*
Cmix
,
privKey
*
cyclic
.
Int
)
(
e2e
.
Handler
,
error
)
{
usr
:=
client
.
GetStorage
()
.
PortableUserInfo
()
e2eGrp
:=
client
.
GetStorage
()
.
GetE2EGroup
()
kv
:=
client
.
GetStorage
()
.
GetKV
()
e2eHandler
,
err
:=
e2e
.
Load
(
kv
,
client
.
GetCmix
(),
usr
.
ReceptionID
,
e2eGrp
,
client
.
GetRng
(),
client
.
GetEventReporter
())
if
err
!=
nil
{
//initialize the e2e storage
err
=
e2e
.
Init
(
kv
,
usr
.
ReceptionID
,
privKey
,
e2eGrp
,
rekey
.
GetDefaultParams
())
if
err
!=
nil
{
return
nil
,
err
}
//load the new e2e storage
e2eHandler
,
err
=
e2e
.
Load
(
kv
,
client
.
GetCmix
(),
usr
.
ReceptionID
,
e2eGrp
,
client
.
GetRng
(),
client
.
GetEventReporter
())
if
err
!=
nil
{
return
nil
,
errors
.
WithMessage
(
err
,
"Failed to load a "
+
"newly created e2e store"
)
}
}
return
e2eHandler
,
nil
}
// loadOrInitE2eLegacy loads the e2e handler or makes a new one, generating a new
// e2e private key. It attempts to load via a legacy construction, then tries
// to load the modern one, creating a new modern ID if neither can be found
func
L
oadOrInitE2e
(
client
*
Cmix
)
(
e2e
.
Handler
,
error
)
{
func
l
oadOrInitE2e
Legacy
(
client
*
Cmix
)
(
e2e
.
Handler
,
error
)
{
usr
:=
client
.
GetStorage
()
.
PortableUserInfo
()
e2eGrp
:=
client
.
GetStorage
()
.
GetE2EGroup
()
kv
:=
client
.
GetStorage
()
.
GetKV
()
...
...
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