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
f70d9ac7
Commit
f70d9ac7
authored
Jul 13, 2022
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
clean up comments
parent
3f751400
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
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
storage/session.go
+8
-10
8 additions, 10 deletions
storage/session.go
with
8 additions
and
10 deletions
storage/session.go
+
8
−
10
View file @
f70d9ac7
...
@@ -32,13 +32,11 @@ import (
...
@@ -32,13 +32,11 @@ import (
"gitlab.com/xx_network/primitives/ndf"
"gitlab.com/xx_network/primitives/ndf"
)
)
// Number of rounds to store in the CheckedRound buffer
const
CheckRoundsMaxSize
=
1000000
/
64
const
currentSessionVersion
=
0
const
currentSessionVersion
=
0
const
cmixGroupKey
=
"cmixGroup"
const
cmixGroupKey
=
"cmixGroup"
const
e2eGroupKey
=
"e2eGroup"
const
e2eGroupKey
=
"e2eGroup"
// Session object, backed by encrypted
filestore
// Session object, backed by encrypted
versioned.KVc
type
Session
interface
{
type
Session
interface
{
GetClientVersion
()
version
.
Version
GetClientVersion
()
version
.
Version
Get
(
key
string
)
(
*
versioned
.
Object
,
error
)
Get
(
key
string
)
(
*
versioned
.
Object
,
error
)
...
@@ -88,7 +86,7 @@ type session struct {
...
@@ -88,7 +86,7 @@ type session struct {
clientVersion
*
clientVersion
.
Store
clientVersion
*
clientVersion
.
Store
}
}
//
I
nitialize a new Session object
//
initStore i
nitialize
s
a new Session object
func
initStore
(
baseDir
,
password
string
)
(
*
session
,
error
)
{
func
initStore
(
baseDir
,
password
string
)
(
*
session
,
error
)
{
fs
,
err
:=
ekv
.
NewFilestore
(
baseDir
,
password
)
fs
,
err
:=
ekv
.
NewFilestore
(
baseDir
,
password
)
var
s
*
session
var
s
*
session
...
@@ -104,7 +102,7 @@ func initStore(baseDir, password string) (*session, error) {
...
@@ -104,7 +102,7 @@ func initStore(baseDir, password string) (*session, error) {
return
s
,
nil
return
s
,
nil
}
}
//
Creates n
ew UserData in the session
//
N
ew UserData in the session
func
New
(
baseDir
,
password
string
,
u
user
.
Info
,
func
New
(
baseDir
,
password
string
,
u
user
.
Info
,
currentVersion
version
.
Version
,
currentVersion
version
.
Version
,
cmixGrp
,
e2eGrp
*
cyclic
.
Group
)
(
Session
,
error
)
{
cmixGrp
,
e2eGrp
*
cyclic
.
Group
)
(
Session
,
error
)
{
...
@@ -141,7 +139,7 @@ func New(baseDir, password string, u user.Info,
...
@@ -141,7 +139,7 @@ func New(baseDir, password string, u user.Info,
return
s
,
nil
return
s
,
nil
}
}
// Load
s
existing user data into the session
// Load existing user data into the session
func
Load
(
baseDir
,
password
string
,
currentVersion
version
.
Version
)
(
Session
,
error
)
{
func
Load
(
baseDir
,
password
string
,
currentVersion
version
.
Version
)
(
Session
,
error
)
{
s
,
err
:=
initStore
(
baseDir
,
password
)
s
,
err
:=
initStore
(
baseDir
,
password
)
...
@@ -198,7 +196,7 @@ func (s *session) Set(key string, object *versioned.Object) error {
...
@@ -198,7 +196,7 @@ func (s *session) Set(key string, object *versioned.Object) error {
return
s
.
kv
.
Set
(
key
,
currentSessionVersion
,
object
)
return
s
.
kv
.
Set
(
key
,
currentSessionVersion
,
object
)
}
}
//
d
elete a value in the session
//
D
elete a value in the session
func
(
s
*
session
)
Delete
(
key
string
)
error
{
func
(
s
*
session
)
Delete
(
key
string
)
error
{
return
s
.
kv
.
Delete
(
key
,
currentSessionVersion
)
return
s
.
kv
.
Delete
(
key
,
currentSessionVersion
)
}
}
...
@@ -208,17 +206,17 @@ func (s *session) GetKV() *versioned.KV {
...
@@ -208,17 +206,17 @@ func (s *session) GetKV() *versioned.KV {
return
s
.
kv
return
s
.
kv
}
}
// GetCmixGrou
o
returns cMix Group
// GetCmixGrou
p
returns cMix Group
func
(
s
*
session
)
GetCmixGroup
()
*
cyclic
.
Group
{
func
(
s
*
session
)
GetCmixGroup
()
*
cyclic
.
Group
{
return
s
.
cmixGroup
return
s
.
cmixGroup
}
}
// GetE2EGrou
o
returns cMix Group
// GetE2EGrou
p
returns cMix Group
func
(
s
*
session
)
GetE2EGroup
()
*
cyclic
.
Group
{
func
(
s
*
session
)
GetE2EGroup
()
*
cyclic
.
Group
{
return
s
.
e2eGroup
return
s
.
e2eGroup
}
}
// Init
ializes a
Session object wrapped around a MemStore object.
// Init
Testing
Session object wrapped around a MemStore object.
// FOR TESTING ONLY
// FOR TESTING ONLY
func
InitTestingSession
(
i
interface
{})
Session
{
func
InitTestingSession
(
i
interface
{})
Session
{
switch
i
.
(
type
)
{
switch
i
.
(
type
)
{
...
...
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