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
5b095fc0
Commit
5b095fc0
authored
Jul 7, 2022
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
general cleanup
parent
ed09e127
No related branches found
No related tags found
1 merge request
!510
Release
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
backup/backupRestore.go
+6
-9
6 additions, 9 deletions
backup/backupRestore.go
backup/keyStorage.go
+0
-1
0 additions, 1 deletion
backup/keyStorage.go
cmd/root.go
+1
-3
1 addition, 3 deletions
cmd/root.go
xxdk/cmix.go
+4
-5
4 additions, 5 deletions
xxdk/cmix.go
xxdk/utils_test.go
+1
-1
1 addition, 1 deletion
xxdk/utils_test.go
with
12 additions
and
19 deletions
backup/backupRestore.go
+
6
−
9
View file @
5b095fc0
...
@@ -4,9 +4,6 @@
...
@@ -4,9 +4,6 @@
// All rights reserved. /
// All rights reserved. /
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// FIXME: This is placeholder, there's got to be a better place to put
// backup restoration than inside messenger.
package
backup
package
backup
import
(
import
(
...
@@ -22,9 +19,9 @@ import (
...
@@ -22,9 +19,9 @@ import (
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id"
)
)
// NewClientFromBackup
constructs a new E2
e from an encrypted
// NewClientFromBackup
initializes a new e2e storag
e from an encrypted
// backup. The backup is decrypted using the backupPassphrase. On
// backup. The backup is decrypted using the backupPassphrase. On
//
success
a successful client creation, the function will return a
// a successful client creation, the function will return a
// JSON encoded list of the E2E partners contained in the backup and a
// JSON encoded list of the E2E partners contained in the backup and a
// json-encoded string containing parameters stored in the backup
// json-encoded string containing parameters stored in the backup
func
NewClientFromBackup
(
ndfJSON
,
storageDir
string
,
sessionPassword
,
func
NewClientFromBackup
(
ndfJSON
,
storageDir
string
,
sessionPassword
,
...
@@ -38,7 +35,7 @@ func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword,
...
@@ -38,7 +35,7 @@ func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword,
"Failed to unmarshal decrypted client contents."
)
"Failed to unmarshal decrypted client contents."
)
}
}
us
r
:=
user
.
NewUserFromBackup
(
backUp
)
us
erInfo
:=
user
.
NewUserFromBackup
(
backUp
)
def
,
err
:=
xxdk
.
ParseNDF
(
ndfJSON
)
def
,
err
:=
xxdk
.
ParseNDF
(
ndfJSON
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -49,7 +46,7 @@ func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword,
...
@@ -49,7 +46,7 @@ func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword,
// Note we do not need registration here
// Note we do not need registration here
storageSess
,
err
:=
xxdk
.
CheckVersionAndSetupStorage
(
def
,
storageDir
,
storageSess
,
err
:=
xxdk
.
CheckVersionAndSetupStorage
(
def
,
storageDir
,
sessionPassword
,
us
r
,
cmixGrp
,
e2eGrp
,
sessionPassword
,
us
erInfo
,
cmixGrp
,
e2eGrp
,
backUp
.
RegistrationCode
)
backUp
.
RegistrationCode
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
""
,
err
return
nil
,
""
,
err
...
@@ -69,10 +66,10 @@ func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword,
...
@@ -69,10 +66,10 @@ func NewClientFromBackup(ndfJSON, storageDir string, sessionPassword,
return
nil
,
""
,
err
return
nil
,
""
,
err
}
}
priv
k
ey
:=
us
r
.
E2eDhPrivateKey
priv
K
ey
:=
us
erInfo
.
E2eDhPrivateKey
//initialize the e2e storage
//initialize the e2e storage
err
=
e2e
.
Init
(
storageSess
.
GetKV
(),
us
r
.
ReceptionID
,
priv
k
ey
,
e2eGrp
,
err
=
e2e
.
Init
(
storageSess
.
GetKV
(),
us
erInfo
.
ReceptionID
,
priv
K
ey
,
e2eGrp
,
rekey
.
GetDefaultParams
())
rekey
.
GetDefaultParams
())
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
""
,
err
return
nil
,
""
,
err
...
...
This diff is collapsed.
Click to expand it.
backup/keyStorage.go
+
0
−
1
View file @
5b095fc0
...
@@ -9,7 +9,6 @@ package backup
...
@@ -9,7 +9,6 @@ package backup
import
(
import
(
"bytes"
"bytes"
"github.com/pkg/errors"
"github.com/pkg/errors"
"gitlab.com/elixxir/client/storage/versioned"
"gitlab.com/elixxir/client/storage/versioned"
"gitlab.com/elixxir/crypto/backup"
"gitlab.com/elixxir/crypto/backup"
...
...
This diff is collapsed.
Click to expand it.
cmd/root.go
+
1
−
3
View file @
5b095fc0
...
@@ -643,9 +643,7 @@ func initCmix() (*xxdk.Cmix, xxdk.ReceptionIdentity) {
...
@@ -643,9 +643,7 @@ func initCmix() (*xxdk.Cmix, xxdk.ReceptionIdentity) {
}
}
}
}
cmixParams
,
_
:=
initParams
()
client
,
err
:=
xxdk
.
OpenCmix
(
storeDir
,
pass
)
client
,
err
:=
xxdk
.
OpenCmix
(
storeDir
,
pass
,
cmixParams
)
if
err
!=
nil
{
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
}
}
...
...
This diff is collapsed.
Click to expand it.
xxdk/cmix.go
+
4
−
5
View file @
5b095fc0
...
@@ -106,11 +106,11 @@ func NewVanityClient(ndfJSON, storageDir string, password []byte,
...
@@ -106,11 +106,11 @@ func NewVanityClient(ndfJSON, storageDir string, password []byte,
}
}
cmixGrp
,
e2eGrp
:=
DecodeGroups
(
def
)
cmixGrp
,
e2eGrp
:=
DecodeGroups
(
def
)
protoUser
:=
createNewVanityUser
(
rngStream
,
cmixGrp
,
e2eGrp
,
userInfo
:=
createNewVanityUser
(
rngStream
,
cmixGrp
,
e2eGrp
,
userIdPrefix
)
userIdPrefix
)
_
,
err
=
CheckVersionAndSetupStorage
(
def
,
storageDir
,
password
,
_
,
err
=
CheckVersionAndSetupStorage
(
def
,
storageDir
,
password
,
protoUser
,
cmixGrp
,
e2eGrp
,
registrationCode
)
userInfo
,
cmixGrp
,
e2eGrp
,
registrationCode
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -121,8 +121,7 @@ func NewVanityClient(ndfJSON, storageDir string, password []byte,
...
@@ -121,8 +121,7 @@ func NewVanityClient(ndfJSON, storageDir string, password []byte,
// OpenCmix session, but don't connect to the network or log in
// OpenCmix session, but don't connect to the network or log in
// NOTE: This is a helper function that, in most applications, should not be used on its own
// NOTE: This is a helper function that, in most applications, should not be used on its own
// Consider using LoadCmix instead, which calls this function for you.
// Consider using LoadCmix instead, which calls this function for you.
func
OpenCmix
(
storageDir
string
,
password
[]
byte
,
func
OpenCmix
(
storageDir
string
,
password
[]
byte
)
(
*
Cmix
,
error
)
{
parameters
CMIXParams
)
(
*
Cmix
,
error
)
{
jww
.
INFO
.
Printf
(
"OpenCmix()"
)
jww
.
INFO
.
Printf
(
"OpenCmix()"
)
rngStreamGen
:=
fastRNG
.
NewStreamGenerator
(
12
,
1024
,
rngStreamGen
:=
fastRNG
.
NewStreamGenerator
(
12
,
1024
,
...
@@ -208,7 +207,7 @@ func NewProtoClient_Unsafe(ndfJSON, storageDir string, password []byte,
...
@@ -208,7 +207,7 @@ func NewProtoClient_Unsafe(ndfJSON, storageDir string, password []byte,
func
LoadCmix
(
storageDir
string
,
password
[]
byte
,
parameters
CMIXParams
)
(
*
Cmix
,
error
)
{
func
LoadCmix
(
storageDir
string
,
password
[]
byte
,
parameters
CMIXParams
)
(
*
Cmix
,
error
)
{
jww
.
INFO
.
Printf
(
"LoadCmix()"
)
jww
.
INFO
.
Printf
(
"LoadCmix()"
)
c
,
err
:=
OpenCmix
(
storageDir
,
password
,
parameters
)
c
,
err
:=
OpenCmix
(
storageDir
,
password
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
This diff is collapsed.
Click to expand it.
xxdk/utils_test.go
+
1
−
1
View file @
5b095fc0
...
@@ -45,7 +45,7 @@ func newTestingClient(face interface{}) (*Cmix, error) {
...
@@ -45,7 +45,7 @@ func newTestingClient(face interface{}) (*Cmix, error) {
"Could not construct a mock client: %v"
,
err
)
"Could not construct a mock client: %v"
,
err
)
}
}
c
,
err
:=
OpenCmix
(
storageDir
,
password
,
GetDefaultCMixParams
()
)
c
,
err
:=
OpenCmix
(
storageDir
,
password
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
errors
.
Errorf
(
"Could not open a mock client: %v"
,
return
nil
,
errors
.
Errorf
(
"Could not open a mock client: %v"
,
err
)
err
)
...
...
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