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
acda7de7
Commit
acda7de7
authored
3 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Remove mnemonic logic from storage package
parent
2ee0156a
No related branches found
No related tags found
2 merge requests
!23
Release
,
!19
Implement mnemonic in client
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
storage/mnemonic.go
+0
-37
0 additions, 37 deletions
storage/mnemonic.go
storage/session.go
+0
-10
0 additions, 10 deletions
storage/session.go
with
0 additions
and
47 deletions
storage/mnemonic.go
deleted
100644 → 0
+
0
−
37
View file @
2ee0156a
package
storage
import
(
"gitlab.com/elixxir/client/storage/versioned"
"gitlab.com/xx_network/primitives/netTime"
)
const
(
mnemonicKvKey
=
"mnemonic"
mnemonicKvVersion
=
0
mnemonicPath
=
"/.recovery"
)
func
(
s
*
Session
)
SaveMnemonicInformation
(
data
[]
byte
)
error
{
s
.
mnemonicMux
.
Lock
()
defer
s
.
mnemonicMux
.
Unlock
()
vo
:=
&
versioned
.
Object
{
Version
:
mnemonicKvVersion
,
Timestamp
:
netTime
.
Now
(),
Data
:
data
,
}
return
s
.
mnemonicKV
.
Set
(
mnemonicKvKey
,
mnemonicKvVersion
,
vo
)
}
func
(
s
*
Session
)
LoadMnemonicInformation
()
([]
byte
,
error
)
{
s
.
mux
.
RLock
()
defer
s
.
mux
.
RUnlock
()
vo
,
err
:=
s
.
mnemonicKv
.
Get
(
mnemonicKvKey
,
mnemonicKvVersion
)
if
err
!=
nil
{
return
nil
,
err
}
return
vo
.
Data
,
err
}
This diff is collapsed.
Click to expand it.
storage/session.go
+
0
−
10
View file @
acda7de7
...
@@ -47,11 +47,8 @@ const currentSessionVersion = 0
...
@@ -47,11 +47,8 @@ const currentSessionVersion = 0
// Session object, backed by encrypted filestore
// Session object, backed by encrypted filestore
type
Session
struct
{
type
Session
struct
{
kv
*
versioned
.
KV
kv
*
versioned
.
KV
mnemonicKV
*
versioned
.
KV
mnemonicKv
*
versioned
.
KV
mux
sync
.
RWMutex
mux
sync
.
RWMutex
mnemonicMux
sync
.
RWMutex
//memoized data
//memoized data
regStatus
RegistrationStatus
regStatus
RegistrationStatus
...
@@ -82,16 +79,9 @@ func initStore(baseDir, password string) (*Session, error) {
...
@@ -82,16 +79,9 @@ func initStore(baseDir, password string) (*Session, error) {
"Failed to create storage session"
)
"Failed to create storage session"
)
}
}
// Create a separate file store system for account recovery
mnemonicFS
,
err
:=
ekv
.
NewFilestore
(
baseDir
+
mnemonicPath
,
password
)
if
err
!=
nil
{
return
nil
,
errors
.
WithMessage
(
err
,
"Failed to create mnemonic store"
)
}
s
=
&
Session
{
s
=
&
Session
{
kv
:
versioned
.
NewKV
(
fs
),
kv
:
versioned
.
NewKV
(
fs
),
mnemonicKV
:
versioned
.
NewKV
(
mnemonicFS
),
}
}
return
s
,
nil
return
s
,
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
register
or
sign in
to comment