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
2b55d329
Commit
2b55d329
authored
3 years ago
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Fix the contact information to make sure the user returned by api has the dh keys
parent
5da5f482
Branches
Branches containing commit
Tags
Tags containing commit
3 merge requests
!510
Release
,
!207
WIP: Client Restructure
,
!203
Symmetric broadcast
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
api/client.go
+10
-3
10 additions, 3 deletions
api/client.go
cmd/utils.go
+2
-0
2 additions, 0 deletions
cmd/utils.go
e2e/ratchet/storage.go
+24
-1
24 additions, 1 deletion
e2e/ratchet/storage.go
with
36 additions
and
4 deletions
api/client.go
+
10
−
3
View file @
2b55d329
...
...
@@ -290,7 +290,7 @@ func Login(storageDir string, password []byte,
return
nil
,
err
}
u
:=
c
.
GetUser
()
u
:=
c
.
userState
.
PortableUserInfo
()
jww
.
INFO
.
Printf
(
"Client Logged in:
\n\t
TransmisstionID: %s "
+
"
\n\t
ReceptionID: %s"
,
u
.
TransmissionID
,
u
.
ReceptionID
)
...
...
@@ -334,8 +334,10 @@ func Login(storageDir string, password []byte,
return
nil
,
err
}
user
:=
c
.
userState
.
PortableUserInfo
()
c
.
e2e
,
err
=
e2e
.
Load
(
c
.
storage
.
GetKV
(),
c
.
network
,
c
.
GetU
ser
()
.
ReceptionID
,
c
.
storage
.
GetE2EGroup
(),
u
ser
.
ReceptionID
,
c
.
storage
.
GetE2EGroup
(),
c
.
rng
,
c
.
events
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -700,7 +702,12 @@ func (c *Client) AddService(sp Service) error {
// can be serialized into a byte stream for out-of-band sharing.
func
(
c
*
Client
)
GetUser
()
user
.
Info
{
jww
.
INFO
.
Printf
(
"GetUser()"
)
return
c
.
userState
.
PortableUserInfo
()
cMixUser
:=
c
.
userState
.
PortableUserInfo
()
// Add e2e dh keys
e2e
:=
c
.
GetE2EHandler
()
cMixUser
.
E2eDhPrivateKey
=
e2e
.
GetHistoricalDHPrivkey
()
.
DeepCopy
()
cMixUser
.
E2eDhPublicKey
=
e2e
.
GetHistoricalDHPubkey
()
.
DeepCopy
()
return
cMixUser
}
// GetComms returns the client comms object
...
...
This diff is collapsed.
Click to expand it.
cmd/utils.go
+
2
−
0
View file @
2b55d329
...
...
@@ -82,6 +82,7 @@ func writeContact(c contact.Contact) {
if
outfilePath
==
""
{
return
}
jww
.
INFO
.
Printf
(
"PubKey WRITE: %s"
,
c
.
DhPubKey
.
Text
(
10
))
err
:=
ioutil
.
WriteFile
(
outfilePath
,
c
.
Marshal
(),
0644
)
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
...
...
@@ -102,5 +103,6 @@ func readContact() contact.Contact {
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"Failed to unmarshal contact: %+v"
,
err
)
}
jww
.
INFO
.
Printf
(
"PubKey READ: %s"
,
c
.
DhPubKey
.
Text
(
10
))
return
c
}
This diff is collapsed.
Click to expand it.
e2e/ratchet/storage.go
+
24
−
1
View file @
2b55d329
...
...
@@ -27,11 +27,25 @@ func Load(kv *versioned.KV, myID *id.ID, grp *cyclic.Group,
*
Ratchet
,
error
)
{
kv
=
kv
.
Prefix
(
packagePrefix
)
privKey
,
err
:=
util
.
LoadCyclicKey
(
kv
,
privKeyKey
)
if
err
!=
nil
{
return
nil
,
errors
.
WithMessage
(
err
,
"Failed to load e2e DH private key"
)
}
pubKey
,
err
:=
util
.
LoadCyclicKey
(
kv
,
pubKeyKey
)
if
err
!=
nil
{
return
nil
,
errors
.
WithMessage
(
err
,
"Failed to load e2e DH public key"
)
}
r
:=
&
Ratchet
{
managers
:
make
(
map
[
id
.
ID
]
partner
.
Manager
),
services
:
make
(
map
[
string
]
message
.
Processor
),
myID
:
myID
,
advertisedDHPrivateKey
:
privKey
,
advertisedDHPublicKey
:
pubKey
,
kv
:
kv
,
...
...
@@ -92,6 +106,15 @@ func (r *Ratchet) marshal() ([]byte, error) {
index
++
}
err
:=
util
.
StoreCyclicKey
(
r
.
kv
,
r
.
advertisedDHPrivateKey
,
privKeyKey
)
if
err
!=
nil
{
return
nil
,
err
}
err
=
util
.
StoreCyclicKey
(
r
.
kv
,
r
.
advertisedDHPublicKey
,
pubKeyKey
)
if
err
!=
nil
{
return
nil
,
err
}
return
json
.
Marshal
(
&
contacts
)
}
...
...
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