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
Automate
Agent sessions
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
c747aa25
Commit
c747aa25
authored
Jul 14, 2022
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
cleanup cmd code path
parent
5e6a3d2f
No related branches found
No related tags found
2 merge requests
!510
Release
,
!271
fix cmd idgen to properly handle existing session files
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
cmd/backup.go
+3
-6
3 additions, 6 deletions
cmd/backup.go
cmd/init.go
+6
-12
6 additions, 12 deletions
cmd/init.go
cmd/precan.go
+3
-6
3 additions, 6 deletions
cmd/precan.go
cmd/proto.go
+3
-6
3 additions, 6 deletions
cmd/proto.go
with
15 additions
and
30 deletions
cmd/backup.go
+
3
−
6
View file @
c747aa25
...
@@ -28,10 +28,7 @@ func loadOrInitBackup(backupPath string, backupPass string, password []byte, sto
...
@@ -28,10 +28,7 @@ func loadOrInitBackup(backupPath string, backupPass string, password []byte, sto
jww
.
INFO
.
Printf
(
"Using Backup sender"
)
jww
.
INFO
.
Printf
(
"Using Backup sender"
)
// create a new client if none exist
// create a new client if none exist
var
net
*
xxdk
.
Cmix
if
_
,
err
:=
os
.
Stat
(
storeDir
);
errors
.
Is
(
err
,
fs
.
ErrNotExist
)
{
var
identity
xxdk
.
ReceptionIdentity
_
,
err
:=
os
.
Stat
(
storeDir
)
if
errors
.
Is
(
err
,
fs
.
ErrNotExist
)
{
// Initialize from scratch
// Initialize from scratch
ndfJson
,
err
:=
ioutil
.
ReadFile
(
viper
.
GetString
(
"ndf"
))
ndfJson
,
err
:=
ioutil
.
ReadFile
(
viper
.
GetString
(
"ndf"
))
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -76,13 +73,13 @@ func loadOrInitBackup(backupPath string, backupPass string, password []byte, sto
...
@@ -76,13 +73,13 @@ func loadOrInitBackup(backupPath string, backupPass string, password []byte, sto
}
}
}
}
// Initialize from storage
// Initialize from storage
net
,
err
=
xxdk
.
LoadCmix
(
storeDir
,
password
,
cmixParams
)
net
,
err
:
=
xxdk
.
LoadCmix
(
storeDir
,
password
,
cmixParams
)
if
err
!=
nil
{
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
}
}
// Load or initialize xxdk.ReceptionIdentity storage
// Load or initialize xxdk.ReceptionIdentity storage
identity
,
err
=
xxdk
.
LoadReceptionIdentity
(
identityStorageKey
,
net
)
identity
,
err
:
=
xxdk
.
LoadReceptionIdentity
(
identityStorageKey
,
net
)
if
err
!=
nil
{
if
err
!=
nil
{
identity
,
err
=
xxdk
.
MakeLegacyReceptionIdentity
(
net
)
identity
,
err
=
xxdk
.
MakeLegacyReceptionIdentity
(
net
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
cmd/init.go
+
6
−
12
View file @
c747aa25
...
@@ -78,10 +78,7 @@ func loadOrInitMessenger(forceLegacy bool, password []byte, storeDir, regCode st
...
@@ -78,10 +78,7 @@ func loadOrInitMessenger(forceLegacy bool, password []byte, storeDir, regCode st
jww
.
INFO
.
Printf
(
"Using normal sender"
)
jww
.
INFO
.
Printf
(
"Using normal sender"
)
// create a new client if none exist
// create a new client if none exist
var
net
*
xxdk
.
Cmix
if
_
,
err
:=
os
.
Stat
(
storeDir
);
errors
.
Is
(
err
,
fs
.
ErrNotExist
)
{
var
identity
xxdk
.
ReceptionIdentity
_
,
err
:=
os
.
Stat
(
storeDir
)
if
errors
.
Is
(
err
,
fs
.
ErrNotExist
)
{
// Initialize from scratch
// Initialize from scratch
ndfJson
,
err
:=
ioutil
.
ReadFile
(
viper
.
GetString
(
"ndf"
))
ndfJson
,
err
:=
ioutil
.
ReadFile
(
viper
.
GetString
(
"ndf"
))
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -95,13 +92,13 @@ func loadOrInitMessenger(forceLegacy bool, password []byte, storeDir, regCode st
...
@@ -95,13 +92,13 @@ func loadOrInitMessenger(forceLegacy bool, password []byte, storeDir, regCode st
}
}
// Initialize from storage
// Initialize from storage
net
,
err
=
xxdk
.
LoadCmix
(
storeDir
,
password
,
cmixParams
)
net
,
err
:
=
xxdk
.
LoadCmix
(
storeDir
,
password
,
cmixParams
)
if
err
!=
nil
{
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
}
}
// Load or initialize xxdk.ReceptionIdentity storage
// Load or initialize xxdk.ReceptionIdentity storage
identity
,
err
=
xxdk
.
LoadReceptionIdentity
(
identityStorageKey
,
net
)
identity
,
err
:
=
xxdk
.
LoadReceptionIdentity
(
identityStorageKey
,
net
)
if
err
!=
nil
{
if
err
!=
nil
{
if
forceLegacy
{
if
forceLegacy
{
jww
.
INFO
.
Printf
(
"Forcing legacy sender"
)
jww
.
INFO
.
Printf
(
"Forcing legacy sender"
)
...
@@ -133,10 +130,7 @@ func loadOrInitVanity(password []byte, storeDir, regCode, userIdPrefix string,
...
@@ -133,10 +130,7 @@ func loadOrInitVanity(password []byte, storeDir, regCode, userIdPrefix string,
jww
.
INFO
.
Printf
(
"Using Vanity sender"
)
jww
.
INFO
.
Printf
(
"Using Vanity sender"
)
// create a new client if none exist
// create a new client if none exist
var
net
*
xxdk
.
Cmix
if
_
,
err
:=
os
.
Stat
(
storeDir
);
errors
.
Is
(
err
,
fs
.
ErrNotExist
)
{
var
identity
xxdk
.
ReceptionIdentity
_
,
err
:=
os
.
Stat
(
storeDir
)
if
errors
.
Is
(
err
,
fs
.
ErrNotExist
)
{
// Initialize from scratch
// Initialize from scratch
ndfJson
,
err
:=
ioutil
.
ReadFile
(
viper
.
GetString
(
"ndf"
))
ndfJson
,
err
:=
ioutil
.
ReadFile
(
viper
.
GetString
(
"ndf"
))
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -150,13 +144,13 @@ func loadOrInitVanity(password []byte, storeDir, regCode, userIdPrefix string,
...
@@ -150,13 +144,13 @@ func loadOrInitVanity(password []byte, storeDir, regCode, userIdPrefix string,
}
}
}
}
// Initialize from storage
// Initialize from storage
net
,
err
=
xxdk
.
LoadCmix
(
storeDir
,
password
,
cmixParams
)
net
,
err
:
=
xxdk
.
LoadCmix
(
storeDir
,
password
,
cmixParams
)
if
err
!=
nil
{
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
}
}
// Load or initialize xxdk.ReceptionIdentity storage
// Load or initialize xxdk.ReceptionIdentity storage
identity
,
err
=
xxdk
.
LoadReceptionIdentity
(
identityStorageKey
,
net
)
identity
,
err
:
=
xxdk
.
LoadReceptionIdentity
(
identityStorageKey
,
net
)
if
err
!=
nil
{
if
err
!=
nil
{
identity
,
err
=
xxdk
.
MakeLegacyReceptionIdentity
(
net
)
identity
,
err
=
xxdk
.
MakeLegacyReceptionIdentity
(
net
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
cmd/precan.go
+
3
−
6
View file @
c747aa25
...
@@ -28,10 +28,7 @@ func loadOrInitPrecan(precanId uint, password []byte, storeDir string,
...
@@ -28,10 +28,7 @@ func loadOrInitPrecan(precanId uint, password []byte, storeDir string,
jww
.
INFO
.
Printf
(
"Using Precanned sender"
)
jww
.
INFO
.
Printf
(
"Using Precanned sender"
)
// create a new client if none exist
// create a new client if none exist
var
net
*
xxdk
.
Cmix
if
_
,
err
:=
os
.
Stat
(
storeDir
);
errors
.
Is
(
err
,
fs
.
ErrNotExist
)
{
var
identity
xxdk
.
ReceptionIdentity
_
,
err
:=
os
.
Stat
(
storeDir
)
if
errors
.
Is
(
err
,
fs
.
ErrNotExist
)
{
// Initialize from scratch
// Initialize from scratch
ndfJson
,
err
:=
ioutil
.
ReadFile
(
viper
.
GetString
(
"ndf"
))
ndfJson
,
err
:=
ioutil
.
ReadFile
(
viper
.
GetString
(
"ndf"
))
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -44,13 +41,13 @@ func loadOrInitPrecan(precanId uint, password []byte, storeDir string,
...
@@ -44,13 +41,13 @@ func loadOrInitPrecan(precanId uint, password []byte, storeDir string,
}
}
}
}
// Initialize from storage
// Initialize from storage
net
,
err
=
xxdk
.
LoadCmix
(
storeDir
,
password
,
cmixParams
)
net
,
err
:
=
xxdk
.
LoadCmix
(
storeDir
,
password
,
cmixParams
)
if
err
!=
nil
{
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
}
}
// Load or initialize xxdk.ReceptionIdentity storage
// Load or initialize xxdk.ReceptionIdentity storage
identity
,
err
=
xxdk
.
LoadReceptionIdentity
(
identityStorageKey
,
net
)
identity
,
err
:
=
xxdk
.
LoadReceptionIdentity
(
identityStorageKey
,
net
)
if
err
!=
nil
{
if
err
!=
nil
{
identity
,
err
=
xxdk
.
MakeLegacyReceptionIdentity
(
net
)
identity
,
err
=
xxdk
.
MakeLegacyReceptionIdentity
(
net
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
cmd/proto.go
+
3
−
6
View file @
c747aa25
...
@@ -26,10 +26,7 @@ func loadOrInitProto(protoUserPath string, password []byte, storeDir string,
...
@@ -26,10 +26,7 @@ func loadOrInitProto(protoUserPath string, password []byte, storeDir string,
jww
.
INFO
.
Printf
(
"Using Proto sender"
)
jww
.
INFO
.
Printf
(
"Using Proto sender"
)
// create a new client if none exist
// create a new client if none exist
var
net
*
xxdk
.
Cmix
if
_
,
err
:=
os
.
Stat
(
storeDir
);
errors
.
Is
(
err
,
fs
.
ErrNotExist
)
{
var
identity
xxdk
.
ReceptionIdentity
_
,
err
:=
os
.
Stat
(
storeDir
)
if
errors
.
Is
(
err
,
fs
.
ErrNotExist
)
{
// Initialize from scratch
// Initialize from scratch
ndfJson
,
err
:=
ioutil
.
ReadFile
(
viper
.
GetString
(
"ndf"
))
ndfJson
,
err
:=
ioutil
.
ReadFile
(
viper
.
GetString
(
"ndf"
))
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -54,13 +51,13 @@ func loadOrInitProto(protoUserPath string, password []byte, storeDir string,
...
@@ -54,13 +51,13 @@ func loadOrInitProto(protoUserPath string, password []byte, storeDir string,
}
}
}
}
// Initialize from storage
// Initialize from storage
net
,
err
=
xxdk
.
LoadCmix
(
storeDir
,
password
,
cmixParams
)
net
,
err
:
=
xxdk
.
LoadCmix
(
storeDir
,
password
,
cmixParams
)
if
err
!=
nil
{
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
}
}
// Load or initialize xxdk.ReceptionIdentity storage
// Load or initialize xxdk.ReceptionIdentity storage
identity
,
err
=
xxdk
.
LoadReceptionIdentity
(
identityStorageKey
,
net
)
identity
,
err
:
=
xxdk
.
LoadReceptionIdentity
(
identityStorageKey
,
net
)
if
err
!=
nil
{
if
err
!=
nil
{
identity
,
err
=
xxdk
.
MakeLegacyReceptionIdentity
(
net
)
identity
,
err
=
xxdk
.
MakeLegacyReceptionIdentity
(
net
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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
sign in
to comment