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
93b9d13c
Commit
93b9d13c
authored
Oct 8, 2020
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
made autnetication channel creation work
parent
e968b2f4
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/authenticatedChannel.go
+8
-8
8 additions, 8 deletions
api/authenticatedChannel.go
storage/e2e/store.go
+5
-1
5 additions, 1 deletion
storage/e2e/store.go
with
13 additions
and
9 deletions
api/authenticatedChannel.go
+
8
−
8
View file @
93b9d13c
...
@@ -10,11 +10,11 @@ import (
...
@@ -10,11 +10,11 @@ import (
// so this user can send messages to the desired recipient Contact.
// so this user can send messages to the desired recipient Contact.
// To receive confirmation from the remote user, clients must
// To receive confirmation from the remote user, clients must
// register a listener to do that.
// register a listener to do that.
func
(
c
*
Client
)
CreateAuthenticatedChannel
(
recipient
contact
.
Contact
,
func
(
c
*
Client
)
CreateAuthenticatedChannel
(
recipient
contact
.
Contact
)
error
{
payload
[]
byte
)
error
{
jww
.
INFO
.
Printf
(
"CreateAuthenticatedChannel(%v)"
,
recipient
)
jww
.
INFO
.
Printf
(
"CreateAuthenticatedChannel(%v, %v)"
,
sesParam
:=
e2e
.
GetDefaultSessionParams
()
recipient
,
payload
)
return
c
.
storage
.
E2e
()
.
AddPartner
(
recipient
.
ID
,
recipient
.
DhPubKey
,
return
nil
sesParam
,
sesParam
)
}
}
// RegisterAuthConfirmationCb registers a callback for channel
// RegisterAuthConfirmationCb registers a callback for channel
...
@@ -32,15 +32,15 @@ func (c *Client) RegisterAuthRequestCb(cb func(contact contact.Contact,
...
@@ -32,15 +32,15 @@ func (c *Client) RegisterAuthRequestCb(cb func(contact contact.Contact,
}
}
// Create an insecure e2e relationship with a precanned user
// Create an insecure e2e relationship with a precanned user
func
(
c
*
Client
)
MakePrecannedAuthenticatedChannel
(
precannedID
uint
)
contact
.
Contact
{
func
(
c
*
Client
)
MakePrecannedAuthenticatedChannel
(
precannedID
uint
)
(
contact
.
Contact
,
error
)
{
precan
:=
c
.
MakePrecannedContact
(
precannedID
)
precan
:=
c
.
MakePrecannedContact
(
precannedID
)
//add the precanned user as a e2e contact
//add the precanned user as a e2e contact
sesParam
:=
e2e
.
GetDefaultSessionParams
()
sesParam
:=
e2e
.
GetDefaultSessionParams
()
c
.
storage
.
E2e
()
.
AddPartner
(
precan
.
ID
,
precan
.
DhPubKey
,
sesParam
,
sesParam
)
err
:=
c
.
storage
.
E2e
()
.
AddPartner
(
precan
.
ID
,
precan
.
DhPubKey
,
sesParam
,
sesParam
)
return
precan
return
precan
,
err
}
}
// Create an insecure e2e contact object for a precanned user
// Create an insecure e2e contact object for a precanned user
...
...
This diff is collapsed.
Click to expand it.
storage/e2e/store.go
+
5
−
1
View file @
93b9d13c
...
@@ -144,10 +144,14 @@ func (s *Store) save() error {
...
@@ -144,10 +144,14 @@ func (s *Store) save() error {
}
}
func
(
s
*
Store
)
AddPartner
(
partnerID
*
id
.
ID
,
partnerPubKey
*
cyclic
.
Int
,
func
(
s
*
Store
)
AddPartner
(
partnerID
*
id
.
ID
,
partnerPubKey
*
cyclic
.
Int
,
sendParams
,
receiveParams
SessionParams
)
{
sendParams
,
receiveParams
SessionParams
)
error
{
s
.
mux
.
Lock
()
s
.
mux
.
Lock
()
defer
s
.
mux
.
Unlock
()
defer
s
.
mux
.
Unlock
()
if
_
,
ok
:=
s
.
managers
[
*
partnerID
];
ok
{
return
errors
.
New
(
"Cannot overwrite existing partner"
)
}
m
:=
newManager
(
s
.
context
,
s
.
kv
,
partnerID
,
s
.
dhPrivateKey
,
partnerPubKey
,
m
:=
newManager
(
s
.
context
,
s
.
kv
,
partnerID
,
s
.
dhPrivateKey
,
partnerPubKey
,
sendParams
,
receiveParams
)
sendParams
,
receiveParams
)
...
...
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