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
aa4e9ac3
Commit
aa4e9ac3
authored
2 years ago
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
added force-legacy flag
parent
9ab9ae20
No related branches found
No related tags found
3 merge requests
!510
Release
,
!267
Make BuildReceptionIdentity public, and make backup restore function return a...
,
!263
Hotfix/refactor cmd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmd/init.go
+8
-3
8 additions, 3 deletions
cmd/init.go
cmd/root.go
+8
-1
8 additions, 1 deletion
cmd/root.go
with
16 additions
and
4 deletions
cmd/init.go
+
8
−
3
View file @
aa4e9ac3
...
@@ -71,9 +71,9 @@ func init() {
...
@@ -71,9 +71,9 @@ func init() {
rootCmd
.
AddCommand
(
initCmd
)
rootCmd
.
AddCommand
(
initCmd
)
}
}
// loadOrInit
Client
will build a new xxdk.E2e from existing storage
// loadOrInit
Messenger
will build a new xxdk.E2e from existing storage
// or from a new storage that it will create if none already exists
// or from a new storage that it will create if none already exists
func
loadOrInit
Client
(
password
[]
byte
,
storeDir
,
regCode
string
,
func
loadOrInit
Messenger
(
forceLegacy
bool
,
password
[]
byte
,
storeDir
,
regCode
string
,
cmixParams
xxdk
.
CMIXParams
,
e2eParams
xxdk
.
E2EParams
)
*
xxdk
.
E2e
{
cmixParams
xxdk
.
CMIXParams
,
e2eParams
xxdk
.
E2EParams
)
*
xxdk
.
E2e
{
jww
.
INFO
.
Printf
(
"Using normal sender"
)
jww
.
INFO
.
Printf
(
"Using normal sender"
)
...
@@ -93,7 +93,12 @@ func loadOrInitClient(password []byte, storeDir, regCode string,
...
@@ -93,7 +93,12 @@ func loadOrInitClient(password []byte, storeDir, regCode string,
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
}
}
identity
,
err
=
xxdk
.
MakeReceptionIdentity
(
net
)
if
forceLegacy
{
jww
.
INFO
.
Printf
(
"Forcing legacy sender"
)
identity
,
err
=
xxdk
.
MakeLegacyReceptionIdentity
(
net
)
}
else
{
identity
,
err
=
xxdk
.
MakeReceptionIdentity
(
net
)
}
if
err
!=
nil
{
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
}
}
...
...
This diff is collapsed.
Click to expand it.
cmd/root.go
+
8
−
1
View file @
aa4e9ac3
...
@@ -585,6 +585,7 @@ func initE2e(cmixParams xxdk.CMIXParams, e2eParams xxdk.E2EParams) *xxdk.E2e {
...
@@ -585,6 +585,7 @@ func initE2e(cmixParams xxdk.CMIXParams, e2eParams xxdk.E2EParams) *xxdk.E2e {
storePassword
:=
parsePassword
(
viper
.
GetString
(
"password"
))
storePassword
:=
parsePassword
(
viper
.
GetString
(
"password"
))
storeDir
:=
viper
.
GetString
(
"session"
)
storeDir
:=
viper
.
GetString
(
"session"
)
regCode
:=
viper
.
GetString
(
"regcode"
)
regCode
:=
viper
.
GetString
(
"regcode"
)
forceLegacy
:=
viper
.
GetBool
(
"force-legacy"
)
jww
.
DEBUG
.
Printf
(
"sessionDir: %v"
,
storeDir
)
jww
.
DEBUG
.
Printf
(
"sessionDir: %v"
,
storeDir
)
// TODO: This probably shouldn't be initialized globally.
// TODO: This probably shouldn't be initialized globally.
...
@@ -602,7 +603,7 @@ func initE2e(cmixParams xxdk.CMIXParams, e2eParams xxdk.E2EParams) *xxdk.E2e {
...
@@ -602,7 +603,7 @@ func initE2e(cmixParams xxdk.CMIXParams, e2eParams xxdk.E2EParams) *xxdk.E2e {
}
else
if
backupPath
!=
""
{
}
else
if
backupPath
!=
""
{
messenger
=
loadOrInitBackup
(
backupPath
,
backupPass
,
storePassword
,
storeDir
,
cmixParams
,
e2eParams
)
messenger
=
loadOrInitBackup
(
backupPath
,
backupPass
,
storePassword
,
storeDir
,
cmixParams
,
e2eParams
)
}
else
{
}
else
{
messenger
=
loadOrInit
Client
(
storePassword
,
storeDir
,
regCode
,
cmixParams
,
e2eParams
)
messenger
=
loadOrInit
Messenger
(
forceLegacy
,
storePassword
,
storeDir
,
regCode
,
cmixParams
,
e2eParams
)
}
}
// Handle protoUser output
// Handle protoUser output
...
@@ -622,6 +623,9 @@ func initE2e(cmixParams xxdk.CMIXParams, e2eParams xxdk.E2EParams) *xxdk.E2e {
...
@@ -622,6 +623,9 @@ func initE2e(cmixParams xxdk.CMIXParams, e2eParams xxdk.E2EParams) *xxdk.E2e {
// Handle backup output
// Handle backup output
if
backupOut
:=
viper
.
GetString
(
"backupOut"
);
backupOut
!=
""
{
if
backupOut
:=
viper
.
GetString
(
"backupOut"
);
backupOut
!=
""
{
if
!
forceLegacy
{
jww
.
FATAL
.
Panicf
(
"Unable to make backup for non-legacy sender!"
)
}
updateBackupCb
:=
func
(
encryptedBackup
[]
byte
)
{
updateBackupCb
:=
func
(
encryptedBackup
[]
byte
)
{
jww
.
INFO
.
Printf
(
"Backup update received, size %d"
,
jww
.
INFO
.
Printf
(
"Backup update received, size %d"
,
len
(
encryptedBackup
))
len
(
encryptedBackup
))
...
@@ -1131,6 +1135,9 @@ func init() {
...
@@ -1131,6 +1135,9 @@ func init() {
"ID to send message to (if below 40, will be precanned. Use "
+
"ID to send message to (if below 40, will be precanned. Use "
+
"'0x' or 'b64:' for hex and base64 representations)"
)
"'0x' or 'b64:' for hex and base64 representations)"
)
viper
.
BindPFlag
(
"destid"
,
rootCmd
.
Flags
()
.
Lookup
(
"destid"
))
viper
.
BindPFlag
(
"destid"
,
rootCmd
.
Flags
()
.
Lookup
(
"destid"
))
rootCmd
.
PersistentFlags
()
.
Bool
(
"force-legacy"
,
false
,
"Force client to operate using legacy identities."
)
viper
.
BindPFlag
(
"force-legacy"
,
rootCmd
.
PersistentFlags
()
.
Lookup
(
"force-legacy"
))
rootCmd
.
Flags
()
.
StringP
(
"destfile"
,
""
,
rootCmd
.
Flags
()
.
StringP
(
"destfile"
,
""
,
""
,
"Read this contact file for the destination id"
)
""
,
"Read this contact file for the destination id"
)
...
...
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