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
b022d2e9
Commit
b022d2e9
authored
Jun 28, 2022
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Update other servers to use params and thread through to cmd/root
parent
1fb4f73e
No related branches found
No related tags found
2 merge requests
!510
Release
,
!253
General Cleanup
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
cmd/root.go
+1
-1
1 addition, 1 deletion
cmd/root.go
restlike/connect/server.go
+1
-1
1 addition, 1 deletion
restlike/connect/server.go
xxdk/e2e.go
+20
-16
20 additions, 16 deletions
xxdk/e2e.go
xxdk/params.go
+3
-0
3 additions, 0 deletions
xxdk/params.go
with
25 additions
and
18 deletions
cmd/root.go
+
1
−
1
View file @
b022d2e9
...
...
@@ -674,7 +674,7 @@ func initClient(cmixParams xxdk.CMIXParams, e2eParams xxdk.E2EParams) *xxdk.E2e
authCbs
=
makeAuthCallbacks
(
viper
.
GetBool
(
"unsafe-channel-creation"
),
e2eParams
)
client
,
err
:=
xxdk
.
LoginLegacy
(
baseclient
,
authCbs
)
client
,
err
:=
xxdk
.
LoginLegacy
(
baseclient
,
e2eParams
,
authCbs
)
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
}
...
...
This diff is collapsed.
Click to expand it.
restlike/connect/server.go
+
1
−
1
View file @
b022d2e9
...
...
@@ -23,7 +23,7 @@ type Server struct {
// NewServer builds a RestServer with connect.Connection and
// the provided arguments, then registers necessary external services
func
NewServer
(
identity
xxdk
.
ReceptionIdentity
,
net
*
xxdk
.
Cmix
,
p
connect
.
Params
)
(
*
Server
,
error
)
{
p
xxdk
.
E2E
Params
)
(
*
Server
,
error
)
{
newServer
:=
&
Server
{
receptionId
:
identity
.
ID
,
endpoints
:
restlike
.
NewEndpoints
(),
...
...
This diff is collapsed.
Click to expand it.
xxdk/e2e.go
+
20
−
16
View file @
b022d2e9
...
...
@@ -51,21 +51,24 @@ type AuthCallbacks interface {
// It bundles a Cmix object with a ReceptionIdentity object
// and initializes the auth.State and e2e.Handler objects
func
Login
(
client
*
Cmix
,
callbacks
AuthCallbacks
,
identity
ReceptionIdentity
)
(
m
*
E2e
,
err
error
)
{
return
login
(
client
,
callbacks
,
identity
,
client
.
GetStorage
()
.
GetKV
())
identity
ReceptionIdentity
,
params
E2EParams
)
(
m
*
E2e
,
err
error
)
{
return
login
(
client
,
callbacks
,
identity
,
client
.
GetStorage
()
.
GetKV
(),
params
)
}
// LoginEphemeral creates a new E2e backed by a totally ephemeral versioned.KV
func
LoginEphemeral
(
client
*
Cmix
,
callbacks
AuthCallbacks
,
identity
ReceptionIdentity
)
(
m
*
E2e
,
err
error
)
{
return
login
(
client
,
callbacks
,
identity
,
versioned
.
NewKV
(
ekv
.
MakeMemstore
()))
identity
ReceptionIdentity
,
params
E2EParams
)
(
m
*
E2e
,
err
error
)
{
return
login
(
client
,
callbacks
,
identity
,
versioned
.
NewKV
(
ekv
.
MakeMemstore
()),
params
)
}
// LoginLegacy creates a new E2e backed by the xxdk.Cmix persistent versioned.KV
// Uses the pre-generated transmission ID used by xxdk.Cmix.
// This function is designed to maintain backwards compatibility with previous
// xx messenger designs and should not be used for other purposes.
func
LoginLegacy
(
client
*
Cmix
,
callbacks
AuthCallbacks
)
(
m
*
E2e
,
err
error
)
{
func
LoginLegacy
(
client
*
Cmix
,
params
E2EParams
,
callbacks
AuthCallbacks
)
(
m
*
E2e
,
err
error
)
{
m
=
&
E2e
{
Cmix
:
client
,
backup
:
&
Container
{},
...
...
@@ -87,8 +90,8 @@ func LoginLegacy(client *Cmix, callbacks AuthCallbacks) (m *E2e, err error) {
m
.
auth
,
err
=
auth
.
NewStateLegacy
(
client
.
GetStorage
()
.
GetKV
(),
client
.
GetCmix
(),
m
.
e2e
,
client
.
GetRng
(),
client
.
GetEventReporter
(),
auth
.
GetDefaultParams
(),
acw
,
m
.
backup
.
TriggerBackup
)
client
.
GetEventReporter
(),
params
.
Auth
,
params
.
Session
,
acw
,
m
.
backup
.
TriggerBackup
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -108,7 +111,8 @@ func LoginLegacy(client *Cmix, callbacks AuthCallbacks) (m *E2e, err error) {
// while replacing the base NDF. This is designed for some specific deployment
// procedures and is generally unsafe.
func
LoginWithNewBaseNDF_UNSAFE
(
storageDir
string
,
password
[]
byte
,
newBaseNdf
string
,
params
CMIXParams
)
(
*
E2e
,
error
)
{
newBaseNdf
string
,
e2eParams
E2EParams
,
cmixParams
CMIXParams
)
(
*
E2e
,
error
)
{
jww
.
INFO
.
Printf
(
"LoginWithNewBaseNDF_UNSAFE()"
)
def
,
err
:=
ParseNDF
(
newBaseNdf
)
...
...
@@ -116,7 +120,7 @@ func LoginWithNewBaseNDF_UNSAFE(storageDir string, password []byte,
return
nil
,
err
}
c
,
err
:=
LoadCmix
(
storageDir
,
password
,
p
arams
)
c
,
err
:=
LoadCmix
(
storageDir
,
password
,
cmixP
arams
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -140,7 +144,7 @@ func LoginWithNewBaseNDF_UNSAFE(storageDir string, password []byte,
return
nil
,
err
}
return
LoginLegacy
(
c
,
nil
)
return
LoginLegacy
(
c
,
e2eParams
,
nil
)
}
// LoginWithProtoClient creates a client object with a protoclient
...
...
@@ -148,7 +152,7 @@ func LoginWithNewBaseNDF_UNSAFE(storageDir string, password []byte,
// some specific deployment procedures and is generally unsafe.
func
LoginWithProtoClient
(
storageDir
string
,
password
[]
byte
,
protoClientJSON
[]
byte
,
newBaseNdf
string
,
callbacks
AuthCallbacks
,
p
arams
CMIXParams
)
(
*
E2e
,
error
)
{
cmixP
arams
CMIXParams
,
e2eParams
E2EParams
)
(
*
E2e
,
error
)
{
jww
.
INFO
.
Printf
(
"LoginWithProtoClient()"
)
def
,
err
:=
ParseNDF
(
newBaseNdf
)
...
...
@@ -168,7 +172,7 @@ func LoginWithProtoClient(storageDir string, password []byte,
return
nil
,
err
}
c
,
err
:=
LoadCmix
(
storageDir
,
password
,
p
arams
)
c
,
err
:=
LoadCmix
(
storageDir
,
password
,
cmixP
arams
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -192,12 +196,12 @@ func LoginWithProtoClient(storageDir string, password []byte,
RSAPrivatePem
:
protoUser
.
ReceptionRSA
,
Salt
:
protoUser
.
ReceptionSalt
,
DHKeyPrivate
:
protoUser
.
E2eDhPrivateKey
,
})
}
,
e2eParams
)
}
// login creates a new xxdk.E2e backed by the given versioned.KV
func
login
(
client
*
Cmix
,
callbacks
AuthCallbacks
,
identity
ReceptionIdentity
,
kv
*
versioned
.
KV
)
(
m
*
E2e
,
err
error
)
{
func
login
(
client
*
Cmix
,
callbacks
AuthCallbacks
,
identity
ReceptionIdentity
,
kv
*
versioned
.
KV
,
params
E2EParams
)
(
m
*
E2e
,
err
error
)
{
// Verify the passed-in ReceptionIdentity matches its properties
generatedId
,
err
:=
xx
.
NewID
(
identity
.
RSAPrivatePem
.
GetPublic
(),
identity
.
Salt
,
id
.
User
)
...
...
@@ -255,7 +259,7 @@ func login(client *Cmix, callbacks AuthCallbacks,
m
.
auth
,
err
=
auth
.
NewState
(
kv
,
client
.
GetCmix
(),
m
.
e2e
,
client
.
GetRng
(),
client
.
GetEventReporter
(),
auth
.
GetDefaultTemporaryParams
()
,
acw
,
m
.
backup
.
TriggerBackup
)
params
.
Auth
,
params
.
Session
,
acw
,
m
.
backup
.
TriggerBackup
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
This diff is collapsed.
Click to expand it.
xxdk/params.go
+
3
−
0
View file @
b022d2e9
...
...
@@ -13,6 +13,7 @@ package xxdk
import
(
"encoding/json"
"gitlab.com/elixxir/client/auth"
"gitlab.com/elixxir/client/cmix"
"gitlab.com/elixxir/client/e2e"
"gitlab.com/elixxir/client/e2e/ratchet/partner/session"
...
...
@@ -39,6 +40,7 @@ type E2EParams struct {
Base
e2e
.
Params
Rekey
rekey
.
Params
EphemeralRekey
rekey
.
Params
Auth
auth
.
Params
}
////////////////////////////////////////
...
...
@@ -75,6 +77,7 @@ func GetDefaultE2EParams() E2EParams {
Base
:
e2e
.
GetDefaultParams
(),
Rekey
:
rekey
.
GetDefaultParams
(),
EphemeralRekey
:
rekey
.
GetDefaultEphemeralParams
(),
Auth
:
auth
.
GetDefaultParams
(),
}
}
...
...
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