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
ed09e127
Commit
ed09e127
authored
2 years ago
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
fix protouser cmd initialization path
parent
07153b57
No related branches found
No related tags found
1 merge request
!510
Release
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
cmd/root.go
+1
-1
1 addition, 1 deletion
cmd/root.go
xxdk/cmix.go
+11
-5
11 additions, 5 deletions
xxdk/cmix.go
xxdk/e2e.go
+3
-7
3 additions, 7 deletions
xxdk/e2e.go
xxdk/identity.go
+6
-5
6 additions, 5 deletions
xxdk/identity.go
xxdk/precan.go
+4
-3
4 additions, 3 deletions
xxdk/precan.go
with
25 additions
and
21 deletions
cmd/root.go
+
1
−
1
View file @
ed09e127
...
...
@@ -589,7 +589,7 @@ func initCmix() (*xxdk.Cmix, xxdk.ReceptionIdentity) {
jww
.
FATAL
.
Panicf
(
"%v"
,
err
)
}
err
=
xxdk
.
NewProtoClient_Unsafe
(
string
(
ndfJSON
),
storeDir
,
knownReception
,
err
=
xxdk
.
NewProtoClient_Unsafe
(
string
(
ndfJSON
),
storeDir
,
pass
,
protoUser
)
}
else
if
userIDprefix
!=
""
{
err
=
xxdk
.
NewVanityClient
(
string
(
ndfJSON
),
storeDir
,
...
...
This diff is collapsed.
Click to expand it.
xxdk/cmix.go
+
11
−
5
View file @
ed09e127
...
...
@@ -163,14 +163,14 @@ func OpenCmix(storageDir string, password []byte,
// predefined cryptographic which defines a user. This is designed for some
// specific deployment procedures and is generally unsafe.
func
NewProtoClient_Unsafe
(
ndfJSON
,
storageDir
string
,
password
[]
byte
,
protoUser
*
user
.
Proto
)
error
{
protoUser
*
user
.
Proto
)
(
ReceptionIdentity
,
error
)
{
jww
.
INFO
.
Printf
(
"NewProtoClient_Unsafe"
)
usr
:=
user
.
NewUserFromProto
(
protoUser
)
def
,
err
:=
ParseNDF
(
ndfJSON
)
if
err
!=
nil
{
return
err
return
ReceptionIdentity
{},
err
}
cmixGrp
,
e2eGrp
:=
DecodeGroups
(
def
)
...
...
@@ -178,7 +178,13 @@ func NewProtoClient_Unsafe(ndfJSON, storageDir string, password []byte,
storageSess
,
err
:=
CheckVersionAndSetupStorage
(
def
,
storageDir
,
password
,
usr
,
cmixGrp
,
e2eGrp
,
protoUser
.
RegCode
)
if
err
!=
nil
{
return
err
return
ReceptionIdentity
{},
err
}
identity
,
err
:=
buildReceptionIdentity
(
protoUser
.
ReceptionID
,
protoUser
.
ReceptionSalt
,
protoUser
.
ReceptionRSA
,
e2eGrp
,
protoUser
.
E2eDhPrivateKey
)
if
err
!=
nil
{
return
ReceptionIdentity
{},
err
}
storageSess
.
SetReceptionRegistrationValidationSignature
(
...
...
@@ -192,10 +198,10 @@ func NewProtoClient_Unsafe(ndfJSON, storageDir string, password []byte,
err
=
storageSess
.
ForwardRegistrationStatus
(
storage
.
PermissioningComplete
)
if
err
!=
nil
{
return
err
return
ReceptionIdentity
{},
err
}
return
nil
return
identity
,
nil
}
// LoadCmix initializes a Cmix object from existing storage and starts the network
...
...
This diff is collapsed.
Click to expand it.
xxdk/e2e.go
+
3
−
7
View file @
ed09e127
...
...
@@ -98,8 +98,8 @@ func LoginLegacy(client *Cmix, params E2EParams, callbacks AuthCallbacks) (
return
nil
,
err
}
m
.
e2eIdentity
,
err
=
buildReceptionIdentity
(
userInfo
,
m
.
e2e
.
GetGroup
()
,
m
.
e2e
.
GetHistoricalDHPrivkey
())
m
.
e2eIdentity
,
err
=
buildReceptionIdentity
(
userInfo
.
ReceptionID
,
userInfo
.
ReceptionSalt
,
userInfo
.
ReceptionRSA
,
m
.
e2e
.
GetGroup
(),
m
.
e2e
.
GetHistoricalDHPrivkey
())
return
m
,
err
}
...
...
@@ -157,7 +157,7 @@ func LoginWithProtoClient(storageDir string, password []byte,
return
nil
,
err
}
err
=
NewProtoClient_Unsafe
(
newBaseNdf
,
storageDir
,
password
,
receptionIdentity
,
err
:
=
NewProtoClient_Unsafe
(
newBaseNdf
,
storageDir
,
password
,
protoUser
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -174,10 +174,6 @@ func LoginWithProtoClient(storageDir string, password []byte,
if
err
!=
nil
{
return
nil
,
err
}
userInfo
:=
user
.
NewUserFromProto
(
protoUser
)
receptionIdentity
,
err
:=
buildReceptionIdentity
(
userInfo
,
c
.
GetStorage
()
.
GetE2EGroup
(),
protoUser
.
E2eDhPrivateKey
)
return
Login
(
c
,
callbacks
,
receptionIdentity
,
e2eParams
)
}
...
...
This diff is collapsed.
Click to expand it.
xxdk/identity.go
+
6
−
5
View file @
ed09e127
...
...
@@ -176,9 +176,10 @@ func (r ReceptionIdentity) GetContact() contact.Contact {
// buildReceptionIdentity creates a new ReceptionIdentity
// from the given user.Info
func
buildReceptionIdentity
(
userInfo
user
.
Info
,
e2eGrp
*
cyclic
.
Group
,
dHPrivkey
*
cyclic
.
Int
)
(
ReceptionIdentity
,
error
)
{
saltCopy
:=
make
([]
byte
,
len
(
userInfo
.
ReceptionSalt
))
copy
(
saltCopy
,
userInfo
.
ReceptionSalt
)
func
buildReceptionIdentity
(
receptionId
*
id
.
ID
,
receptionSalt
[]
byte
,
receptionRsa
*
rsa
.
PrivateKey
,
e2eGrp
*
cyclic
.
Group
,
dHPrivkey
*
cyclic
.
Int
)
(
ReceptionIdentity
,
error
)
{
saltCopy
:=
make
([]
byte
,
len
(
receptionSalt
))
copy
(
saltCopy
,
receptionSalt
)
grp
,
err
:=
e2eGrp
.
MarshalJSON
()
if
err
!=
nil
{
...
...
@@ -190,8 +191,8 @@ func buildReceptionIdentity(userInfo user.Info, e2eGrp *cyclic.Group, dHPrivkey
}
return
ReceptionIdentity
{
ID
:
userInfo
.
R
eceptionI
D
.
DeepCopy
(),
RSAPrivatePem
:
rsa
.
CreatePrivateKeyPem
(
userInfo
.
R
eceptionR
SA
),
ID
:
r
eceptionI
d
.
DeepCopy
(),
RSAPrivatePem
:
rsa
.
CreatePrivateKeyPem
(
r
eceptionR
sa
),
Salt
:
saltCopy
,
DHKeyPrivate
:
privKey
,
E2eGrp
:
grp
,
...
...
This diff is collapsed.
Click to expand it.
xxdk/precan.go
+
4
−
3
View file @
ed09e127
...
...
@@ -76,14 +76,15 @@ func NewPrecannedClient(precannedID uint, defJSON, storageDir string,
dhPrivKey
:=
generatePrecanDHKeypair
(
precannedID
,
e2eGrp
)
protoUser
:=
CreatePrecannedUser
(
precannedID
,
rngStream
)
identity
,
err
:=
buildReceptionIdentity
(
protoUser
,
e2eGrp
,
dhPrivKey
)
userInfo
:=
CreatePrecannedUser
(
precannedID
,
rngStream
)
identity
,
err
:=
buildReceptionIdentity
(
userInfo
.
ReceptionID
,
userInfo
.
ReceptionSalt
,
userInfo
.
ReceptionRSA
,
e2eGrp
,
dhPrivKey
)
if
err
!=
nil
{
return
ReceptionIdentity
{},
err
}
store
,
err
:=
CheckVersionAndSetupStorage
(
def
,
storageDir
,
password
,
protoUser
,
cmixGrp
,
e2eGrp
,
""
)
userInfo
,
cmixGrp
,
e2eGrp
,
""
)
if
err
!=
nil
{
return
ReceptionIdentity
{},
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