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
b529ba86
Commit
b529ba86
authored
Aug 7, 2020
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Use the same hack we did before to initialize the session storage in 2 places
parent
86d9f23c
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
api/client.go
+20
-11
20 additions, 11 deletions
api/client.go
api/client_test.go
+0
-2
0 additions, 2 deletions
api/client_test.go
api/private.go
+7
-0
7 additions, 0 deletions
api/private.go
with
27 additions
and
13 deletions
api/client.go
+
20
−
11
View file @
b529ba86
...
@@ -83,6 +83,21 @@ func NewTestClient(s globals.Storage, locA, locB string, ndfJSON *ndf.NetworkDef
...
@@ -83,6 +83,21 @@ func NewTestClient(s globals.Storage, locA, locB string, ndfJSON *ndf.NetworkDef
return
newClient
(
s
,
locA
,
locB
,
ndfJSON
,
sendFunc
)
return
newClient
(
s
,
locA
,
locB
,
ndfJSON
,
sendFunc
)
}
}
func
(
cl
*
Client
)
setStorage
(
locA
,
password
string
)
error
{
// TODO: FIX ME
// While the old session is still valid, we are using the LocA storage to initialize the session
dirname
:=
filepath
.
Dir
(
locA
)
//FIXME: We need to accept the user's password here!
var
err
error
io
.
SessionV2
,
err
=
storage
.
Init
(
dirname
,
password
)
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"Login: could not initialize v2 storage"
)
}
clientcrypto
.
SessionV2
=
io
.
SessionV2
cl
.
sessionV2
=
io
.
SessionV2
return
nil
}
// Creates a new Client using the storage mechanism provided.
// Creates a new Client using the storage mechanism provided.
// If none is provided, a default storage using OS file access
// If none is provided, a default storage using OS file access
// is created
// is created
...
@@ -110,17 +125,6 @@ func newClient(s globals.Storage, locA, locB string, ndfJSON *ndf.NetworkDefinit
...
@@ -110,17 +125,6 @@ func newClient(s globals.Storage, locA, locB string, ndfJSON *ndf.NetworkDefinit
cl
.
ndf
=
ndfJSON
cl
.
ndf
=
ndfJSON
cl
.
sendFunc
=
sendFunc
cl
.
sendFunc
=
sendFunc
// TODO: FIX ME
// While the old session is still valid, we are using the LocA storage to initialize the session
dirname
:=
filepath
.
Dir
(
locA
)
//FIXME: We need to accept the user's password here!
io
.
SessionV2
,
err
=
storage
.
Init
(
dirname
,
"DUMMYPASSWORDFIXME"
)
if
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"Login: could not initialize v2 storage"
)
}
clientcrypto
.
SessionV2
=
io
.
SessionV2
cl
.
sessionV2
=
io
.
SessionV2
//Create the cmix group and init the registry
//Create the cmix group and init the registry
cmixGrp
:=
cyclic
.
NewGroup
(
cmixGrp
:=
cyclic
.
NewGroup
(
large
.
NewIntFromString
(
cl
.
ndf
.
CMIX
.
Prime
,
16
),
large
.
NewIntFromString
(
cl
.
ndf
.
CMIX
.
Prime
,
16
),
...
@@ -170,6 +174,11 @@ func (cl *Client) Login(password string) (*id.ID, error) {
...
@@ -170,6 +174,11 @@ func (cl *Client) Login(password string) (*id.ID, error) {
}
}
cl
.
session
=
session
cl
.
session
=
session
locA
,
_
:=
cl
.
storage
.
GetLocation
()
err
=
cl
.
setStorage
(
locA
,
password
)
if
err
!=
nil
{
return
nil
,
err
}
regState
,
err
:=
cl
.
sessionV2
.
GetRegState
()
regState
,
err
:=
cl
.
sessionV2
.
GetRegState
()
// fixme !
// fixme !
...
...
This diff is collapsed.
Click to expand it.
api/client_test.go
+
0
−
2
View file @
b529ba86
...
@@ -775,8 +775,6 @@ func TestClient_LogoutAndLoginAgain(t *testing.T) {
...
@@ -775,8 +775,6 @@ func TestClient_LogoutAndLoginAgain(t *testing.T) {
t
.
Fatalf
(
"InitNetwork should have succeeded when creating second client %v"
,
err
)
t
.
Fatalf
(
"InitNetwork should have succeeded when creating second client %v"
,
err
)
}
}
io
.
SessionV2
.
SetRegState
(
user
.
PermissioningComplete
)
_
,
err
=
tc
.
Login
(
"password"
)
_
,
err
=
tc
.
Login
(
"password"
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Logf
(
"Login failed %+v"
,
err
)
t
.
Logf
(
"Login failed %+v"
,
err
)
...
...
This diff is collapsed.
Click to expand it.
api/private.go
+
7
−
0
View file @
b529ba86
...
@@ -314,6 +314,13 @@ func (cl *Client) GenerateKeys(rsaPrivKey *rsa.PrivateKey,
...
@@ -314,6 +314,13 @@ func (cl *Client) GenerateKeys(rsaPrivKey *rsa.PrivateKey,
newRm
.
Comms
.
Manager
=
cl
.
receptionManager
.
Comms
.
Manager
newRm
.
Comms
.
Manager
=
cl
.
receptionManager
.
Comms
.
Manager
}
}
cl
.
receptionManager
=
newRm
cl
.
receptionManager
=
newRm
locA
,
_
:=
cl
.
storage
.
GetLocation
()
err
=
cl
.
setStorage
(
locA
,
password
)
if
err
!=
nil
{
return
err
}
//store the session
//store the session
return
cl
.
session
.
StoreSession
()
return
cl
.
session
.
StoreSession
()
}
}
...
...
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