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
89d5a774
Commit
89d5a774
authored
3 years ago
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
bindings
parent
32ce1bd2
No related branches found
No related tags found
1 merge request
!510
Release
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bindings/e2e.go
+6
-5
6 additions, 5 deletions
bindings/e2e.go
with
6 additions
and
5 deletions
bindings/e2e.go
+
6
−
5
View file @
89d5a774
...
...
@@ -13,6 +13,7 @@ import (
"gitlab.com/elixxir/client/cmix/rounds"
"gitlab.com/elixxir/client/xxdk"
"gitlab.com/elixxir/crypto/contact"
"gitlab.com/elixxir/crypto/cyclic"
"gitlab.com/xx_network/crypto/signature/rsa"
"gitlab.com/xx_network/primitives/id"
)
...
...
@@ -35,16 +36,16 @@ func (e *E2e) GetID() int {
return
e
.
id
}
// Login creates and returns a new E2e object and adds it to the e2eTrackerSingleton
// Login
E2e
creates and returns a new E2e object and adds it to the e2eTrackerSingleton
// identity should be created via MakeIdentity() and passed in here
// If callbacks is left nil, a default auth.Callbacks will be used
func
(
e
*
E2e
)
Login
(
cmixId
int
,
callbacks
AuthCallbacks
,
identity
[]
byte
)
(
*
E2e
,
error
)
{
func
Login
E2e
(
cmixId
int
,
callbacks
AuthCallbacks
,
identity
[]
byte
)
(
*
E2e
,
error
)
{
cmix
,
err
:=
cmixTrackerSingleton
.
get
(
cmixId
)
if
err
!=
nil
{
return
nil
,
err
}
newIdentity
,
err
:=
e
.
unmarshalIdentity
(
identity
)
newIdentity
,
err
:=
unmarshalIdentity
(
identity
,
cmix
.
api
.
GetStorage
()
.
GetE2EGroup
()
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -69,7 +70,7 @@ func (e *E2e) GetContact() []byte {
}
// unmarshalIdentity is a helper function for taking in a marshalled xxdk.ReceptionIdentity and making it an object
func
(
e
*
E2e
)
unmarshalIdentity
(
marshaled
[]
byte
)
(
xxdk
.
ReceptionIdentity
,
error
)
{
func
unmarshalIdentity
(
marshaled
[]
byte
,
e2eGrp
*
cyclic
.
Group
)
(
xxdk
.
ReceptionIdentity
,
error
)
{
newIdentity
:=
xxdk
.
ReceptionIdentity
{}
// Unmarshal given identity into ReceptionIdentity object
...
...
@@ -84,7 +85,7 @@ func (e *E2e) unmarshalIdentity(marshaled []byte) (xxdk.ReceptionIdentity, error
return
xxdk
.
ReceptionIdentity
{},
err
}
newIdentity
.
DHKeyPrivate
=
e
.
api
.
GetStorage
()
.
GetE2EGroup
()
.
NewInt
(
1
)
newIdentity
.
DHKeyPrivate
=
e
2eGrp
.
NewInt
(
1
)
err
=
newIdentity
.
DHKeyPrivate
.
UnmarshalJSON
(
givenIdentity
.
DHKeyPrivate
)
if
err
!=
nil
{
return
xxdk
.
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