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
9851c12a
Commit
9851c12a
authored
2 years ago
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Fix init subcommand
parent
cd002173
No related branches found
No related tags found
3 merge requests
!510
Release
,
!226
WIP: Api2.0
,
!207
WIP: Client Restructure
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/messenger/messenger.go
+3
-3
3 additions, 3 deletions
api/messenger/messenger.go
cmd/init.go
+8
-0
8 additions, 0 deletions
cmd/init.go
with
11 additions
and
3 deletions
api/messenger/messenger.go
+
3
−
3
View file @
9851c12a
...
@@ -29,7 +29,7 @@ func Login(client *api.Client, callbacks auth.Callbacks) (m *Client, err error)
...
@@ -29,7 +29,7 @@ func Login(client *api.Client, callbacks auth.Callbacks) (m *Client, err error)
backup
:
&
Container
{},
backup
:
&
Container
{},
}
}
m
.
e2e
,
err
=
l
oadOrInitE2e
(
client
)
m
.
e2e
,
err
=
L
oadOrInitE2e
(
client
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -44,10 +44,10 @@ func Login(client *api.Client, callbacks auth.Callbacks) (m *Client, err error)
...
@@ -44,10 +44,10 @@ func Login(client *api.Client, callbacks auth.Callbacks) (m *Client, err error)
return
m
,
err
return
m
,
err
}
}
//
l
oadOrInitE2e loads the e2e handler or makes a new one, generating a new
//
L
oadOrInitE2e 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
// 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
// to load the modern one, creating a new modern ID if neither can be found
func
l
oadOrInitE2e
(
client
*
api
.
Client
)
(
e2e
.
Handler
,
error
)
{
func
L
oadOrInitE2e
(
client
*
api
.
Client
)
(
e2e
.
Handler
,
error
)
{
usr
:=
client
.
GetUser
()
usr
:=
client
.
GetUser
()
e2eGrp
:=
client
.
GetStorage
()
.
GetE2EGroup
()
e2eGrp
:=
client
.
GetStorage
()
.
GetE2EGroup
()
kv
:=
client
.
GetStorage
()
.
GetKV
()
kv
:=
client
.
GetStorage
()
.
GetKV
()
...
...
This diff is collapsed.
Click to expand it.
cmd/init.go
+
8
−
0
View file @
9851c12a
...
@@ -10,9 +10,11 @@ package cmd
...
@@ -10,9 +10,11 @@ package cmd
import
(
import
(
"fmt"
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
jww
"github.com/spf13/jwalterweatherman"
jww
"github.com/spf13/jwalterweatherman"
"github.com/spf13/viper"
"github.com/spf13/viper"
"gitlab.com/elixxir/client/api/messenger"
)
)
// initCmd creates a new user object with the given NDF
// initCmd creates a new user object with the given NDF
...
@@ -22,7 +24,13 @@ var initCmd = &cobra.Command{
...
@@ -22,7 +24,13 @@ var initCmd = &cobra.Command{
Args
:
cobra
.
NoArgs
,
Args
:
cobra
.
NoArgs
,
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
client
:=
createClient
()
client
:=
createClient
()
e2e
,
err
:=
messenger
.
LoadOrInitE2e
(
client
)
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
}
user
:=
client
.
GetUser
()
user
:=
client
.
GetUser
()
user
.
E2eDhPublicKey
=
e2e
.
GetHistoricalDHPubkey
()
jww
.
INFO
.
Printf
(
"User: %s"
,
user
.
ReceptionID
)
jww
.
INFO
.
Printf
(
"User: %s"
,
user
.
ReceptionID
)
writeContact
(
user
.
GetContact
())
writeContact
(
user
.
GetContact
())
fmt
.
Printf
(
"%s
\n
"
,
user
.
ReceptionID
)
fmt
.
Printf
(
"%s
\n
"
,
user
.
ReceptionID
)
...
...
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