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
4bf0a6d3
Commit
4bf0a6d3
authored
3 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Add LoginWithProtoClient for UDB
parent
59f7d30f
No related branches found
No related tags found
2 merge requests
!117
Release
,
!111
Add LoginWithProtoClient for UDB
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
api/client.go
+52
-1
52 additions, 1 deletion
api/client.go
with
52 additions
and
1 deletion
api/client.go
+
52
−
1
View file @
4bf0a6d3
...
...
@@ -330,7 +330,6 @@ func LoginWithNewBaseNDF_UNSAFE(storageDir string, password []byte,
//Open the client
c
,
err
:=
OpenClient
(
storageDir
,
password
,
parameters
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -374,6 +373,58 @@ func LoginWithNewBaseNDF_UNSAFE(storageDir string, password []byte,
return
c
,
nil
}
// LoginWithProtoClient creates a client object with a protoclient JSON containing the
// cryptographic primitives. This is designed for some specific deployment
//// procedures and is generally unsafe.
func
LoginWithProtoClient
(
storageDir
string
,
password
[]
byte
,
protoClientJSON
[]
byte
,
newBaseNdf
string
,
parameters
params
.
Network
)
(
*
Client
,
error
)
{
jww
.
INFO
.
Printf
(
"LoginWithNewBaseNDF_UNSAFE()"
)
// Parse the NDF
def
,
err
:=
parseNDF
(
newBaseNdf
)
if
err
!=
nil
{
return
nil
,
err
}
//Open the client
err
=
NewProtoClient_Unsafe
(
newBaseNdf
,
storageDir
,
password
,
protoClientJSON
)
if
err
!=
nil
{
return
nil
,
err
}
//Open the client
c
,
err
:=
OpenClient
(
storageDir
,
password
,
parameters
)
if
err
!=
nil
{
return
nil
,
err
}
//initialize comms
err
=
c
.
initComms
()
if
err
!=
nil
{
return
nil
,
err
}
//store the updated base NDF
c
.
storage
.
SetNDF
(
def
)
// Initialize network and link it to context
c
.
network
,
err
=
network
.
NewManager
(
c
.
storage
,
c
.
switchboard
,
c
.
rng
,
c
.
events
,
c
.
comms
,
parameters
,
def
)
if
err
!=
nil
{
return
nil
,
err
}
// initialize the auth tracker
c
.
auth
=
auth
.
NewManager
(
c
.
switchboard
,
c
.
storage
,
c
.
network
)
err
=
c
.
registerFollower
()
if
err
!=
nil
{
return
nil
,
err
}
return
c
,
nil
}
func
(
c
*
Client
)
initComms
()
error
{
var
err
error
...
...
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